2014-03-17 17:14:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Icinga\Web\View;
|
|
|
|
|
|
|
|
use Icinga\Web\Url;
|
|
|
|
use Icinga\Util\Format;
|
|
|
|
|
|
|
|
$this->addHelperFunction('format', function () {
|
|
|
|
return Format::getInstance();
|
|
|
|
});
|
|
|
|
|
|
|
|
$this->addHelperFunction('timeSince', function ($timestamp) {
|
|
|
|
return '<span class="timesince">'
|
|
|
|
. Format::timeSince($timestamp)
|
|
|
|
. '</span>';
|
|
|
|
});
|
|
|
|
|
2014-05-29 13:03:10 +02:00
|
|
|
$this->addHelperFunction('prefixedTimeSince', function ($timestamp, $ucfirst = false) {
|
2014-05-29 11:26:02 +02:00
|
|
|
return '<span class="timesince">'
|
2014-05-29 13:03:10 +02:00
|
|
|
. Format::prefixedTimeSince($timestamp, $ucfirst)
|
2014-05-29 13:10:10 +02:00
|
|
|
. '</span>';
|
2014-05-29 11:26:02 +02:00
|
|
|
});
|
|
|
|
|
2014-05-29 12:38:59 +02:00
|
|
|
$this->addHelperFunction('timeUntil', function ($timestamp) {
|
2014-03-17 17:14:16 +01:00
|
|
|
if (! $timestamp) return '';
|
2014-05-29 12:38:59 +02:00
|
|
|
return '<span class="timeuntil">'
|
2014-03-17 17:14:16 +01:00
|
|
|
. Format::timeUntil($timestamp)
|
|
|
|
. '</span>';
|
|
|
|
});
|
|
|
|
|
2014-05-29 13:03:10 +02:00
|
|
|
$this->addHelperFunction('prefixedTimeUntil', function ($timestamp, $ucfirst = false) {
|
2014-05-29 11:26:02 +02:00
|
|
|
if (! $timestamp) return '';
|
2014-05-29 12:38:59 +02:00
|
|
|
return '<span class="timeuntil">'
|
2014-05-29 13:03:10 +02:00
|
|
|
. Format::prefixedTimeUntil($timestamp, $ucfirst)
|
2014-05-29 11:26:02 +02:00
|
|
|
. '</span>';
|
|
|
|
});
|