2014-03-08 18:28:19 +01:00
|
|
|
<?php
|
2013-10-14 18:17:58 +02:00
|
|
|
|
2014-03-08 18:28:19 +01:00
|
|
|
$cf = $this->getHelper('CommandForm');
|
2013-10-14 18:17:58 +02:00
|
|
|
|
2014-03-08 18:28:19 +01:00
|
|
|
$data = array('host' => $object->host_name);
|
|
|
|
if ($object->service_description) {
|
|
|
|
$data['service'] = $object->service_description;
|
|
|
|
}
|
2013-10-14 18:17:58 +02:00
|
|
|
|
2014-03-08 18:28:19 +01:00
|
|
|
|
|
|
|
$list = array();
|
|
|
|
foreach ($object->downtimes as $downtime) {
|
|
|
|
$deleteData = $data;
|
2014-03-09 21:58:01 +01:00
|
|
|
$deleteData['downtimeid'] = $downtime->id;
|
2014-03-08 18:28:19 +01:00
|
|
|
|
|
|
|
// TODO: This needs improvement
|
2014-03-09 21:58:01 +01:00
|
|
|
if ((int) $downtime->is_in_effect) {
|
|
|
|
$state = 'in downtime since ' . $this->timeSince($downtime->start);
|
2014-03-08 18:28:19 +01:00
|
|
|
} else {
|
2014-03-09 21:58:01 +01:00
|
|
|
if ($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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$iconForm = $cf->iconSubmitForm(
|
|
|
|
'img/icons/remove_petrol.png',
|
|
|
|
'Remove Downtime',
|
|
|
|
'link-like',
|
|
|
|
'removedowntime',
|
|
|
|
$deleteData
|
|
|
|
);
|
|
|
|
|
2014-03-21 19:56:55 +01:00
|
|
|
$text = $this->escape($downtime->comment);
|
|
|
|
|
2014-03-08 18:28:19 +01:00
|
|
|
$list[] = sprintf(
|
2014-03-25 09:45:51 +01:00
|
|
|
'<tr><th>%s</th><td data-base-target="_self">%s %s: %s</td></tr>',
|
2014-03-09 21:58:01 +01:00
|
|
|
$this->escape($downtime->author),
|
2014-03-21 19:56:55 +01:00
|
|
|
$iconForm,
|
2014-03-08 18:28:19 +01:00
|
|
|
$state,
|
2014-03-21 19:56:55 +01:00
|
|
|
$text
|
2014-03-08 18:28:19 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
<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>
|
2014-03-21 19:56:55 +01:00
|
|
|
<?= implode("\n", $list) ?>
|