<?php
defined('PHP168_PATH') or die();
/**头部导航**/
$this_controller->check_admin_action('navigation_menu') or message('no_privilege');
require_once PHP168_PATH .'admin/inc/navigation_menu.class.php';
if(REQUEST_METHOD == 'GET'){	
	$id = isset($_GET['id']) ? intval($_GET['id']) : 0;	
	load_language($core, 'config');	
	$navigation_menu->cache(false);		
	$config = $core->get_config('core', '');
	include template($core, 'menu/navigation_menu_list', 'admin');
	
}else if(REQUEST_METHOD == 'POST'){
	$type = isset($_POST['type']) ? trim($_POST['type']) : '';
	switch($type){
		case 'html':
			require_once PHP168_PATH .'admin/inc/navigation_menu.class.php';
			$navigation_menu->change_url('html');
			$navigation_menu->get_cache();
		break;
		case 'dynamic':
			require_once PHP168_PATH .'admin/inc/navigation_menu.class.php';
			$navigation_menu->change_url('dynamic');			
			$navigation_menu->get_cache();
		break;
		default:
			$config = isset($_POST['config']) && is_array($_POST['config']) ? $_POST['config'] : array();	
			$orig_admin_controller = $core->CONFIG['admin_controller'];
			$config['ShowMenu']=empty($config['ShowMenu'])? 0 :1;
			$config['CoreMenu']=empty($config['CoreMenu'])? 0 :1;
			$config['MenuMode']=empty($config['MenuMode'])? 0 :1;
			$config['MenuModeHtml']=empty($config['MenuModeHtml'])? 0 :1;
			$core->set_config($config);			
	}
	message('done',$this_url,0);
}
