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

52 lines
1.4 KiB
PHTML
Raw Normal View History

<?php
$cf = $this->getHelper('CommandForm');
$data = array('host' => $object->host_name);
if ($object->service_description) {
$data['service'] = $object->service_description;
}
$list = array();
foreach ($object->downtimes as $downtime) {
$deleteData = $data;
$deleteData['downtimeid'] = $object->downtime_internal_downtime_id;
// TODO: This needs improvement
if ((int) $downtime->downtime_is_in_effect) {
$state = 'in downtime since ' . $this->timeSince($downtime->downtime_start);
} else {
if ($downtime->downtime_is_fixed) {
$state = 'scheduled ' . $this->timeUnless($downtime->downtime_start);
} else {
$state = 'scheduled flexible ' . $this->timeUnless($downtime->downtime_start);
}
}
$iconForm = $cf->iconSubmitForm(
'img/icons/remove_petrol.png',
'Remove Downtime',
'link-like',
'removedowntime',
$deleteData
);
$list[] = sprintf(
"<br />%s [%s] (%s): %s\n",
$iconForm,
$this->escape($downtime->downtime_author),
$state,
$this->escape($downtime->downtime_comment)
);
}
?>
<tr>
<th><?= $this->translate('Downtimes') ?></th>
<td>
<a href="<?= $this->href('monitoring/command/scheduleDowntime', $data) ?>"><?= $this->icon('in_downtime_petrol.png') ?> <?= $this->translate('Schedule downtime') ?></a>
<?= implode('', $list) ?>
</td>
</tr>