Skip to content

Commit

Permalink
Use new DateTimeRenderer helpers while displaying downtimes
Browse files Browse the repository at this point in the history
refs #6778
  • Loading branch information
Al2Klimov committed Dec 2, 2014
1 parent 50e5a8c commit a5b28d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
15 changes: 5 additions & 10 deletions modules/monitoring/application/views/scripts/list/downtimes.phtml
Expand Up @@ -33,16 +33,11 @@
<td class="state">
<strong><?= $downtime->is_in_effect ? $this->translate('Expires') : $this->translate('Starts'); ?></strong>
<br>
<?=
$this->dateTimeRenderer(
($downtime->is_in_effect ? $downtime->end : $downtime->start),
true
)->render(
$this->translate('on %s', 'datetime'),
$this->translate('at %s', 'time'),
$this->translate('in %s', 'timespan')
);
?>
<?= $this->timePointFuture(
$downtime->is_in_effect ?
$downtime->end :
$downtime->start
) ?>
</td>
<td>
<?php if (isset($downtime->service)): ?>
Expand Down
Expand Up @@ -37,11 +37,11 @@ foreach ($object->downtimes as $downtime):
$form->populate(array('downtime_id' => $downtime->id));

if ((bool) $downtime->is_in_effect) {
$state = 'in downtime since ' . $this->timeSince($downtime->start);
$state = 'in downtime ' . $this->timeSpanPast($downtime->start);
} else {
$state = 'scheduled ' . (
(bool) $downtime->is_fixed ? '' : 'flexible '
) . $this->timeUntil($downtime->start);
$state = (
((bool) $downtime->is_fixed) ? 'scheduled ' : 'scheduled flexible '
) . $this->timePointFuture($downtime->start);
}

?>
Expand Down

0 comments on commit a5b28d1

Please sign in to comment.