Conform to coding guidelines

This commit is contained in:
Matthias Jentsch 2015-05-04 17:02:14 +02:00
parent 1586275521
commit 3187975553
3 changed files with 29 additions and 25 deletions

View File

@ -36,9 +36,9 @@ class Monitoring_DowntimesController extends Controller
public function init() public function init()
{ {
$this->filter = Filter::fromQueryString(str_replace( $this->filter = Filter::fromQueryString(str_replace(
'downtime_id', 'downtime_id',
'downtime_internal_id', 'downtime_internal_id',
(string)$this->params (string)$this->params
)); ));
$this->downtimes = $this->backend->select()->from('downtime', array( $this->downtimes = $this->backend->select()->from('downtime', array(
'id' => 'downtime_internal_id', 'id' => 'downtime_internal_id',
@ -66,22 +66,21 @@ class Monitoring_DowntimesController extends Controller
if (false === $this->downtimes) { if (false === $this->downtimes) {
throw new Zend_Controller_Action_Exception( throw new Zend_Controller_Action_Exception(
$this->translate('Downtime not found') $this->translate('Downtime not found')
); );
} }
$this->getTabs() $this->getTabs()->add(
->add( 'downtimes',
'downtimes', array(
array( 'title' => $this->translate(
'title' => $this->translate( 'Display detailed information about multiple downtimes.'
'Display detailed information about multiple downtimes.' ),
), 'icon' => 'plug',
'icon' => 'plug', 'label' => $this->translate('Downtimes'),
'label' => $this->translate('Downtimes'), 'url' =>'monitoring/downtimes/show'
'url' =>'monitoring/downtimes/show' )
) )->activate('downtimes');
)->activate('downtimes')->extend(new DashboardAction());
foreach ($this->downtimes as $downtime) { foreach ($this->downtimes as $downtime) {
if (isset($downtime->service_description)) { if (isset($downtime->service_description)) {

View File

@ -84,7 +84,7 @@ class DeleteDowntimeCommandForm extends CommandForm
$delDowntime = new DeleteDowntimeCommand(); $delDowntime = new DeleteDowntimeCommand();
$delDowntime->setDowntimeId($id); $delDowntime->setDowntimeId($id);
$delDowntime->setDowntimeType( $delDowntime->setDowntimeType(
isset($firstDowntime->service_description) ? isset($firstDowntime->service_description) ?
DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE : DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE :
DeleteDowntimeCommand::DOWNTIME_TYPE_HOST DeleteDowntimeCommand::DOWNTIME_TYPE_HOST
); );

View File

@ -12,6 +12,11 @@ use Icinga\Web\Notification;
*/ */
class DeleteDowntimesCommandForm extends CommandForm class DeleteDowntimesCommandForm extends CommandForm
{ {
/**
* The downtimes to delete on success
*
* @var array
*/
protected $downtimes; protected $downtimes;
/** /**
@ -31,12 +36,12 @@ class DeleteDowntimesCommandForm extends CommandForm
{ {
$this->addElements(array( $this->addElements(array(
array( array(
'hidden', 'hidden',
'redirect', 'redirect',
array( array(
'decorators' => array('ViewHelper') 'decorators' => array('ViewHelper')
)
) )
)
)); ));
return $this; return $this;
} }
@ -60,7 +65,7 @@ class DeleteDowntimesCommandForm extends CommandForm
$delDowntime = new DeleteDowntimeCommand(); $delDowntime = new DeleteDowntimeCommand();
$delDowntime->setDowntimeId($downtime->id); $delDowntime->setDowntimeId($downtime->id);
$delDowntime->setDowntimeType( $delDowntime->setDowntimeType(
isset($downtime->service_description) ? isset($downtime->service_description) ?
DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE : DeleteDowntimeCommand::DOWNTIME_TYPE_SERVICE :
DeleteDowntimeCommand::DOWNTIME_TYPE_HOST DeleteDowntimeCommand::DOWNTIME_TYPE_HOST
); );
@ -76,9 +81,9 @@ class DeleteDowntimesCommandForm extends CommandForm
/** /**
* Set the downtimes to be deleted upon success * Set the downtimes to be deleted upon success
* *
* @param type $downtimes * @param type $downtimes
* *
* @return $this * @return $this
*/ */
public function setDowntimes($downtimes) public function setDowntimes($downtimes)