public function init() { $this->pageSize = \Yii::$app->admin->pageSize; $this->pageParamName = \Yii::$app->admin->pageParamName; $this->enabledPjaxPagination = \Yii::$app->admin->enabledPjaxPagination; parent::init(); }
public function init() { if (!$this->messageSuccessBeforeApproval) { $this->messageSuccessBeforeApproval = \Yii::t('skeeks/reviews2', 'Review successfully added, and will be published at the site after being moderated.'); } if (!$this->messageSuccess) { $this->messageSuccess = \Yii::t('skeeks/reviews2', 'Reviewed added successfully, thank you.'); } parent::init(); }
public function init() { parent::init(); \Yii::$app->on(AdminController::EVENT_INIT, function (AdminInitEvent $e) { if ($e->controller instanceof AdminCmsContentElementController || $e->controller instanceof \skeeks\cms\shop\controllers\AdminCmsContentElementController) { /** * @var $model CmsContentElement */ $model = $e->controller->model; if ($model->content_id) { if (ShopContent::find()->where(['content_id' => $model->content_id])->exists()) { $e->controller->eventActions = ArrayHelper::merge($e->controller->eventActions, ['shop' => ['class' => AdminContentElementShopAction::className(), 'name' => 'Цены и наличие (Магазин)', 'priority' => 1000, "icon" => "glyphicon glyphicon-shopping-cart"]]); } } } }); }
public function init() { parent::init(); \Yii::$app->view->on(View::EVENT_AFTER_RENDER, function (ViewEvent $e) { if (\Yii::$app->controller instanceof AdminController) { return false; } if (\Yii::$app->cmsToolbar->editViewFiles == Cms::BOOL_Y && \Yii::$app->cmsToolbar->enabled && \Yii::$app->user->can(CmsManager::PERMISSION_EDIT_VIEW_FILES)) { $id = "sx-view-render-md5" . md5($e->viewFile); if (in_array($id, $this->viewFiles)) { return; } $this->viewFiles[$id] = $id; $e->sender->registerJs(<<<JS new sx.classes.toolbar.EditViewBlock({'id' : '{$id}'}); JS ); $e->output = Html::tag('div', $e->output, ['class' => 'skeeks-cms-toolbar-edit-view-block', 'id' => $id, 'title' => "Двойной клик по блоку откроек окно управлния настройками", 'data' => ['id' => $id, 'config-url' => UrlHelper::construct(['/cms/admin-tools/view-file-edit', "root-file" => $e->viewFile])->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')->toString()]]); } }); }
public function init() { parent::init(); //Название проекта. if (!$this->appName) { $this->appName = \Yii::$app->name; } else { \Yii::$app->name = $this->appName; } //Язык if ($this->languageCode) { \Yii::$app->language = $this->languageCode; } else { $this->languageCode = \Yii::$app->language; } if (\Yii::$app instanceof Application) { } else { $this->relatedHandlers = ArrayHelper::merge([PropertyTypeText::className() => ['class' => PropertyTypeText::className()], PropertyTypeNumber::className() => ['class' => PropertyTypeNumber::className()], PropertyTypeList::className() => ['class' => PropertyTypeList::className()], PropertyTypeFile::className() => ['class' => PropertyTypeFile::className()], PropertyTypeTree::className() => ['class' => PropertyTypeTree::className()], PropertyTypeElement::className() => ['class' => PropertyTypeElement::className()], UserPropertyTypeDate::className() => ['class' => UserPropertyTypeDate::className()], UserPropertyTypeComboText::className() => ['class' => UserPropertyTypeComboText::className()], UserPropertyTypeColor::className() => ['class' => UserPropertyTypeColor::className()], UserPropertyTypeSelectFile::className() => ['class' => UserPropertyTypeSelectFile::className()]], $this->relatedHandlers); //web init if (!$this->noImageUrl) { $this->noImageUrl = CmsAsset::getAssetUrl('img/image-not-found.jpg'); } \Yii::$app->view->on(View::EVENT_BEGIN_PAGE, function (Event $e) { if (!\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) { \Yii::$app->response->getHeaders()->setDefault('X-Powered-CMS', $this->descriptor->name . " {$this->descriptor->homepage}"); /** * @var $view View */ $view = $e->sender; if (!isset($view->metaTags[self::$_huck])) { $view->registerMetaTag(["name" => base64_decode(self::$_huck), "content" => $this->descriptor->name . " — {$this->descriptor->homepage}"], self::$_huck); } if (!isset($view->metaTags['cmsmagazine'])) { $view->registerMetaTag(["name" => 'cmsmagazine', "content" => "7170fe3a42c6f80cd95fd8bce765333d"], 'cmsmagazine'); } } }); \Yii::$app->user->on(\yii\web\User::EVENT_AFTER_LOGIN, function (UserEvent $e) { $e->identity->logged_at = \Yii::$app->formatter->asTimestamp(time()); $e->identity->save(false); if (\Yii::$app->admin->requestIsAdmin) { \Yii::$app->user->identity->updateLastAdminActivity(); } }); } }
public function init() { parent::init(); \Yii::$app->language = $this->languageCode; }
public function init() { parent::init(); //Название проекта. if (!$this->appName) { $this->appName = \Yii::$app->name; } else { \Yii::$app->name = $this->appName; } //Генерация файла с подключением настроек extensions если его нет if (!file_exists(AUTO_GENERATED_MODULES_FILE)) { $this->generateModulesConfigFile(); } //init view theme $this->templates = ArrayHelper::merge($this->templatesDefault, (array) $this->templates); foreach ($this->templates as $code => $templateData) { if ($code == $this->template) { if ($pathMap = ArrayHelper::getValue($templateData, 'pathMap')) { if (is_array($pathMap)) { \Yii::$app->view->theme = new Theme(['pathMap' => $pathMap]); } } } } //TODO: may be is depricated. While better to use '@app/views/' \Yii::setAlias('template', '@app/views/'); $this->emailTemplates = ArrayHelper::merge($this->emailTemplatesDefault, (array) $this->emailTemplates); \Yii::$app->language = $this->languageCode; //Отлов событий отправки сообщений с сайта, и их модификация. \yii\base\Event::on(\yii\mail\BaseMailer::className(), \yii\mail\BaseMailer::EVENT_BEFORE_SEND, [$this, 'beforeSendEmail']); if (\Yii::$app instanceof Application) { //console init $this->_initConsole(); } else { //web init $this->_initWeb(); } }
public function init() { parent::init(); if (!$this->enableKeywordsGenerator) { return $this; } /** * Генерация SEO метатегов. * */ \Yii::$app->view->on(View::EVENT_END_PAGE, function (Event $e) { if (!\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) { $this->generateBeforeOutputPage($e->sender); } }); }