Skip to content

Commit

Permalink
Conform to coding guidelines in downtime controller
Browse files Browse the repository at this point in the history
  • Loading branch information
majentsch committed May 7, 2015
1 parent e5e3e80 commit 1586275
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
33 changes: 28 additions & 5 deletions modules/monitoring/application/controllers/DowntimeController.php
Expand Up @@ -13,10 +13,25 @@
*/
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');
Expand Down Expand Up @@ -54,7 +69,7 @@ public function init()
} else {
$this->isService = false;
}

$this->getTabs()
->add(
'downtime',
Expand All @@ -68,7 +83,10 @@ public function init()
)
)->activate('downtime')->extend(new DashboardAction());
}


/**
* Display the detail view for a downtime
*/
public function showAction()
{
$this->view->downtime = $this->downtime;
Expand All @@ -86,7 +104,12 @@ public function showAction()
$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');
Expand Down
29 changes: 25 additions & 4 deletions modules/monitoring/application/controllers/DowntimesController.php
Expand Up @@ -14,10 +14,25 @@
*/
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(
Expand Down Expand Up @@ -82,7 +97,10 @@ public function init()
}
}
}


/**
* Display the detail view for a downtime list
*/
public function showAction()
{
$this->view->downtimes = $this->downtimes;
Expand All @@ -91,7 +109,10 @@ public function showAction()
$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');
Expand Down

0 comments on commit 1586275

Please sign in to comment.