<?php

require_once XOOPS_TRUST_PATH . '/libs/xoonips/class/core/Request.class.php';
require_once XOOPS_TRUST_PATH . '/libs/xoonips/class/core/Response.class.php';
require_once XOOPS_TRUST_PATH . '/libs/xoonips/class/core/Utils.class.php';
require_once XOOPS_ROOT_PATH . '/include/cp_header.php';
require_once 'actions/PolicyItemTypeAction.class.php';

$request = new Xoonips_Request();
$response = new Xoonips_Response();
$op = $request->getParameter('op');
if ($op == null) {
	$op = 'init';
}

// check request
if (!in_array($op, array('init', 'register', 'registersave', 'edit', 'editsave', 'copy', 'import', 'delete',
	'release', 'break', 'export', 'groupregister', 'groupregistersave', 'groupedit', 'groupeditsave', 'groupdelete',
	'detailregister', 'detailregistersave', 'detailedit', 'detaileditsave', 'detaildelete', 'complement', 'complementsave'
	, 'groupregisterng', 'groupregisterngsave', 'sorteditsave'
	))) {
	die('illegal reuest');
}

// set action map
$actionMap = array();
$actionMap['init_success'] = 'policy_itemtype.html';
$actionMap['register_success'] = 'policy_itemtype_register.html';
$actionMap['registersave_success'] = 'redirect_header';
$actionMap['edit_success'] = 'policy_itemtype_edit.html';
$actionMap['editsave_success'] = 'redirect_header';
$actionMap['copy_success'] = 'redirect_header';
$actionMap['import_success'] = 'redirect_header';
$actionMap['delete_success'] = 'redirect_header';
$actionMap['release_success'] = 'redirect_header';
$actionMap['break_success'] = 'redirect_header';
$actionMap['groupregister_success'] = 'policy_itemtype_group_register.html';
$actionMap['groupregistersave_success'] = 'redirect_header';
$actionMap['groupedit_success'] = 'policy_itemtype_group_edit.html';
$actionMap['groupeditsave_success'] = 'redirect_header';
$actionMap['groupdelete_success'] = 'redirect_header';
$actionMap['detailregister_success'] = 'policy_itemtype_detail_register.html';
$actionMap['detailregistersave_success'] = 'redirect_header';
$actionMap['detailedit_success'] = 'policy_itemtype_detail_edit.html';
$actionMap['detaileditsave_success'] = 'redirect_header';
$actionMap['detaildelete_success'] = 'redirect_header';
$actionMap['complement_success'] = 'policy_itemtype_complement.html';
$actionMap['complementsave_success'] = 'redirect_header';
$actionMap['groupregisterng_success'] = 'policy_itemtype_group_register.html';
$actionMap['groupregisterngsave_success'] = 'redirect_header';

include XOOPS_ROOT_PATH . '/header.php';

// do action
$action = new Xoonips_PolicyItemTypeAction();
$action->doAction($request, $response);

// forward
$response->forward($actionMap, true);

include XOOPS_ROOT_PATH . '/footer.php';
?>
