61 lines
1.8 KiB
PHTML
61 lines
1.8 KiB
PHTML
<?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'] = $downtime->id;
|
|
|
|
// TODO: This needs improvement
|
|
if ((int) $downtime->is_in_effect) {
|
|
$state = 'in downtime since ' . $this->timeSince($downtime->start);
|
|
} else {
|
|
if ($downtime->is_fixed) {
|
|
$state = 'scheduled ' . $this->timeUntil($downtime->start);
|
|
} else {
|
|
$state = 'scheduled flexible ' . $this->timeUntil($downtime->start);
|
|
}
|
|
}
|
|
|
|
// $iconForm = $cf->iconSubmitForm(
|
|
// 'img/icons/remove_petrol.png',
|
|
$iconForm = $cf->labelSubmitForm(
|
|
'X',
|
|
'Remove Downtime',
|
|
'link-like',
|
|
'removedowntime',
|
|
$deleteData
|
|
);
|
|
|
|
// Ticket hook sample
|
|
$text = $this->tickets ? preg_replace_callback(
|
|
$this->tickets->getPattern(),
|
|
array($this->tickets, 'createLink'),
|
|
$this->escape($downtime->comment)
|
|
) : $this->escape($downtime->comment);
|
|
|
|
$list[] = sprintf(
|
|
'<tr><th>%s</th><td><table><tr><td style="vertical-align: top;" data-base-target="_self">%s %s:</td><td style="padding-left: .5em;">%s</td></tr></table></td></tr>',
|
|
$this->escape($downtime->author),
|
|
$iconForm,
|
|
$state,
|
|
str_replace(array('\r\n', '\n'), '<br>', $text)
|
|
);
|
|
}
|
|
|
|
?>
|
|
<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>
|
|
</td>
|
|
</tr>
|
|
<?= implode("\n", $list) ?>
|