/** * 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; }
/** * Create a command form to delete a single comment * * @return DeleteCommentsCommandForm */ private function createDelCommentForm() { $this->assertPermission('monitoring/command/comment/delete'); $delCommentForm = new DeleteCommentCommandForm(); $delCommentForm->setAction(Url::fromPath('monitoring/comment/show')->setParam('comment_id', $this->comment->id)); $delCommentForm->handleRequest(); return $delCommentForm; }
/** * Display comment detail view */ public function showAction() { $this->view->comment = $this->comment; if ($this->hasPermission('monitoring/command/comment/delete')) { $listUrl = Url::fromPath('monitoring/list/comments')->setQueryString('comment_type=(comment|ack)'); $form = new DeleteCommentCommandForm(); $form->populate(array('comment_id' => $this->comment->id, 'comment_is_service' => isset($this->comment->service_description), 'redirect' => $listUrl))->handleRequest(); $this->view->delCommentForm = $form; } }
/** * Delete a comment */ public function deleteCommentAction() { $this->assertPermission('monitoring/command/comment/delete'); $form = new DeleteCommentCommandForm(); $form->setTitle($this->translate('Delete Service Comments')); $this->handleCommandForm($form); }