<?php

require_once dirname(dirname(dirname(__FILE__))) . '/class/core/ActionBase.class.php';

class Xoonips_PolicyMenuAction extends Xoonips_ActionBase {

	protected function doInit(&$request, &$response) {

		// breadcrumbs
		$breadcrumbs = array(
  		array(
    		'name' => _AM_XOONIPS_TITLE,
    		'url' => XOOPS_URL.'/modules/'.$this->dirname.'/admin/index.php',
  		),
  		array(
    		'name' => _AM_XOONIPS_POLICY_TITLE,
  		),
		);

		// menu
		if (Xoonips_BeanFactory::chkUserBean()) {
		$menu = array(
  		array(
    		'label' => _AM_XOONIPS_POLICY_ACCOUNT_TITLE,
  			'url' => XOOPS_URL.'/modules/'.$this->dirname.'/admin/policy_user_menu.php',
  		),
  		array(
		    'label' => _AM_XOONIPS_POLICY_GROUP_TITLE,
		    'url' => XOOPS_URL.'/modules/'.$this->dirname.'/admin/policy_group.php',
  		),
  		array(
    		'label' => _AM_XOONIPS_POLICY_ITEM_TITLE,
    		'url' => XOOPS_URL.'/modules/'.$this->dirname.'/admin/policy_item.php',
  		),
  		array(
    		'label' => _AM_XOONIPS_POLICY_OAIPMH_QUOTA_TITLE,
    		'url' => XOOPS_URL.'/modules/'.$this->dirname.'/admin/policy_oaipmh_mapping.php',
 	 	),
		);
		} else {
		$menu = array(
  		array(
    		'label' => _AM_XOONIPS_POLICY_ITEM_TITLE,
    		'url' => XOOPS_URL.'/modules/'.$this->dirname.'/admin/policy_item.php',
  		),
  		array(
    		'label' => _AM_XOONIPS_POLICY_OAIPMH_QUOTA_TITLE,
    		'url' => XOOPS_URL.'/modules/'.$this->dirname.'/admin/policy_oaipmh_mapping.php',
 	 	),
		);
		}

		// get common viewdata
		$viewData = array();

		$viewData['menu'] = $menu;
		$viewData['breadcrumbs'] = $breadcrumbs;

		$response->setViewData($viewData);
		$response->setForward('init_success');

		return true;
	}
}
?>
