Invitation.class.php 2.28 KB
<?php
class Controller_Admin_Invitation extends Controller_Admin_Base
{
	public function indexAction()
	{
        $type = $this->_request->query('type', 1);
        $data = Facade_Invitation::getByType($type);
        foreach ($data as $k=>$row){
            $row['category'] = Config_Admin_Var::$invitation_category[$row['category']];
            $row['sub'] = Config_Admin_Var::$invitation_sub[$row['sub']];
            $data[$k] = $row;
        }
        
        $this->_view['type'] = $type;
		$this->_view['data'] = $data;
	}
	
    /**
     * 提交
     */
    public function submitAction()
    {
        $type = $this->_request->query('type',1);
        $category = $this->_request->query('category', '');
        $sub = $this->_request->query('sub', 0);
        $name = $this->_request->query('name','');
        $contacter = $this->_request->query('contacter','');
        $phone = $this->_request->query('phone', '');
        $email = $this->_request->query('email', '');
        
        $ret = false;
        if($type && $category && $sub && $name && $contacter && $phone && $email)
        {
            $ret = Facade_Invitation::add($type, $category, $sub, $name, $contacter, $phone, $email);
        }
        if($ret)
        {
            return $this->returnJson(true,200,null);
        }
        else
        {
            return $this->returnJson(false,404,null,'新增失败');
        }
    }
    
    /**
     * 控制是否显示在申请列表中
     */
    public function showinapplyAction()
    {
        $id = $this->_request->query('id',0);
        $status = $this->_request->query('status',0);
        $ret = Facade_Invitation::showInApplyList($id, $status);
        if($ret)
        {
            return $this->returnJson(true,200,null);
        }
        else
        {
            return $this->returnJson(false,404,null);
        }
    }
    
    /**
     * 控制是否显示在通过列表中
     */
    public function showinpassAction()
    {
        $id = $this->_request->query('id',0);
        $status = $this->_request->query('status',0);
        $ret = Facade_Invitation::showInPassList($id, $status);
        if($ret)
        {
            return $this->returnJson(true,200,null);
        }
        else
        {
            return $this->returnJson(false,404,null);
        }
    }
}