_initialize() public method

模块初始化,获取当前用户管理的应用
public _initialize ( )
コード例 #1
0
 protected function _initialize()
 {
     parent::_initialize();
     $this->rest_id = $_SESSION['manage_dine_branch'];
     if (!empty($this->rest_id)) {
         $sql = "select rl.name, rl.id from  tp_dine_restlist as rl  where rl.status = 1 AND rl.token='{$this->token}' and rl.id={$this->rest_id};";
         $Model = new Model();
         $rest = $Model->query($sql);
         if ($rest != false) {
             $this->rest_id = $rest[0]['id'];
             $this->assign('branch_name', $rest[0]['name']);
             $this->branch_name = $rest[0]['name'];
         } else {
             exit;
         }
     } else {
         $sql = "select rl.name, rl.id from  tp_dine_restlist as rl  where rl.status = 1 AND rl.token='{$this->token}' LIMIT 1;";
         $Model = new Model();
         $rest = $Model->query($sql);
         if ($rest != false) {
             $this->rest_id = $rest[0]['id'];
             $this->assign('branch_name', $rest[0]['name']);
         } else {
             exit;
         }
     }
     $user_agent = $_SERVER['HTTP_USER_AGENT'];
     if (ereg('Mozilla', $user_agent) && ereg('MSIE', $user_agent)) {
         $this->assign('is_ie', 1);
     } else {
         $this->assign('is_ie', 0);
     }
 }
コード例 #2
0
 protected function _initialize()
 {
     parent::_initialize();
     $hotel = M('Hotel')->where(array('token' => $this->token, 'id' => $_SESSION['manage_hotel_branch']))->find();
     if ($hotel != false) {
         $this->hotel_id = $hotel['id'];
         $this->assign('merchant_name', $hotel['name']);
     }
     /*else
       {
           Log::save();
           exit;
       }*/
 }
コード例 #3
0
 protected function _initialize()
 {
     parent::_initialize();
     $shop_where = array('token' => $this->token);
     $this->branch_id = $_SESSION['manage_shop_branch'];
     if (!empty($this->branch_id)) {
         $shop_where['fake_id'] = $this->branch_id;
     }
     $shop_where['status'] = '1';
     $shop = M('b2c_shop')->where($shop_where)->find();
     if ($shop != false) {
         $this->branch_id = $shop['fake_id'];
         $this->assign('merchant_name', $shop['name']);
     }
     /*else
       {
           Log::save();
           exit;
       }*/
 }
コード例 #4
0
 protected function _initialize()
 {
     parent::_initialize();
 }