Comment Overview: Implement delete comment inline command [wip]

refs #4714
This commit is contained in:
Marius Hein 2013-09-27 13:54:54 +02:00 committed by Eric Lippmann
parent d109f370cd
commit d7f6dcb3ce
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,35 @@
<?php
// @codingStandardsIgnoreStart
// {{{ICINGA_LICENSE_HEADER}}}
// {{{ICINGA_LICENSE_HEADER}}}
use Icinga\Module\Monitoring\Form\Command\CommandForm;
use Icinga\Application\Icinga;
/**
* Helper to build inline html command forms
*/
class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
{
/**
* Creates a simple form without additional input fields
*
* @param string $commandName Name of command
* @param string $submitLabel Label of submit button
* @param array $arguments Add parameter as hidden fields
*
* @return string Html form content
*/
public function simpleForm($commandName, $submitLabel, array $arguments = array())
{
$form = new CommandForm();
$form->setRequest(Icinga::app()->getFrontController()->getRequest());
$form->setView($this->view);
$form->setAction($this->view->href('monitoring/command/' . $commandName));
$form->setSubmitLabel($submitLabel);
return $form->render();
}
}
// @codingStandardsIgnoreStop

View File

@ -1,5 +1,6 @@
<?php
$dateHelper = $this->getHelper('DateFormat');
$commandHelper = $this->getHelper('CommandForm');
?>
<?= $this->tabs->render($this); ?>
@ -101,7 +102,15 @@ $viewHelper = $this->getHelper('MonitoringState');
?>
</td>
<td>
{{{REMOVE_ICON}}}
<?=
$commandHelper->simpleForm(
'removecomment',
'Remove',
array(
'commentid' => $comment->comment_id
)
);
?>
</td>
</tr>
<?php endforeach; ?>