+ = $this->translate('You have selected') ?> + = $this->qlink( + sprintf($this->translate('%d downtimes'), count($downtimes)), + $listAllLink, + null, + array('title' => $this->translate('List all selected downtimes.')) + ) ?> +
diff --git a/modules/monitoring/application/controllers/DowntimesController.php b/modules/monitoring/application/controllers/DowntimesController.php new file mode 100644 index 000000000..b0057466f --- /dev/null +++ b/modules/monitoring/application/controllers/DowntimesController.php @@ -0,0 +1,122 @@ +filter = Filter::fromQueryString(str_replace( + 'downtime_id', + 'downtime_internal_id', + (string)$this->params + )); + $this->downtimes = $this->backend->select()->from('downtime', array( + 'id' => 'downtime_internal_id', + 'objecttype' => 'downtime_objecttype', + 'comment' => 'downtime_comment', + 'author_name' => 'downtime_author_name', + 'start' => 'downtime_start', + 'scheduled_start' => 'downtime_scheduled_start', + 'scheduled_end' => 'downtime_scheduled_end', + 'end' => 'downtime_end', + 'duration' => 'downtime_duration', + 'is_flexible' => 'downtime_is_flexible', + 'is_fixed' => 'downtime_is_fixed', + 'is_in_effect' => 'downtime_is_in_effect', + 'entry_time' => 'downtime_entry_time', + 'host_state' => 'downtime_host_state', + 'service_state' => 'downtime_service_state', + 'host_name', + 'host', + 'service', + 'service_description', + 'host_display_name', + 'service_display_name' + ))->addFilter($this->filter)->getQuery()->fetchAll(); + $this->getTabs() + ->add( + 'downtimes', + array( + 'title' => $this->translate( + 'Display detailed information about multiple downtimes.' + ), + 'icon' => 'plug', + 'label' => $this->translate('Downtimes'), + 'url' =>'monitoring/downtimes/show' + ) + )->activate('downtimes')->extend(new DashboardAction()); + } + + public function showAction() + { + if (false === $this->downtimes) { + return; + } + $this->view->downtimes = $this->downtimes; + $this->view->isService = $this->isService; + + // $this->view->delDowntimeForm = $this->createDelDowntimeForm(); + $this->view->listAllLink = Url::fromPath('monitoring/list/downtimes') + ->setQueryString($this->filter->toQueryString()); + $this->view->removeAllLink = Url::fromPath('monitoring/downtimes/removeAll') + ->setParams($this->params); + } + + public function removeAllAction() + { + + } + + private function createDelDowntimeForm() + { + $delDowntimeForm = new DeleteDowntimeCommandForm(); + $delDowntimeForm->setObjects($this->downtimes); + $delDowntimeForm->populate( + array( + 'downtime_id' => $this->downtime->id, + 'redirect' => Url::fromPath('monitoring/list/downtimes') + ) + ); + if (! $this->isService) { + $delDowntimeForm->setAction( + $this->view->url('monitoring/host/delete-downtime', + array('host' => $this->downtime->host_name)) + ); + } else { + $delDowntimeForm->setAction( + $this->view->url('monitoring/service/delete-downtime', array( + 'host' => $this->downtime->host_name, + 'service' => $this->downtime->service_description + )) + ); + } + return $delDowntimeForm; + } +} diff --git a/modules/monitoring/application/views/scripts/downtimes/show.phtml b/modules/monitoring/application/views/scripts/downtimes/show.phtml new file mode 100644 index 000000000..89ecc7073 --- /dev/null +++ b/modules/monitoring/application/views/scripts/downtimes/show.phtml @@ -0,0 +1,41 @@ +
+ = $this->translate('You have selected') ?> + = $this->qlink( + sprintf($this->translate('%d downtimes'), count($downtimes)), + $listAllLink, + null, + array('title' => $this->translate('List all selected downtimes.')) + ) ?> +