diff --git a/application/controllers/LayoutController.php b/application/controllers/LayoutController.php index 81bf36083..45836582e 100644 --- a/application/controllers/LayoutController.php +++ b/application/controllers/LayoutController.php @@ -4,16 +4,43 @@ // {{{ICINGA_LICENSE_HEADER}}} 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->url = Url::fromRequest()->getRelativeUrl(); $this->view->items = Menu::fromConfig()->getChildren(); $this->view->sub = false; } + + /** + * Render the top bar + */ + public function topbarAction() + { + $topbarHtmlParts = array(); + + /** @var Hook\Layout\TopBar $hook */ + $hook = null; + + foreach (Hook::all(Hook::TARGET_LAYOUT_TOPBAR) as $hook) { + $topbarHtmlParts[] = $hook->getHtml($this->getRequest(), $this->view); + } + + $this->view->topbarHtmlParts = $topbarHtmlParts; + + + $this->renderScript('parts/topbar.phtml'); + } } // @codingStandardsIgnoreEnd diff --git a/application/layouts/scripts/body.phtml b/application/layouts/scripts/body.phtml index 565a3122d..a42b46dcc 100755 --- a/application/layouts/scripts/body.phtml +++ b/application/layouts/scripts/body.phtml @@ -1,4 +1,5 @@ -render('parts/topbar.phtml') ?> +action('topbar', 'layout'); ?> +
diff --git a/application/layouts/scripts/parts/topbar.phtml b/application/layouts/scripts/parts/topbar.phtml index e2aa3209c..39d559f57 100755 --- a/application/layouts/scripts/parts/topbar.phtml +++ b/application/layouts/scripts/parts/topbar.phtml @@ -1,14 +1,15 @@ -