本文整理汇总了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);
}
示例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;
}
}
}
示例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;
}
}
示例4: beforeControllerAction
public function beforeControllerAction($controller, $action)
{
if (parent::beforeControllerAction($controller, $action)) {
return parent::beforeControllerAction($controller, $action);
}
return false;
}
示例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);
}
示例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;
}
}
示例7: beforeControllerAction
public function beforeControllerAction($controller, $action)
{
if (parent::beforeControllerAction($controller, $action)) {
$controller->layout = 'fronlay';
return true;
} else {
return false;
}
}
示例8: beforeControllerAction
public function beforeControllerAction($controller, $action)
{
if (parent::beforeControllerAction($controller, $action)) {
$this->layout = 'inside_menu';
return true;
} else {
return false;
}
}
示例9: beforeControllerAction
public function beforeControllerAction($controller, $action)
{
if (parent::beforeControllerAction($controller, $action)) {
$controller->attachAssets();
return true;
} else {
return false;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}