本文整理汇总了PHP中CWebModule::init方法的典型用法代码示例。如果您正苦于以下问题:PHP CWebModule::init方法的具体用法?PHP CWebModule::init怎么用?PHP CWebModule::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWebModule
的用法示例。
在下文中一共展示了CWebModule::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
Controller::initParams();
// this method is called when the module is being created
// you may place code here to customize the module or the application
Yii::app()->setComponent('bootstrap', array('class' => 'ext.bootstrap.components.Bootstrap', 'responsiveCss' => true));
Yii::setPathOfAlias('bootstrap', dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../extensions/bootstrap');
Yii::app()->bootstrap->init();
// import the module-level models and components
$this->setImport(array('admin.models.*', 'admin.components.*'));
Yii::app()->setComponents(array('user' => array('class' => 'AdminUser', 'loginUrl' => Yii::app()->createAbsoluteUrl('admin/login'), 'allowAutoLogin' => true)), true);
$this->layout = 'application.modules.admin.views.layouts.column1';
if (Yii::app()->params['STORE_OFFLINE'] == '-1') {
die('Admin Panel unavailable due to account suspension.');
}
if (isset($_POST['url']) && isset($_POST['password'])) {
$model = new LoginForm();
if ($model->loginLightspeed($_POST['user'], $_POST['password'])) {
Yii::app()->getRequest()->redirect(Yii::app()->createUrl("/admin"));
} else {
die("You have an invalid password set in your eCommerce options. Cannot continue.");
}
}
if (!Yii::app()->user->isGuest) {
if (Yii::app()->user->shouldLogOut()) {
Yii::app()->user->logout(false);
}
}
_xls_set_conf('ADMIN_PANEL', date("Y-m-d H:i:s"));
parent::init();
}
示例2: init
/**
* Initializes the admin module.
*/
public function init()
{
parent::init();
Yii::setPathOfAlias('admin', dirname(__FILE__));
Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => $this->getId() . '/default/error'), 'user' => array('class' => 'WebUser', 'stateKeyPrefix' => 'admin', 'loginUrl' => Yii::app()->createUrl($this->getId() . '/default/login')), 'widgetFactory' => array('class' => 'CWidgetFactory', 'widgets' => array())), false);
$this->setImport(array('admin.models.*', 'admin.components.*'));
}
示例3: init
public function init()
{
parent::init();
Yii::app()->setComponents(array('errorHandler' => array('class' => 'CErrorHandler', 'errorAction' => 'siteadmin/default/error'), 'user' => array('class' => 'BackendUser', 'stateKeyPrefix' => 'siteadmin2', 'loginUrl' => Yii::app()->createUrl('siteadmin/default/login'), 'allowAutoLogin' => true, 'sitePart' => 'siteadmin')), false);
Yii::app()->user->setReturnUrl(Yii::app()->createUrl('siteadmin'));
Yii::app()->user->allowAutoLogin = true;
}
示例4: init
public function init()
{
parent::init();
$moduleId = $this->getId();
$this->setImport(array($moduleId . '.components.*', $moduleId . '.models.*', $moduleId . '.widgets.*'));
$this->checkDependencies();
}
示例5: 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();
}
示例6: 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
parent::init();
}
示例7: init
public function init()
{
parent::init();
//module specific classes
$this->setImport(array('admin.models.*', 'admin.models.forms.*', 'admin.components.*'));
//module based componets
$this->setComponents(array('user' => array('class' => 'CWebUser', 'loginUrl' => Yii::app()->createUrl('auth/login'), 'allowAutoLogin' => true, 'autoRenewCookie' => true, 'authTimeout' => 31557600, 'returnUrl' => Yii::app()->createUrl(self::MODULE_KEY . '/default/index'))));
}
示例8: init
function init()
{
$this->wtermOptions = array_merge($this->defaultWtermOptions, $this->wtermOptions);
if ($this->useYiic) {
$this->registerCommand('yiic', array('yiic'), 'Allows to run <strong>yiic</strong> commands.');
}
parent::init();
}
示例9: 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();
}
示例10: 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()->setComponents(array('errorHandler' => array('errorAction' => 'public/publicSite/page/view/notFound')));
// import the module-level models and components
$this->setImport(array('public.models.*', 'public.components.*'));
}
示例11: init
public function init()
{
$this->setImport(array(
'nfy.models.*',
'nfy.components.*',
'users.models.*',
));
parent::init();
}
示例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);
}
示例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();
}
示例14: 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.*'));
}
示例15: init
public function init()
{
// Load modules
$modules = CmsModulereg::model()->findAll();
$modulesConfig = array();
foreach ($modules as $module) {
$modulesConfig[] = $module->name;
$this->setImport(array('cms.modules.' . $module->name . '.*'));
}
$this->setModules($modulesConfig);
$this->setImport(array('cms.models.*', 'cms.components.*', 'cms.widgets.*'));
parent::init();
}