Пример #1
0
 /**
  * Renders the sidebar
  * @param boolean $return True to return the rendered string, false to output it directly
  * @return null|string
  */
 public function render($return = true)
 {
     $renderedPanels = array();
     $panels = $this->sidebar->getPanels();
     foreach ($panels as $panel) {
         $renderedPanels[] = $this->renderView($panel);
     }
     $this->set('actions', $this->sidebar->getActions());
     $this->set('panels', $renderedPanels);
     $this->set('information', $this->sidebar->getInformation());
     $request = Zibo::getInstance()->getRequest();
     $baseUrl = $request->getBaseUrl() . Request::QUERY_SEPARATOR;
     $sidebarAction = $baseUrl . Module::ROUTE_SIDEBAR . Request::QUERY_SEPARATOR;
     $isVisible = SidebarController::isSidebarVisible() ? 'true' : 'false';
     $this->addStyle(self::STYLE_SIDEBAR);
     $this->addJavascript(self::SCRIPT_SIDEBAR);
     $this->addInlineJavascript("ziboAdminInitializeSidebar(" . $isVisible . ", '" . $sidebarAction . "');");
     return parent::render($return);
 }
Пример #2
0
 /**
  * Adds the sidebar to the view if the sidebar is populated
  * @return null
  */
 private function addSidebar()
 {
     if (!$this->sidebar || !$this->sidebar->hasActions() && !$this->sidebar->hasPanels() && !$this->sidebar->hasInformation()) {
         return;
     }
     $view = new SidebarView($this->sidebar);
     $this->setSubview('sidebar', $view);
 }