當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CController::__construct方法代碼示例

本文整理匯總了PHP中CController::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP CController::__construct方法的具體用法?PHP CController::__construct怎麽用?PHP CController::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CController的用法示例。


在下文中一共展示了CController::__construct方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     // если в сессии нет информации об авторизации, отравляем на страницу с оной
     if (!$this->authdata) {
         $this->redirect('/auth/');
         return;
     }
     // если текущий пользователь - руководитель, то добавим ссылку на создание новой заявки
     //if (get_param($this->authdata, 'role_id') === Configuration::$ROLE_USER) {
     if ($this->isGrantToMe('ACE_NEW')) {
         $this->data['usermenu'] .= $this->renderPartial('new-create');
         // и пункт меню для черновиков
         $this->menu = [STATUS_DRAFT => 'Черновики'] + $this->menu;
     }
     // получим количество заявок в разрезе статусов
     $udep = get_param($this->authdata, 'depid', 0);
     $states = array_column($this->model->getCounter($udep), 'cnt', 'id');
     // рендерим основное меню
     foreach ($this->menu as $index => $title) {
         $this->data['cnt'] = $states[$index] ?: '';
         //rand(1, 15);
         $this->data['title'] = $title;
         $this->data['type'] = $index;
         // статус заявок (для фильтрации)
         $this->data['usermenu'] .= $this->renderPartial('menu-item');
     }
     $this->scripts[] = 'contents';
 }
開發者ID:matyukhin-maxim,項目名稱:ticket-db,代碼行數:29,代碼來源:ContentsController.php

示例2: __construct

 /**
  *構造方法獲取公共的變量參數
  *
  */
 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module);
     /**
      * 該段代碼用於獲取後台的設置信息,
      * 並將獲得的信息緩存&讀取到公共的Settings變量中.
      */
     $this->Settings = Yii::app()->cache->get('Settings');
     if (!$this->Settings) {
         $Info = Settings::model()->findAllBySql("SELECT * FROM {{settings}}");
         $ArraySettings = array();
         foreach ($Info as $key) {
             $ArraySettings[$key->key] = $key->value;
         }
         $this->Settings = (object) $ArraySettings;
         Yii::app()->cache->set('Settings', $this->Settings, 10);
     }
     /**
      *  如果用戶登錄了
      *  該段代碼調用了經過權限處理後的操作模塊,
      *  否則跳轉回登錄頁
      */
     if (Yii::app()->session->get('IsLogin') || $this->getId('login')) {
         $this->roleAction = $this->actionMeun();
     } else {
         $Url = $this->createUrl('admin/Login/Login');
         $this->redirect($Url);
     }
 }
開發者ID:xuyi5918,項目名稱:ipensoft,代碼行數:33,代碼來源:Controller.php

示例3: __construct

 public function __construct($id = null, $module = null)
 {
     if (!Yii::app()->my->logged) {
         $this->redirect(array('auth/index'));
     }
     parent::__construct($id, $module = null);
 }
開發者ID:Kapodastr,項目名稱:grow,代碼行數:7,代碼來源:Controller.php

示例4: __construct

 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module);
     // If there is a post-request, redirect the application to the provided url of the selected language
     if (isset($_POST['language'])) {
         $lang = $_POST['language'];
         $MultilangReturnUrl = $_POST[$lang];
         $this->redirect($MultilangReturnUrl);
     }
     // Set the application language if provided by GET, session or cookie
     if (isset($_GET['language'])) {
         Yii::app()->language = $_GET['language'];
         Yii::app()->user->setState('language', $_GET['language']);
         $cookie = new CHttpCookie('language', $_GET['language']);
         $cookie->expire = time() + 60 * 60 * 24 * 365;
         // (1 year)
         Yii::app()->request->cookies['language'] = $cookie;
     } else {
         if (Yii::app()->user->hasState('language')) {
             Yii::app()->language = Yii::app()->user->getState('language');
         } else {
             if (isset(Yii::app()->request->cookies['language'])) {
                 Yii::app()->language = Yii::app()->request->cookies['language']->value;
             }
         }
     }
 }
開發者ID:basketbob,項目名稱:timeman,代碼行數:27,代碼來源:Controller.php

示例5: __construct

 public function __construct()
 {
     parent::__construct();
     $this->_user = new User();
     $this->_user->stateKeyPrefix = base64_encode('_microHR_adminKey');
     $this->_init();
 }
開發者ID:shreksrg,項目名稱:microHR,代碼行數:7,代碼來源:AdminController.php

示例6: __construct

 public function __construct($id, $module)
 {
     parent::__construct($id, $module);
     // set current lang from cookie
     if (isset(Yii::app()->request->cookies['language'])) {
         Yii::app()->setLanguage(Yii::app()->request->cookies['language']->value);
     }
 }
