<?php
 /**
 *      [XCECP] (C) COLNET Inc.
 *      This is NOT a freeware, use is subject to license terms
 */
if(!defined("IN_QKWEB")){exit("Access Denied");}
class EventAdmin{
	function index(){
		load_class("event");$em = new EventModel();
		$act = getgpc("act","P");$id = getgpc("id","P");$inajax=getgpc('inajax','P');
		if($inajax==1){
			$ret = array('success'=>false,'message'=>'参数错误');
			if(($act=="edit" && $id && settype($id,"integer")) || $act=="add"){
				$ret['success']=$em->$act($_POST);
			}else if($act=='del' && $id && is_numeric($id)){
				$ret['success']=$em->del($id);
			}
			if($em->msg){ $ret['message']=$em->msg; }
			echo json_encode($ret);exit;
		}
		$act=getgpc('act');
		$id=getgpc('id');
		if($act=='edit' && $id && settype($id,"integer")){
			$eventInfo=$em->getInfo($id);assign('eventInfo',$eventInfo);
		}
		display("event");
	}
	function goods(){
		load_class("event");
		$em = new EventModel();
		$inajax = getgpc("inajax","P");
		$act = getgpc("act","P");
		$id = getgpc("id","P");
		if($inajax==1){
			$ret = array('success'=>false,'message'=>'参数错误');
			if(($act=="edit" && $id && settype($id,"integer")) || $act=="add"){
				$act= $act."Goods";
				$ret['success']=$em->$act($_POST);
			}else if($act=='del' && $id && is_numeric($id)){
				$ret['success']=$em->delGoods($id);
			}
			if($em->msg){ $ret['message']=$em->msg; }
			echo json_encode($ret);exit;
		}
		$id = getgpc("id");
		if($id && settype($id,"integer")){
			$eventGoodsInfo = $em->getGoodsInfo($id);
			assign("eventGoodsInfo",$eventGoodsInfo);
		}
		assign("msg",$msg);
		display("event/goods");
	}
}
?>