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 11:26:02 +02:00
|
|
|
$this->addHelperFunction('timeSincePrefix', function ($timestamp) {
|
|
|
|
return '<span class="timesince">'
|
|
|
|
. $this->translate(Format::timeSincePrefix($timestamp))
|
|
|
|
. ' </span>';
|
|
|
|
});
|
|
|
|
|
2014-03-17 17:14:16 +01:00
|
|
|
$this->addHelperFunction('timeUnless', function ($timestamp) {
|
|
|
|
if (! $timestamp) return '';
|
|
|
|
return '<span class="timeunless">'
|
|
|
|
. Format::timeUntil($timestamp)
|
|
|
|
. '</span>';
|
|
|
|
});
|
|
|
|
|
2014-05-29 11:26:02 +02:00
|
|
|
$this->addHelperFunction('timeUnlessPrefix', function ($timestamp) {
|
|
|
|
if (! $timestamp) return '';
|
|
|
|
return '<span class="timeunless">'
|
|
|
|
. $this->translate(Format::timeUntilPrefix($timestamp))
|
|
|
|
. '</span>';
|
|
|
|
});
|