Esempio n. 1
0
 /**
  * @return $this
  */
 public function initStandartMetaData()
 {
     parent::initStandartMetaData();
     $model = $this->model;
     if (!$model->meta_title && $model->cmsContent->meta_title_template) {
         //TODO: Реализовать
         $content = str_replace("{=model.name}", $model->name, $model->cmsContent->meta_title_template);
         $this->controller->getView()->title = $content;
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * Renders mini-toolbar at the end of page body.
  *
  * @param \yii\base\Event $event
  */
 public function renderToolbar($event)
 {
     $this->initEnabled();
     if (!$this->enabled) {
         return;
     }
     $editModel = null;
     $urlEditModel = "";
     $urlUserEdit = UrlHelper::construct('cms/admin-profile/update')->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true');
     if (is_subclass_of(\Yii::$app->controller->action, ViewModelAction::className())) {
         if ($editModel = \Yii::$app->controller->action->model) {
             $adminControllerRoute = '';
             if ($editModel instanceof CmsContentElement) {
                 $controller = \Yii::$app->createController('cms/admin-cms-content-element')[0];
                 $adminControllerRoute = ['cms/admin-cms-content-element/update', $controller->requestPkParamName => $editModel->{$controller->modelPkAttribute}, 'content_id' => $editModel->cmsContent->id];
                 $urlEditModel = UrlHelper::construct($adminControllerRoute)->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true');
             } else {
                 if ($editModel instanceof \skeeks\cms\models\Tree) {
                     $controller = \Yii::$app->createController('cms/admin-tree')[0];
                     $adminControllerRoute = ['cms/admin-tree/update', $controller->requestPkParamName => $editModel->{$controller->modelPkAttribute}];
                     $urlEditModel = UrlHelper::construct($adminControllerRoute)->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true');
                 } else {
                     if ($editModel instanceof User) {
                         $controller = \Yii::$app->createController('cms/admin-user')[0];
                         $adminControllerRoute = ['cms/admin-user/update', $controller->requestPkParamName => $editModel->{$controller->modelPkAttribute}];
                         $urlEditModel = UrlHelper::construct($adminControllerRoute)->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true');
                     }
                 }
             }
         }
     }
     $clientOptions = ['infoblockSettings' => ['border' => ['color' => $this->infoblockEditBorderColor]], 'container-id' => 'skeeks-cms-toolbar', 'container-min-id' => 'skeeks-cms-toolbar-min', 'isOpen' => (bool) ($this->isOpen == Cms::BOOL_Y), 'backend-url-triggerEditWidgets' => UrlHelper::construct('cms/toolbar/trigger-edit-widgets')->toString(), 'backend-url-triggerEditViewFiles' => UrlHelper::construct('cms/toolbar/trigger-edit-view-files')->toString(), 'backend-url-triggerIsOpen' => UrlHelper::construct('cms/toolbar/trigger-is-open')->toString()];
     //echo '<div id="skeeks-cms-toolbar" style="display:none"></div>';
     /* @var $view View */
     $view = $event->sender;
     CmsToolbarAsset::register($view);
     if ($this->enableFancyboxWindow) {
         CmsToolbarFancyboxAsset::register($view);
     }
     echo $view->render('@skeeks/cms/views/cms-toolbar', ['clientOptions' => $clientOptions, 'urlEditModel' => $urlEditModel, 'editModel' => $editModel, 'urlUserEdit' => $urlUserEdit, 'urlSettings' => UrlHelper::construct('cms/admin-settings')->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')]);
 }