/** * (non-PHPDoc) * @see \Icinga\Web\Form::onSuccess() For the method documentation. */ public function onSuccess() { $cmd = new DeleteCommentCommand(); $cmd->setIsService($this->getElement('comment_is_service')->getValue())->setCommentId($this->getElement('comment_id')->getValue()); $this->getTransport($this->request)->send($cmd); $redirect = $this->getElement('redirect')->getValue(); if (!empty($redirect)) { $this->setRedirectUrl($redirect); } Notification::success($this->translate('Deleting comment..')); return true; }
/** * {@inheritdoc} */ public function onSuccess() { foreach ($this->comments as $comment) { $cmd = new DeleteCommentCommand(); $cmd->setCommentId($comment->id)->setIsService(isset($comment->service_description)); $this->getTransport($this->request)->send($cmd); } $redirect = $this->getElement('redirect')->getValue(); if (!empty($redirect)) { $this->setRedirectUrl($redirect); } Notification::success($this->translatePlural('Deleting comment..', 'Deleting comments..', count($this->comments))); return true; }
public function renderDeleteComment(DeleteCommentCommand $command) { return sprintf('%s;%u', $command->getIsService() ? 'DEL_SVC_COMMENT' : 'DEL_HOST_COMMENT', $command->getCommentId()); }
public function renderDeleteComment(DeleteCommentCommand $command) { $endpoint = 'actions/remove-comment'; $data = array('comment' => $command->getCommentName()); return IcingaApiCommand::create($endpoint, $data); }