2014-03-08 21:02:22 +01:00
|
|
|
<tr>
|
2014-05-27 23:44:02 +02:00
|
|
|
<th><?= $this->translate('Notifications') ?></th>
|
2014-03-08 21:02:22 +01:00
|
|
|
<td>
|
2015-03-12 16:08:22 +01:00
|
|
|
<?php if ($this->hasPermission('monitoring/command/send-custom-notification')) {
|
|
|
|
if ($object->getType() === $object::TYPE_HOST) {
|
|
|
|
$ackLink = $this->href(
|
|
|
|
'monitoring/host/send-custom-notification',
|
|
|
|
array('host' => $object->getName())
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$ackLink = $this->href(
|
|
|
|
'monitoring/service/send-custom-notification',
|
|
|
|
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
|
|
|
);
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?= $this->qlink(
|
2015-03-13 16:06:19 +01:00
|
|
|
$this->translate('Send notification'),
|
2015-03-12 16:08:22 +01:00
|
|
|
$ackLink,
|
|
|
|
null,
|
|
|
|
array(
|
2015-03-13 16:07:20 +01:00
|
|
|
'icon' => 'bell',
|
2015-03-12 16:08:22 +01:00
|
|
|
'data-base-target' => '_self',
|
|
|
|
'title' => $this->translate(
|
|
|
|
'Send a custom notification, share information about the'
|
|
|
|
. ' object to contacts.'
|
|
|
|
)
|
|
|
|
)
|
2015-03-13 16:06:19 +01:00
|
|
|
) ?><br />
|
2015-03-12 16:08:22 +01:00
|
|
|
<?php } ?>
|
2014-03-08 21:02:22 +01:00
|
|
|
<?php
|
2015-03-12 16:08:22 +01:00
|
|
|
// We are not interested in notifications for OK or pending objects
|
|
|
|
if (! in_array((int) $object->state, array(0, 99))) {
|
2014-03-08 21:02:22 +01:00
|
|
|
|
2015-03-12 16:08:22 +01:00
|
|
|
if ($object->current_notification_number > 0) {
|
|
|
|
if ((int) $object->current_notification_number === 1) {
|
|
|
|
$msg = sprintf(
|
2015-04-10 10:28:17 +02:00
|
|
|
$this->translate('A notification has been sent for this issue %s.'),
|
2015-04-10 10:20:10 +02:00
|
|
|
$this->timeAgo($object->last_notification)
|
2015-03-12 16:08:22 +01:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$msg = sprintf(
|
2015-04-10 10:28:17 +02:00
|
|
|
$this->translate('%d notifications have been sent for this issue.'),
|
2015-03-12 16:08:22 +01:00
|
|
|
$object->current_notification_number
|
|
|
|
) . '<br />' . sprintf(
|
2015-04-10 10:28:17 +02:00
|
|
|
$this->translate('The last one was sent %s.'),
|
2015-04-10 10:20:10 +02:00
|
|
|
$this->timeAgo($object->last_notification)
|
2015-03-12 16:08:22 +01:00
|
|
|
);
|
|
|
|
}
|
2015-03-13 16:06:19 +01:00
|
|
|
echo $msg;
|
2014-03-08 21:02:22 +01:00
|
|
|
} else {
|
2015-03-12 16:08:22 +01:00
|
|
|
echo '('
|
2015-04-10 10:28:17 +02:00
|
|
|
. $this->translate('No notification has been sent for this issue.')
|
2015-03-12 16:08:22 +01:00
|
|
|
. ')';
|
2014-03-08 21:02:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
2015-03-13 16:06:19 +01:00
|
|
|
</tr>
|