From 88698cb05dfdc3f3c8d8d852bbf04e32209d3ffe Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Wed, 27 Aug 2014 11:28:31 +0200 Subject: [PATCH] Hook/TopBar: Rework interface for monitoring top bar refs #6929 --- application/controllers/LayoutController.php | 4 ++-- library/Icinga/Web/Hook/TopBarHook.php | 5 ++--- modules/monitoring/library/Monitoring/Web/Hook/TopBar.php | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/application/controllers/LayoutController.php b/application/controllers/LayoutController.php index 952c4ee61..6c1355fc1 100644 --- a/application/controllers/LayoutController.php +++ b/application/controllers/LayoutController.php @@ -31,11 +31,11 @@ class LayoutController extends ActionController { $topbarHtmlParts = array(); - /** @var Hook\Layout\TopBar $hook */ + /** @var Hook\TopBarHook $hook */ $hook = null; foreach (Hook::all('TopBar') as $hook) { - $topbarHtmlParts[] = $hook->getHtml($this->getRequest(), $this->view); + $topbarHtmlParts[] = $hook->getHtml($this->getRequest()); } $this->view->topbarHtmlParts = $topbarHtmlParts; diff --git a/library/Icinga/Web/Hook/TopBarHook.php b/library/Icinga/Web/Hook/TopBarHook.php index fb637015d..183a0ca07 100644 --- a/library/Icinga/Web/Hook/TopBarHook.php +++ b/library/Icinga/Web/Hook/TopBarHook.php @@ -10,15 +10,14 @@ use Zend_View; /** * Hook to extend topbar items */ -abstract class TopBarHook +abstract class TopBarHook extends WebBaseHook { /** * Function to generate top bar content * * @param Request $request - * @param Zend_View $view * * @return string */ - abstract public function getHtml($request, $view); + abstract public function getHtml($request); } diff --git a/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php b/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php index 9433bf805..082a03c5b 100644 --- a/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php +++ b/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php @@ -18,11 +18,10 @@ class TopBar extends TopBarHook * Function to generate top bar content * * @param Request $request - * @param Zend_View $view * * @return string */ - public function getHtml($request, $view) + public function getHtml($request) { $hostSummary = StatusSummaryView::fromRequest( $request, @@ -50,7 +49,7 @@ class TopBar extends TopBarHook ) )->getQuery()->fetchRow(); - return $view->partial( + return $this->getView()->partial( 'layout/topbar.phtml', 'monitoring', array(