icingaweb2/application/controllers/LayoutController.php
Johannes Meyer 143a1e44fe Add a HTML renderer for Icinga\Web\Menu
The menu was being rendered through recursive partials before. The
overhead this fact implicates is not as efficient as standard recursion
so there is now a special renderer for Icinga\Web\Menu utilizing
the RecursiveIteratorIterator

refs #6153
2014-07-03 15:46:46 +02:00

44 lines
949 B
PHP

<?php
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Web\MenuRenderer;
use Icinga\Web\Controller\ActionController;
use Icinga\Web\Hook;
use Icinga\Web\Menu;
use Icinga\Web\Url;
/**
* Create complex layout parts
*/
class LayoutController extends ActionController
{
/**
* Render the menu
*/
public function menuAction()
{
$this->view->menuRenderer = new MenuRenderer(Menu::fromConfig()->order(), Url::fromRequest()->getRelativeUrl());
}
/**
* Render the top bar
*/
public function topbarAction()
{
$topbarHtmlParts = array();
/** @var Hook\Layout\TopBar $hook */
$hook = null;
foreach (Hook::all('TopBar') as $hook) {
$topbarHtmlParts[] = $hook->getHtml($this->getRequest(), $this->view);
}
$this->view->topbarHtmlParts = $topbarHtmlParts;
$this->renderScript('parts/topbar.phtml');
}
}