mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
AcknowledgeProblem|AddComment-Form: Don't show datepicker if expire checkbox is unchecked
This commit is contained in:
parent
acc11a395d
commit
8fa8f4baf0
2 changed files with 4 additions and 7 deletions
|
|
@ -126,22 +126,20 @@ class AcknowledgeProblemForm extends CommandForm
|
|||
);
|
||||
$decorator->decorate($this->getElement('sticky'));
|
||||
|
||||
$acknowledgeExpire = (bool) $config->get('settings', 'acknowledge_expire', false);
|
||||
|
||||
$this->addElement(
|
||||
'checkbox',
|
||||
'expire',
|
||||
[
|
||||
'ignore' => true,
|
||||
'class' => 'autosubmit',
|
||||
'value' => $acknowledgeExpire,
|
||||
'value' => (bool) $config->get('settings', 'acknowledge_expire', false),
|
||||
'label' => t('Use Expire Time'),
|
||||
'description' => t('If the acknowledgement should expire, check this option.')
|
||||
]
|
||||
);
|
||||
$decorator->decorate($this->getElement('expire'));
|
||||
|
||||
if ($acknowledgeExpire || $this->getPopulatedValue('expire') === 'y') {
|
||||
if ($this->getElement('expire')->isChecked()) {
|
||||
$expireTime = new DateTime();
|
||||
$expireTime->add(new DateInterval($config->get('settings', 'acknowledge_expire_time', 'PT1H')));
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@ class AddCommentForm extends CommandForm
|
|||
$decorator->decorate($this->getElement('comment'));
|
||||
|
||||
$config = Config::module('icingadb');
|
||||
$commentExpire = (bool) $config->get('settings', 'comment_expire', false);
|
||||
|
||||
$this->addElement(
|
||||
'checkbox',
|
||||
|
|
@ -90,14 +89,14 @@ class AddCommentForm extends CommandForm
|
|||
[
|
||||
'ignore' => true,
|
||||
'class' => 'autosubmit',
|
||||
'value' => $commentExpire,
|
||||
'value' => (bool) $config->get('settings', 'comment_expire', false),
|
||||
'label' => t('Use Expire Time'),
|
||||
'description' => t('If the comment should expire, check this option.')
|
||||
]
|
||||
);
|
||||
$decorator->decorate($this->getElement('expire'));
|
||||
|
||||
if ($commentExpire || $this->getPopulatedValue('expire') === 'y') {
|
||||
if ($this->getElement('expire')->isChecked()) {
|
||||
$expireTime = new DateTime();
|
||||
$expireTime->add(new DateInterval($config->get('settings', 'comment_expire_time', 'PT1H')));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue