2014-09-12 16:52:45 +02:00
|
|
|
<tr>
|
2015-02-23 17:27:45 +01:00
|
|
|
<th><?= $this->translate('Downtimes'); ?></th>
|
2014-09-12 16:52:45 +02:00
|
|
|
<td>
|
2015-01-23 10:15:55 +01:00
|
|
|
<?php if ($this->hasPermission('monitoring/command/downtime/schedule')) {
|
2015-03-12 13:39:17 +01:00
|
|
|
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
2015-01-23 10:15:55 +01:00
|
|
|
if ($object->getType() === $object::TYPE_HOST) {
|
2015-02-23 17:27:45 +01:00
|
|
|
echo $this->qlink(
|
2015-02-24 11:35:25 +01:00
|
|
|
$this->translate('Schedule downtime'),
|
2015-01-23 10:15:55 +01:00
|
|
|
'monitoring/host/schedule-downtime',
|
2015-04-09 10:27:41 +02:00
|
|
|
array('host_name' => $object->getName()),
|
2015-02-23 17:27:45 +01:00
|
|
|
array(
|
2015-02-24 11:35:25 +01:00
|
|
|
'icon' => 'plug',
|
2015-02-23 17:27:45 +01:00
|
|
|
'data-base-target' => '_self',
|
|
|
|
'title' => $this->translate(
|
|
|
|
'Schedule a downtime to suppress all problem notifications within a specific period of time'
|
|
|
|
)
|
2015-02-24 11:35:25 +01:00
|
|
|
)
|
2015-01-23 10:15:55 +01:00
|
|
|
);
|
|
|
|
} else {
|
2015-02-23 17:27:45 +01:00
|
|
|
echo $this->qlink(
|
2015-02-24 11:35:25 +01:00
|
|
|
$this->translate('Schedule downtime'),
|
2015-01-23 10:15:55 +01:00
|
|
|
'monitoring/service/schedule-downtime',
|
2015-04-09 10:28:34 +02:00
|
|
|
array('host_name' => $object->getHost()->getName(), 'service_description' => $object->getName()),
|
2015-02-23 17:27:45 +01:00
|
|
|
array(
|
2015-02-24 11:35:25 +01:00
|
|
|
'icon' => 'plug',
|
2015-02-23 17:27:45 +01:00
|
|
|
'data-base-target' => '_self',
|
|
|
|
'title' => $this->translate(
|
|
|
|
'Schedule a downtime to suppress all problem notifications within a specific period of time'
|
|
|
|
)
|
2015-02-24 11:35:25 +01:00
|
|
|
)
|
2015-01-23 10:15:55 +01:00
|
|
|
);
|
|
|
|
}
|
2015-02-23 17:27:45 +01:00
|
|
|
} else {
|
2015-01-23 10:15:55 +01:00
|
|
|
echo '-';
|
2015-02-23 17:27:45 +01:00
|
|
|
} ?>
|
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
|
|
|
?>
|
|
|
|
<tr>
|
2015-04-10 14:23:05 +02:00
|
|
|
<th><?= $this->escape($downtime->author_name); ?></th>
|
2015-03-13 08:32:39 +01:00
|
|
|
<td data-base-target="_self">
|
|
|
|
<?php if (isset($delDowntimeForm)) { // Form is unset if the current user lacks the respective permission
|
|
|
|
$delDowntimeForm = clone $delDowntimeForm;
|
|
|
|
$delDowntimeForm->populate(array('downtime_id' => $downtime->id));
|
|
|
|
echo $delDowntimeForm;
|
|
|
|
} ?>
|
|
|
|
<span class="sr-only"><?= $this->translate('Downtime'); ?></span><?= $state; ?><?= str_replace(array('\r\n', '\n'), '<br>', $commentText); ?>
|
2014-09-12 16:52:45 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
2015-01-23 09:43:16 +01:00
|
|
|
<?php } // endforeach ?>
|