/**
  * Show a host or service
  */
 public function showAction()
 {
     $this->setAutorefreshInterval(10);
     $auth = $this->Auth();
     if ($auth->hasPermission('monitoring/command/schedule-check')) {
         $checkNowForm = new CheckNowCommandForm();
         $checkNowForm->setObjects($this->object)->handleRequest();
         $this->view->checkNowForm = $checkNowForm;
     }
     if (!in_array((int) $this->object->state, array(0, 99))) {
         if ((bool) $this->object->acknowledged) {
             if ($auth->hasPermission('monitoring/command/remove-acknowledgement')) {
                 $removeAckForm = new RemoveAcknowledgementCommandForm();
                 $removeAckForm->setObjects($this->object)->handleRequest();
                 $this->view->removeAckForm = $removeAckForm;
             }
         }
     }
     $this->object->populate();
     $toggleFeaturesForm = new ToggleObjectFeaturesCommandForm();
     $toggleFeaturesForm->setBackend($this->backend)->load($this->object)->setObjects($this->object)->handleRequest();
     $this->view->toggleFeaturesForm = $toggleFeaturesForm;
     if (!empty($this->object->comments) && $auth->hasPermission('monitoring/command/comment/delete')) {
         $delCommentForm = new DeleteCommentCommandForm();
         $delCommentForm->handleRequest();
         $this->view->delCommentForm = $delCommentForm;
     }
     if (!empty($this->object->downtimes) && $auth->hasPermission('monitoring/command/downtime/delete')) {
         $delDowntimeForm = new DeleteDowntimeCommandForm();
         $delDowntimeForm->handleRequest();
         $this->view->delDowntimeForm = $delDowntimeForm;
     }
     $this->view->showInstance = $this->backend->select()->from('instance')->count() > 1;
     $this->view->object = $this->object;
 }
Example #2
0
 /**
  * Create a command form to delete a single comment
  *
  * @return DeleteDowntimeCommandForm
  */
 private function createDelDowntimeForm()
 {
     $this->assertPermission('monitoring/command/downtime/delete');
     $delDowntimeForm = new DeleteDowntimeCommandForm();
     $delDowntimeForm->setAction(Url::fromPath('monitoring/downtime/show')->setParam('downtime_id', $this->downtime->id));
     $delDowntimeForm->handleRequest();
     return $delDowntimeForm;
 }
 /**
  * Display the detail view for a downtime
  */
 public function showAction()
 {
     $isService = isset($this->downtime->service_description);
     $this->view->downtime = $this->downtime;
     $this->view->isService = $isService;
     $this->view->listAllLink = Url::fromPath('monitoring/list/downtimes');
     $this->view->showHostLink = Url::fromPath('monitoring/host/show')->setParam('host', $this->downtime->host_name);
     $this->view->showServiceLink = Url::fromPath('monitoring/service/show')->setParam('host', $this->downtime->host_name)->setParam('service', $this->downtime->service_description);
     $this->view->stateName = $isService ? Service::getStateText($this->downtime->service_state) : Host::getStateText($this->downtime->host_state);
     if ($this->hasPermission('monitoring/command/downtime/delete')) {
         $form = new DeleteDowntimeCommandForm();
         $form->populate(array('downtime_id' => $this->downtime->id, 'downtime_is_service' => $isService, 'redirect' => Url::fromPath('monitoring/list/downtimes')))->handleRequest();
         $this->view->delDowntimeForm = $form;
     }
 }