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