Ejemplo n.º 1
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')]);
 }
Ejemplo 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;
     }
     $urlUserEdit = UrlHelper::construct('cms/admin-profile/update')->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')->enableAdmin()->toString(), 'backend-url-triggerEditViewFiles' => UrlHelper::construct('cms/toolbar/trigger-edit-view-files')->enableAdmin()->toString(), 'backend-url-triggerIsOpen' => UrlHelper::construct('cms/toolbar/trigger-is-open')->enableAdmin()->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, 'editUrl' => $this->editUrl, 'urlUserEdit' => $urlUserEdit, 'urlSettings' => UrlHelper::construct('cms/admin-settings')->enableAdmin()->setSystemParam(\skeeks\cms\modules\admin\Module::SYSTEM_QUERY_EMPTY_LAYOUT, 'true')]);
 }