当前位置: 首页>>代码示例>>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;未经允许,请勿转载。