當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。