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


PHP CWebModule::beforeControllerAction方法代碼示例

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


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

示例1: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (!Yum::hasModule('role')) {
         throw new Exception('Using the membership submodule requires the role module activated');
     }
     return parent::beforeControllerAction($controller, $action);
 }
開發者ID:bhaveshsoni,項目名稱:yii-user-management,代碼行數:7,代碼來源:MembershipModule.php

示例2: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
     // check for single role
     foreach ($roles as $role) {
         if (sizeof($roles) == 1 and $role->name == 'parent') {
             $controller->layout = 'none';
         }
         if (sizeof($roles) == 1 and $role->name == 'student') {
             $controller->layout = 'studentmain';
         }
     }
     if (Yii::app()->user->isGuest) {
         if (Yii::app()->user->loginUrl) {
             $controller->redirect($controller->createUrl(reset(Yii::app()->user->loginUrl)));
         } else {
             $controller->redirect($controller->createUrl('/'));
         }
     } else {
         if (parent::beforeControllerAction($controller, $action)) {
             // this method is called before any module controller action is performed
             // you may place customized code here
             return true;
         } else {
             return false;
         }
     }
 }
開發者ID:SoftScape,項目名稱:open-school-CE,代碼行數:28,代碼來源:MessageModule.php

示例3: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $aDevController = array('oauth', 'default', 'client', 'session', 'test', 'site');
         //not need to authenticate
         $aPublicController = array('users', 'listings');
         //two-legged
         $this->oauth_init();
         if (!in_array($controller->id, $aDevController)) {
             //                $oauth_version = $this->getParam('oauth_version');
             //                $msg = 'consumerkey'. $this->consumer_key;
             //			throw new CHttpException(401,$msg);
             //                    exit();
             if (in_array($controller->id, $aPublicController)) {
                 $this->authentication();
             } else {
                 $this->authorization();
             }
         }
         // this method is called before any module controller action is performed
         // you may place customized code here
         return true;
     } else {
         return false;
     }
 }
開發者ID:jasonhai,項目名稱:onehome,代碼行數:26,代碼來源:ApiModule.php

示例4: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         return parent::beforeControllerAction($controller, $action);
     }
     return false;
 }
開發者ID:apa-narola,項目名稱:yiimoduledemo,代碼行數:7,代碼來源:UserModule.php

示例5: beforeControllerAction

 /**
  * The pre-filter for controller actions.
  *
  * @param CController $controller the controller
  * @param CAction $action the action
  * @return boolean whether the action should be executed.
  */
 public function beforeControllerAction($controller, $action)
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->user->loginRequired();
     }
     return parent::beforeControllerAction($controller, $action);
 }
開發者ID:niranjan2m,項目名稱:Voyanga,代碼行數:14,代碼來源:AAdminModule.php

示例6: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $array = array('default', 'client');
         Yii::app()->params['api_request'] = true;
         //This is to indicate to some models its an api request(ie:a captcha not to be used in subject add form since is an api request)
         $arr_controllers = array('v1/live', 'v1/subject');
         $arr_action = array('sendcomment', 'add');
         //print_r($action);
         if (in_array($controller->id, $arr_controllers) and in_array($action->id, $arr_action) and $_REQUEST['anonymously'] != '1') {
             $this->oauth_init();
             $oauth_version = $this->getParam('oauth_version');
             //oauth 不需要驗證
             if ($controller->id != 'oauth') {
                 $this->authorization();
             }
         } else {
         }
         // this method is called before any module controller action is performed
         // you may place customized code here
         return true;
     } else {
         return false;
     }
 }
開發者ID:jjsub,項目名稱:samesub,代碼行數:25,代碼來源:ApiModule.php

示例7: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $controller->layout = 'fronlay';
         return true;
     } else {
         return false;
     }
 }
開發者ID:KaranSofat,項目名稱:yii,代碼行數:9,代碼來源:FrontModule.php

示例8: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $this->layout = 'inside_menu';
         return true;
     } else {
         return false;
     }
 }
開發者ID:asopin,項目名稱:portal,代碼行數:9,代碼來源:ManageModule.php

示例9: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $controller->attachAssets();
         return true;
     } else {
         return false;
     }
 }
開發者ID:BGCX261,項目名稱:zoomtyre-svn-to-git,代碼行數:9,代碼來源:AdminModule.php

示例10: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         // this method is called before any module controller action is performed
         // you may place customized code here
         return true;
     } else {
         return false;
     }
 }
開發者ID:wanyos2005,項目名稱:hsbf,代碼行數:10,代碼來源:IncomeModule.php

示例11: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         Yii::app()->getModule('cruge')->defaultSessionFilter = 'application.modules.usuario.components.USesionCruge';
         Yii::app()->user->loginUrl = array('/usuario');
         return true;
     } else {
         return false;
     }
 }
開發者ID:Telemedellin,項目名稱:tm,代碼行數:10,代碼來源:PuntajeModule.php

示例12: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         if (Yii::app()->user->isGuest && !($controller->getId() == 'user' && $action->getId() == 'login')) {
             $controller->redirect(array('user/login'));
         }
         return true;
     } else {
         return false;
     }
 }
開發者ID:kuldeepro,項目名稱:playwin,代碼行數:11,代碼來源:ManagerModule.php

示例13: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $controller->module_id = Modules::model()->getModuleIdByCode($this->id);
         // this method is called before any module controller action is performed
         // you may place customized code here
         return true;
     } else {
         return false;
     }
 }
開發者ID:arduanov,項目名稱:eco,代碼行數:11,代碼來源:GmapsModule.php

示例14: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         $dir = CHtml::asset(__DIR__ . '/assets');
         Yii::app()->clientScript->registerCssFile($dir . '/style.css');
         Yii::app()->clientScript->registerScriptFile($dir . '/common.js');
         return true;
     } else {
         return false;
     }
 }
開發者ID:shakyapranin,項目名稱:IMS,代碼行數:11,代碼來源:UserAdminModule.php

示例15: beforeControllerAction

 public function beforeControllerAction($controller, $action)
 {
     if (parent::beforeControllerAction($controller, $action)) {
         // this method is called before any module controller action is performed
         // you may place customized code here
         Yii::app()->errorHandler->errorAction = 'admin/default/error';
         return true;
     } else {
         return false;
     }
 }
開發者ID:angelusss,項目名稱:testWork,代碼行數:11,代碼來源:AdminModule.php


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