<?php
	#gtfwTemplateResponse
	/**
	* @package ViewMenu
	* @copyright Copyright (c) 2012
	* @Analyzed By Dyan Galih <Dyan.Galih@gmail.com>
	* @author Dyan Galih <Dyan.Galih@gmail.com>
	* @version 01
	* @startDate 2012-01-01
	* @lastUpdate 2012-01-01
	* @description View Menu
	*/
	
	require_once Configuration::Instance()->GetValue( 'application', 'docroot') . 'module/'.Dispatcher::Instance()->mModule.'/business/Menu.class.php';
	
	class ViewMenu extends JsonResponse {
		
		function ProcessRequest() {
			$objMenu = new Menu();
			$objMenu->LoadSql('module/menu/business/menu.sql.php');
			$arrMenu = $objMenu->GetDhtmlxMenu();
			
			for($i=0;$i<count($arrMenu);$i++){
				$arrMenu[$i]['url'] = Dispatcher::Instance()->GetUrl($arrMenu[$i]['Module'], $arrMenu[$i]['SubModule'],$arrMenu[$i]['Action'], $arrMenu[$i]['Type']);
				unset($arrMenu[$i]['Module']); 
				unset($arrMenu[$i]['SubModule']);
				unset($arrMenu[$i]['Action']); 
				unset($arrMenu[$i]['Type']);
			}
			

			return array( "exec" => "setMenu(".json_encode($arrMenu).")");
		}

	}
?>