開發者ID:andrelinoge,項目名稱:rezydent,代碼行數:8,代碼來源:Controller.php

示例7:

 function __construct()
 {
     parent::__construct();
     $this->model(array("news_model", "rubrics_model", "photo_model"));
     $this->library(array('form', 'table'));
     $this->method = 'index';
     $this->ctrler = 'json';
 }
開發者ID:cyberorca,項目名稱:dfp-api,代碼行數:8,代碼來源:json.php

示例8: Upload

 function __construct()
 {
     parent::__construct();
     $this->library(array('form', 'table'));
     $this->upload = new Upload();
     $this->temp_imgDir = $this->config['klimg_dir'] . 'tmp/' . url_title($_SESSION['usr_fullname']) . '/';
     $this->target_imgDir = $this->config['klimg_dir'] . 'real/2013/09/';
 }
開發者ID:cyberorca,項目名稱:dfp-api,代碼行數:8,代碼來源:conditional_crop_image.php

示例9: __construct

 public function __construct()
 {
     parent::__construct();
     if (!$this->authdata) {
         $this->redirect('/auth/');
         return;
     }
 }
開發者ID:matyukhin-maxim,項目名稱:ticket-db,代碼行數:8,代碼來源:TicketController.php

示例10:

 function __construct()
 {
     parent::__construct();
     $this->model(array("menu_model"));
     $this->library(array('form'));
     $this->method = 'index';
     $this->ctrler = 'menu-config';
 }
開發者ID:cyberorca,項目名稱:dfp-api,代碼行數:8,代碼來源:s_menu.php

示例11:

 function __construct()
 {
     parent::__construct();
     $this->model(array('rubrics_model'));
     $this->library(array('form', 'table'));
     $this->ctrler = 'column';
     //$this->method_by_url = $this->config['method_by_url');
 }
開發者ID:cyberorca,項目名稱:dfp-api,代碼行數:8,代碼來源:column.php

示例12: array

 function __construct()
 {
     parent::__construct();
     $this->model(array("news_model", "rubrics_model", "photo_model", "jsview_model", "user_model", "fbinfo_model"));
     $this->library(array('form', 'table'));
     $this->ctrler = 'page-view';
     $this->search = array('id' => $this->uri->get('id') ? $this->uri->get('id') : false, 'title' => $this->uri->get('title') ? $this->uri->get('title') : false, 'dateFrom' => $this->uri->get('dateFrom') ? $this->uri->get('dateFrom') : '', 'dateTo' => $this->uri->get('dateTo') ? $this->uri->get('dateTo') : '', 'category' => $this->uri->get('category') ? $this->uri->get('category') : '', 'type' => $this->uri->get('type') ? $this->uri->get('type') : 'all', 'rep' => $this->uri->get('rep') ? $this->uri->get('rep') : '');
     $this->page = $this->uri->get('page') ? $this->uri->get('page') : 1;
 }
開發者ID:cyberorca,項目名稱:dfp-api,代碼行數:9,代碼來源:page_view.php

示例13: array

 function __construct()
 {
     parent::__construct();
     $this->model(array('import_model'));
     $this->library(array('form', 'table'));
     $this->method = 'index';
     $this->ctrler = 'json';
     $this->date_columns = array('created_at' => 0, 'updated_at' => 0, 'news_entry' => 0, 'news_date_publish' => 0, 'phone_announced' => 0);
 }
開發者ID:cyberorca,項目名稱:dfp-api,代碼行數:9,代碼來源:import.php

示例14:

 function __construct()
 {
     parent::__construct();
     $this->model(array("news_model", "rubrics_model", "img_conf_model", "photo_model", "news_rubric_model", "news_keywords_model", "tag_news_model", "photonews_model", "keywords_model", "quote_model", "tags_model", "domain_users_model", "user_model", "news_paging_model", "temp_img_model"));
     $old_cat = file_get_contents($this->config['json_dir'] . "old_categori.json");
     $arr_cat_old = json_decode($old_cat, true);
     //echoPre($arr_cat_old);
     $this->arr_Categori_old = $arr_cat_old;
 }
開發者ID:cyberorca,項目名稱:dfp-api,代碼行數:9,代碼來源:mapping.php

示例15: __construct

 public function __construct($id, $module = null)
 {
     parent::__construct($id, $module = null);
     if (Yii::app()->user->isGuest) {
         $this->redirect(array('site/login'));
     } else {
         $userInfo = UserModel::model()->find('username=:username', array(':username' => Yii::app()->user->name));
         Yii::app()->session['userInfo'] = array('uid' => $userInfo->uid, 'username' => $userInfo->username, 'nickname' => $userInfo->nickname, 'group_id' => $userInfo->group_id);
     }
 }
開發者ID:00606,項目名稱:wechat,代碼行數:10,代碼來源:Controller.php


注:本文中的CController::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。