2014-09-12 16:52:45 +02:00
|
|
|
<tr>
|
|
|
|
<th><?= $this->translate('Downtimes') ?></th>
|
|
|
|
<td>
|
2015-01-23 10:15:55 +01:00
|
|
|
<?php if ($this->hasPermission('monitoring/command/downtime/schedule')) {
|
|
|
|
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
|
|
|
if ($object->getType() === $object::TYPE_HOST) {
|
|
|
|
$scheduleDowntimeLink = $this->href(
|
|
|
|
'monitoring/host/schedule-downtime',
|
|
|
|
array('host' => $object->getName())
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$scheduleDowntimeLink = $this->href(
|
|
|
|
'monitoring/service/schedule-downtime',
|
|
|
|
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
|
|
|
|
);
|
|
|
|
}
|
2014-09-12 16:52:45 +02:00
|
|
|
?>
|
|
|
|
<a href="<?= $scheduleDowntimeLink ?>">
|
2015-01-23 09:43:16 +01:00
|
|
|
<?= $this->icon('plug') ?>
|
|
|
|
<?= $this->translate('Schedule downtime') ?>
|
2014-09-12 16:52:45 +02:00
|
|
|
</a>
|
2015-01-23 10:15:55 +01:00
|
|
|
<?php } else {
|
|
|
|
echo '-';
|
2015-01-23 11:01:47 +01:00
|
|
|
} // endif ?>
|
2014-09-12 16:52:45 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
2013-10-14 18:17:58 +02:00
|
|
|
|
2014-09-12 16:52:45 +02:00
|
|
|
<?php
|
2014-03-08 18:28:19 +01:00
|
|
|
|
|
|
|
foreach ($object->downtimes as $downtime) {
|
2014-09-12 16:52:45 +02:00
|
|
|
// Ticket hook sample
|
2015-01-23 09:45:43 +01:00
|
|
|
$commentText = $this->tickets ? preg_replace_callback(
|
2014-09-12 16:52:45 +02:00
|
|
|
$this->tickets->getPattern(),
|
|
|
|
array($this->tickets, 'createLink'),
|
|
|
|
$this->escape($downtime->comment)
|
|
|
|
) : $this->escape($downtime->comment);
|
|
|
|
|
|
|
|
if ((bool) $downtime->is_in_effect) {
|
2014-03-09 21:58:01 +01:00
|
|
|
$state = 'in downtime since ' . $this->timeSince($downtime->start);
|
2014-03-08 18:28:19 +01:00
|
|
|
} else {
|
2014-09-12 16:52:45 +02:00
|
|
|
if ((bool) $downtime->is_fixed) {
|
2014-05-29 12:38:59 +02:00
|
|
|
$state = 'scheduled ' . $this->timeUntil($downtime->start);
|
2014-03-08 18:28:19 +01:00
|
|
|
} else {
|
2014-05-29 12:38:59 +02:00
|
|
|
$state = 'scheduled flexible ' . $this->timeUntil($downtime->start);
|
2014-03-08 18:28:19 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-12 16:52:45 +02:00
|
|
|
?>
|
2014-03-21 19:56:55 +01:00
|
|
|
|
2014-09-12 16:52:45 +02:00
|
|
|
<tr>
|
|
|
|
<th><?= $this->escape($downtime->author) ?></th>
|
|
|
|
<td>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td style="vertical-align: top;" data-base-target="_self">
|
2015-01-22 17:35:34 +01:00
|
|
|
<?php if (isset($delDowntimeForm)) { // Form is unset if the current user lacks the respective permission
|
2015-01-23 09:43:16 +01:00
|
|
|
$delDowntimeForm = clone $delDowntimeForm;
|
|
|
|
$delDowntimeForm->populate(array('downtime_id' => $downtime->id));
|
|
|
|
echo $delDowntimeForm;
|
2015-01-22 17:35:34 +01:00
|
|
|
} ?>
|
|
|
|
<?= $state ?>
|
2014-09-12 16:52:45 +02:00
|
|
|
</td>
|
|
|
|
<td style="padding-left: .5em;">
|
2015-01-23 09:45:43 +01:00
|
|
|
<?= nl2br($commentText) ?>
|
2014-09-12 16:52:45 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2014-03-08 18:28:19 +01:00
|
|
|
|
2015-01-23 09:43:16 +01:00
|
|
|
<?php } // endforeach ?>
|