2014-08-27 11:23:03 +02:00
|
|
|
<?php
|
2015-02-03 16:27:59 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | http://www.gnu.org/licenses/gpl-2.0.txt */
|
2014-08-27 11:23:03 +02:00
|
|
|
|
|
|
|
namespace Icinga\Web\Hook;
|
|
|
|
|
|
|
|
use Zend_Controller_Action_HelperBroker;
|
|
|
|
use Zend_View;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for web hooks
|
|
|
|
*
|
|
|
|
* The class provides access to the view
|
|
|
|
*/
|
|
|
|
class WebBaseHook
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* View instance
|
|
|
|
*
|
|
|
|
* @var Zend_View
|
|
|
|
*/
|
|
|
|
private $view;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the view instance
|
|
|
|
*
|
|
|
|
* @param Zend_View $view
|
|
|
|
*/
|
|
|
|
public function setView(Zend_View $view)
|
|
|
|
{
|
|
|
|
$this->view = $view;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the view instance
|
|
|
|
*
|
|
|
|
* @return Zend_View
|
|
|
|
*/
|
|
|
|
public function getView()
|
|
|
|
{
|
|
|
|
if ($this->view === null) {
|
|
|
|
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
|
|
|
|
if ($viewRenderer->view === null) {
|
|
|
|
$viewRenderer->initView();
|
|
|
|
}
|
|
|
|
$this->view = $viewRenderer->view;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->view;
|
|
|
|
}
|
2015-02-03 16:27:59 +01:00
|
|
|
}
|