本文整理汇总了PHP中CWebModule类的典型用法代码示例。如果您正苦于以下问题:PHP CWebModule类的具体用法?PHP CWebModule怎么用?PHP CWebModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CWebModule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: checkModuleRights
public function checkModuleRights(CWebModule $module)
{
$items = $module->getAuthItems();
if (empty($items) || Yii::app()->getUser()->checkAccess(AuthItem::ROLE_ADMIN)) {
return true;
}
foreach ($items as $task) {
if (Yii::app()->getUser()->checkAccess($task['name'])) {
return true;
}
foreach ($task['items'] as $item) {
if (Yii::app()->getUser()->checkAccess($item['name'])) {
return true;
}
}
}
return false;
}
开发者ID:alextravin,项目名称:yupe,代码行数:18,代码来源:ModuleManager.php
示例2: 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
示例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: getControllerPath
public function getControllerPath($controller = null)
{
if ($controller != null) {
return parent::getControllerPath() . DS . ucfirst($controller) . '.php';
}
return parent::getControllerPath();
}
开发者ID:bruno-melo,项目名称:components,代码行数:7,代码来源:MyModule.php
示例5: 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
示例6: init
/**
* Module constructor - Builds the initial module data
*
*
* @author vadim
*
*/
public function init()
{
// If the langauge is set then set the application
// Language appropriatly
if (isset($_GET['lang']) && in_array($_GET['lang'], array_keys(Yii::app()->params['languages']))) {
Yii::app()->setLanguage($_GET['lang']);
}
// Convert application name
Yii::app()->name = Yii::app()->settings->applicationName != '' ? Yii::app()->settings->applicationName : Yii::app()->name;
// Other settings
if (count(Yii::app()->params)) {
foreach (Yii::app()->params as $key => $value) {
// Skip the ones that does not exists
if (!Yii::app()->settings->{$key}) {
continue;
}
// Add them anyways
Yii::app()->params[$key] = Yii::app()->settings->{$key} != '' ? Yii::app()->settings->{$key} : Yii::app()->params[$key];
}
}
// Convert settings into params
if (count(Yii::app()->settings->settings)) {
foreach (Yii::app()->settings->settings as $settingKey => $settingValue) {
Yii::app()->params[$settingKey] = $settingValue;
}
}
parent::init();
}
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:35,代码来源:MasterModule.php
示例7: 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
示例8: 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
示例9: 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
示例10: __call
public function __call($name, $parameters)
{
// magic for create
if (preg_match('/^create(.+)$/', $name)) {
return $this->_instantiateByConfig($name, $parameters);
}
return parent::__call($name, $parameters);
}
开发者ID:vasiliy-pdk,项目名称:aes,代码行数:8,代码来源:PersonIdentifierModule.php
示例11: init
public function init()
{
// this method is called when the module is being created
// you may place code here to customize the module or the application
// import the module-level models and components
$this->setImport(array('integration.models.*', 'integration.components.*', 'integration.controllers.*'));
parent::init();
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:8,代码来源:IntegrationModule.php
示例12: init
public function init()
{
parent::init();
$this->setImport(array('admin.components.*', 'admin.models.*'));
Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => 'admin/site/error'), 'user' => array('allowAutoLogin' => false, 'class' => 'BWebUser')));
//$base_dir = $this->getBasePath();
//$layoutPath = $base_dir.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR.'layouts';
//$this->setLayoutPath($layoutPath);
}
开发者ID:zt123,项目名称:Base-System,代码行数:9,代码来源:AdminModule.php
示例13: init
/**
* Module constructor - Builds the initial module data
*
*
* @author vadim
*
*/
public function init()
{
// If the langauge is set then set the application
// Language appropriatly
if (isset($_GET['lang']) && in_array($_GET['lang'], array_keys(Yii::app()->params['languages']))) {
Yii::app()->setLanguage($_GET['lang']);
}
parent::init();
}
开发者ID:evan70,项目名称:yii-tracker,代码行数:16,代码来源:MasterModule.php
示例14: init
public function init()
{
parent::init();
// $this->setImport(array(
// 'application.models.*',
// 'auth.models.*',
// 'auth.components.*',
// ));
}
开发者ID:conghua1013,项目名称:yii,代码行数:9,代码来源:ApiModule.php
示例15: 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
示例16: 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
示例17: init
public function init()
{
$this->setImport(array(
'nfy.models.*',
'nfy.components.*',
'users.models.*',
));
parent::init();
}
开发者ID:Aplay,项目名称:Fastreview_site,代码行数:9,代码来源:NfyModule.php
示例18: 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
示例19: beforeControllerAction
public function beforeControllerAction($controller, $action)
{
if (parent::beforeControllerAction($controller, $action)) {
Yii::app()->getModule('cruge')->defaultSessionFilter = 'application.components.MiSesionCruge';
Yii::app()->user->loginUrl = array('/administrador/ingresar');
return true;
} else {
return false;
}
}
开发者ID:Telemedellin,项目名称:tm,代码行数:10,代码来源:AdministracionModule.php
示例20: init
public function init()
{
parent::init();
// this method is called when the module is being created
// you may place code here to customize the module or the application
Yii::app()->urlManager->urlSuffix = '';
Yii::app()->setComponents(array('errorHandler' => array('errorAction' => 'admin4/Site/error')));
// import the module-level models and components
$this->setImport(array('admin4.models.*', 'admin4.components.*', 'admin4.controllers.*'));
}
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:10,代码来源:Admin4Module.php
注:本文中的CWebModule类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论