示例#1
0
文件: Helpbar.php 项目: ratbird/hope
 /**
  * Renders the help bar.
  * The helpbar will only be rendered if it actually contains any widgets.
  * It will use the template "helpbar.php" located at "templates/helpbar".
  * A notification is dispatched before and after the actual rendering
  * process.
  *
  * @return String The HTML code of the rendered helpbar.
  */
 public function render()
 {
     $this->loadContent();
     // add tour links
     if (Config::get()->TOURS_ENABLE) {
         $widget = new HelpbarTourWidget();
         if ($widget->hasElements()) {
             $this->addWidget($widget);
         }
         $tour_data = $widget->tour_data;
     }
     // add wiki link and remove it from navigation
     $this->addLink(_('Weiterführende Hilfe'), format_help_url(PageLayout::getHelpKeyword()), Icon::create('link-extern', 'info_alt'), '_blank');
     $content = '';
     NotificationCenter::postNotification('HelpbarWillRender', $this);
     if ($this->should_render && $this->hasWidgets()) {
         $template = $GLOBALS['template_factory']->open('helpbar/helpbar');
         $template->widgets = $this->widgets;
         $template->open = $this->open;
         $template->tour_data = $tour_data;
         $content = $template->render();
     }
     NotificationCenter::postNotification('HelpbarDidRender', $this);
     return $content;
 }