/usr/share/icingaweb2/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php is in icingaweb2-module-monitoring 2.1.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Module\Monitoring\Forms\Command\Instance;
use DateTime;
use DateInterval;
use Icinga\Module\Monitoring\Command\Instance\DisableNotificationsExpireCommand;
use Icinga\Module\Monitoring\Forms\Command\CommandForm;
use Icinga\Web\Notification;
/**
* Form for disabling host and service notifications w/ an optional expire date and time on an Icinga instance
*/
class DisableNotificationsExpireCommandForm extends CommandForm
{
/**
* (non-PHPDoc)
* @see \Zend_Form::init() For the method documentation.
*/
public function init()
{
$this->setRequiredCue(null);
$this->setSubmitLabel($this->translate('Disable Notifications'));
$this->addDescription($this->translate(
'This command is used to disable host and service notifications for a specific time.'
));
}
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::createElements() For the method documentation.
*/
public function createElements(array $formData = array())
{
$expireTime = new DateTime();
$expireTime->add(new DateInterval('PT1H'));
$this->addElement(
'dateTimePicker',
'expire_time',
array(
'required' => true,
'label' => $this->translate('Expire Time'),
'description' => $this->translate('Set the expire time.'),
'value' => $expireTime
)
);
return $this;
}
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::onSuccess() For the method documentation.
*/
public function onSuccess()
{
$disableNotifications = new DisableNotificationsExpireCommand();
$disableNotifications
->setExpireTime($this->getElement('expire_time')->getValue()->getTimestamp());
$this->getTransport($this->request)->send($disableNotifications);
Notification::success($this->translate('Disabling host and service notifications..'));
return true;
}
}
|