Thomas Gelf ebbd4119c2 New approach for view helpers - register anonymous functions
* May be subject to change
* TODO: Find out how to phpDoc them
* Removed a bunch of "old-style" view helpers
* more to come
2014-03-17 17:14:16 +01:00

25 lines
535 B
PHP

<?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>';
});
$this->addHelperFunction('timeUnless', function ($timestamp) {
if (! $timestamp) return '';
return '<span class="timeunless">'
. Format::timeUntil($timestamp)
. '</span>';
});