<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
	if(!$module->roleid_check('notice',$_roleid))showmsg_nourl($lang['RETURN_NOPRI']);

	$action=empty($action)?'manage':trim($action);
	require substr(dirname(__FILE__),0,-6).'/include/notice.class.php';
	$notice=new notice();
	switch($action)
	{
		case 'manage':
			if(isset($do_submit)) 
			{
				if($notice->notice_editorderby($orderby,$title))
				{
					showmsg($lang['RETURN_SUCEESS']);
				}
				else
				{
					showmsg($lang['RETURN_ERROR']);
				}
			}
			$result=$notice->datalist();
			include admin_tlp('manage','notice');			
			break;
		case 'add':
			if(isset($do_submit)) 
			{
				if($notice->add($info))
				{
					showmsg($lang['RETURN_SUCEESS']);
				}
				else
				{
					showmsg($lang['RETURN_ERROR']);
				}
			}
			require DIRCMS_ROOT.'/include/form.class.php';
			$form=new form();
			include admin_tlp('add','notice');			
			break;
		case 'edit':
			if(isset($do_submit)) 
			{
				if($notice->edit($info,$id))
				{
					showmsg($lang['RETURN_SUCEESS']);
				}
				else
				{
					showmsg($lang['RETURN_ERROR']);
				}
			}
			require DIRCMS_ROOT.'/include/form.class.php';
			$form=new form();
			$info=$notice->info($id);
			include admin_tlp('edit','notice');			
			break;
		case 'delete':
			if($notice->delete($id))
			{
				showmsg($lang['RETURN_SUCEESS']);
			}
			else
			{
				showmsg($lang['RETURN_ERROR']);
			}
			break;
		/*
			模板调用
		*/
		case 'tag':
			include admin_tlp('tag','notice');
			break;
	}
?>