icingaweb2/modules/monitoring/application/views/scripts/show/components/notifications.phtml

60 lines
2.0 KiB
PHTML

<tr>
<th><?= $this->translate('Notifications') ?></th>
<td>
<?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_name' => $object->getName())
);
} else {
$ackLink = $this->href(
'monitoring/service/send-custom-notification',
array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName())
);
}
?>
<?= $this->qlink(
$this->translate('Send notification'),
$ackLink,
null,
array(
'icon' => 'bell',
'data-base-target' => '_self',
'title' => $this->translate(
'Send a custom notification, share information about the'
. ' object to contacts.'
)
)
) ?><br />
<?php } ?>
<?php
// We are not interested in notifications for OK or pending objects
if (! in_array((int) $object->state, array(0, 99))) {
if ($object->current_notification_number > 0) {
if ((int) $object->current_notification_number === 1) {
$msg = sprintf(
$this->translate('A notication has been sent for this issue %s ago'),
$this->timeSince($object->last_notification)
);
} else {
$msg = sprintf(
$this->translate('%s notications have been sent for this issue'),
$object->current_notification_number
) . '<br />' . sprintf(
$this->translate('The last one occured %s ago'),
$this->timeSince($object->last_notification)
);
}
echo $msg;
} else {
echo '('
. $this->translate('No notification has been sent for this issue')
. ')';
}
}
?>
</td>
</tr>