/
notifications.phtml
59 lines (58 loc) · 1.99 KB
/
notifications.phtml
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
<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' => $object->getName())
);
} else {
$ackLink = $this->href(
'monitoring/service/send-custom-notification',
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
);
}
?>
<?= $this->qlink(
$this->translate('Send Custom Notification'),
$ackLink,
null,
array(
'icon' => 'comment',
'data-base-target' => '_self',
'title' => $this->translate(
'Send a custom notification, share information about the'
. ' object to contacts.'
)
)
); ?>
<?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>