Conform to coding guidelines in downtime controller

This commit is contained in:
Matthias Jentsch 2015-05-04 16:30:26 +02:00
parent e5e3e80300
commit 1586275521
2 changed files with 53 additions and 9 deletions

View File

@ -13,10 +13,25 @@ use Icinga\Web\Widget\Tabextension\DashboardAction;
*/
class Monitoring_DowntimeController extends Controller
{
/**
* The fetched downtime
*
* @var stdClass
*/
protected $downtime;
/**
* If the downtime is a service or not
*
* @var boolean
*/
protected $isService;
/**
* Fetch the downtime matching the given id and add tabs
*
* @throws Zend_Controller_Action_Exception
*/
public function init()
{
$downtimeId = $this->params->get('downtime_id');
@ -54,7 +69,7 @@ class Monitoring_DowntimeController extends Controller
} else {
$this->isService = false;
}
$this->getTabs()
->add(
'downtime',
@ -68,7 +83,10 @@ class Monitoring_DowntimeController extends Controller
)
)->activate('downtime')->extend(new DashboardAction());
}
/**
* Display the detail view for a downtime
*/
public function showAction()
{
$this->view->downtime = $this->downtime;
@ -86,7 +104,12 @@ class Monitoring_DowntimeController extends Controller
$this->view->delDowntimeForm = $this->createDelDowntimeForm();
}
}
/**
* Create a command form to delete a single comment
*
* @return DeleteDowntimeCommandForm
*/
private function createDelDowntimeForm()
{
$this->assertPermission('monitoring/command/downtime/delete');

View File

@ -14,10 +14,25 @@ use Icinga\Web\Widget\Tabextension\DashboardAction;
*/
class Monitoring_DowntimesController extends Controller
{
/**
* The fetched downtimes
*
* @var array
*/
protected $downtimes;
/**
* A filter matching all current downtimes
*
* @var Filter
*/
protected $filter;
/**
* Fetch all downtimes matching the current filter and add tabs
*
* @throws Zend_Controller_Action_Exception
*/
public function init()
{
$this->filter = Filter::fromQueryString(str_replace(
@ -82,7 +97,10 @@ class Monitoring_DowntimesController extends Controller
}
}
}
/**
* Display the detail view for a downtime list
*/
public function showAction()
{
$this->view->downtimes = $this->downtimes;
@ -91,7 +109,10 @@ class Monitoring_DowntimesController extends Controller
$this->view->removeAllLink = Url::fromPath('monitoring/downtimes/remove-all')
->setParams($this->params);
}
/**
* Display the form for removing a downtime list
*/
public function removeAllAction()
{
$this->assertPermission('monitoring/command/downtime/delete');