当前位置: 首页>>代码示例>>PHP>>正文


PHP CController::init方法代码示例

本文整理汇总了PHP中CController::init方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::init方法的具体用法?PHP CController::init怎么用?PHP CController::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CController的用法示例。


在下文中一共展示了CController::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     $uri = Yii::app()->request->requestUri;
     if (strpos($uri, 'favicon') !== false || strpos($uri, 'robots') !== false) {
         Yii::app()->end();
     }
     parent::init();
     $this->view = Yii::app()->getViewRenderer();
     $reqUri = Yii::app()->getRequest()->getRequestUri();
     if (strpos($reqUri, '?') !== false) {
         $reqUri = substr($reqUri, 0, strpos($reqUri, '?'));
     }
     $this->view->currentURI = $reqUri;
     $this->view->currentCaption = $this->getCurrentCaption($reqUri);
     $fscname = null;
     //
     if (Yii::app()->user->getId() !== null) {
         $fscname = Yii::app()->user->fscname;
         $this->view->sitemedia = array('uri' => Yii::app()->params['mediauri'], 'jssuffix' => Yii::app()->params['mediasuffix']);
     }
     if ($fscname) {
         $this->view->userinfo = array('fscname' => $fscname);
         $this->renderMenu();
     }
 }
开发者ID:rmaldonado,项目名称:my-monitor-admin2,代码行数:25,代码来源:LoomController.php

示例2: init

    public function init()
    {
        $this->baseUrl = Y::config('baseUrl');
        Yii::app()->language = isset($_GET['lang']) ? $_GET['lang'] : "ru";

        parent::init();
    }
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:7,代码来源:Controller.php

示例3: init

 public function init()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect(Yii::app()->createUrl('auth/login'));
     }
     return parent::init();
 }
开发者ID:chovajsa,项目名称:dasch,代码行数:7,代码来源:Controller.php

示例4: init

 public function init()
 {
     parent::init();
     if (!Ibos::app()->user->isGuest && Ibos::app()->user->isNeedReset && !Ibos::app()->request->isAjaxRequest) {
         Ibos::app()->request->redirect(Ibos::app()->createUrl("user/default/reset"));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:7,代码来源:ICController.php

示例5: init

 public function init()
 {
     if (Yii::app()->user->id) {
         Yii::app()->theme = Yii::app()->user->theme;
     }
     parent::init();
 }
开发者ID:VishalSuriMcc,项目名称:jaspersiform,代码行数:7,代码来源:Controller.php

示例6: init

 public function init()
 {
     // enable the KCFINDER uploads
     $KCFINDER = array('disabled' => false, 'uploadURL' => Yii::app()->baseUrl . "/uploads/", 'uploadDir' => Yii::app()->basePath . "/../uploads/");
     Yii::app()->session['KCFINDER'] = $KCFINDER;
     parent::init();
 }
开发者ID:phantsang,项目名称:xzsUuJg0keDWW5Rx679PHBVBJ,代码行数:7,代码来源:Controller.php

示例7: init

 /**
  * @inheritDoc
  */
 public function init()
 {
     parent::init();
     if ($this->layout === null) {
         $this->layout = $this->module->defaultLayout;
     }
 }
开发者ID:azamath,项目名称:yii-account,代码行数:10,代码来源:Controller.php

示例8: init

 public function init()
 {
     if ($layout = $this->getModule()->adminLayout) {
         $this->layout = $layout;
     }
     parent::init();
 }
开发者ID:pavlm,项目名称:ycomments,代码行数:7,代码来源:AdminController.php

示例9: init

 public function init()
 {
     parent::init();
     Yii::import('ext.ThemePicker.EThemePicker');
     EThemePicker::setTheme();
     Yii::app()->params['title'] = Yii::app()->name;
     $controller = Yii::app()->controller;
     if (!file_exists('install_lock.txt')) {
         if (!$controller instanceof InstallController) {
             $this->redirect('install/install');
         }
     }
     if (isset($_GET['lang']) && $_GET['lang'] != "") {
         //當點擊轉換語言時
         Yii::app()->user->setState("language", $_GET['lang']);
         //相當於與設置一個cookie
         Yii::app()->language = Yii::app()->user->getState("language");
         //轉換成相應的記錄語言
     }
     if (Yii::app()->user->getState("language")) {
         //如果設置了有session記錄
         Yii::app()->language = Yii::app()->user->getState("language");
         //轉換成相應的記錄語言
     } else {
         Yii::app()->user->setState("language", "en_us");
         //沒有session則設置一個session.默認語言為en_us
         Yii::app()->language = Yii::app()->user->getState("language");
         //轉換成相應的記錄語言
     }
 }
开发者ID:lhfcainiao,项目名称:basic,代码行数:30,代码来源:YController.php

示例10: init

 public function init()
 {
     parent::init();
     if (empty($this->modelName)) {
         throw new CException("You should set modelName before using JsonApiController.");
     }
 }
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:7,代码来源:JsonApiController.php

示例11: init

 function init()
 {
     // MFM CController
     parent::init();
     $app = Yii::app();
     if (isset($_POST['_lang'])) {
         $app->language = $_POST['_lang'];
         $app->session['_lang'] = $app->language;
     } else {
         if (isset($app->session['_lang'])) {
             $app->language = $app->session['_lang'];
         }
     }
     //-----------------------------
     if (!Yii::app()->user->isGuest) {
         $identity = new UserIdentity(Yii::app()->user->username, Yii::app()->user->password);
         $identity->authenticate(false);
         if ($identity->errorCode != ERROR_NONE) {
             Yii::app()->user->logout();
             Yii::app()->user->setState('status', User::STATUS_GUEST);
             $this->redirect(Yii::app()->homeUrl);
         }
     } else {
         Yii::app()->user->setState('status', User::STATUS_GUEST);
     }
 }
开发者ID:smoothcoder,项目名称:DISCARDEDYiiblog,代码行数:26,代码来源:BaseController.php

示例12: init

 public function init()
 {
     if ($this->_mustHaveRec && !isset($this->actionParams['rec'])) {
         throw new CHttpException(403);
     }
     parent::init();
 }
开发者ID:eneelkant,项目名称:oprecx-project,代码行数:7,代码来源:AdminController.php

示例13: init

 /**
  * Инициализация контроллера
  */
 public function init($action)
 {
     parent::init();
     $this->uid = get_uid(false);
     $this->is_adm = hasPermissions('projects', $this->uid);
     $this->layout = '//layouts/content-with-right-narrow-sidebar';
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:10,代码来源:GuestController.php

示例14: init

 function init()
 {
     parent::init();
     ClassSession::savedSessionId();
     /// just to be SURE it is set
     Yii::app()->setTimeZone(Yii::app()->params['timezone']);
 }
开发者ID:kenrestivo,项目名称:ossasep,代码行数:7,代码来源:Controller.php

示例15: init

 public function init()
 {
     parent::init();
     if (Yii::app()->request->getIsAjaxRequest()) {
         $this->layout = '//layouts/clear';
     }
 }
开发者ID:upmunspel,项目名称:abiturient,代码行数:7,代码来源:Controller.php


注:本文中的CController::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。