本文整理汇总了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';
}
示例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);
}
}
示例3: __construct
public function __construct($id = null, $module = null)
{
if (!Yii::app()->my->logged) {
$this->redirect(array('auth/index'));
}
parent::__construct($id, $module = null);
}
示例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;
}
}
}
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->_user = new User();
$this->_user->stateKeyPrefix = base64_encode('_microHR_adminKey');
$this->_init();
}
示例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);
}
}
示例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';
}
示例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/';
}
示例9: __construct
public function __construct()
{
parent::__construct();
if (!$this->authdata) {
$this->redirect('/auth/');
return;
}
}
示例10:
function __construct()
{
parent::__construct();
$this->model(array("menu_model"));
$this->library(array('form'));
$this->method = 'index';
$this->ctrler = 'menu-config';
}
示例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');
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}