2021-10-29 17:06:09 +03:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace common\helpers;
|
|
|
|
|
|
2021-11-02 17:29:15 +03:00
|
|
|
|
use Yii;
|
2021-10-29 17:06:09 +03:00
|
|
|
|
use yii\helpers\ArrayHelper;
|
|
|
|
|
use yii\helpers\Html;
|
|
|
|
|
|
|
|
|
|
class TimeHelper
|
|
|
|
|
{
|
|
|
|
|
public static function limitTime($time_limit)
|
|
|
|
|
{
|
|
|
|
|
if ($time_limit === null)
|
|
|
|
|
{
|
2021-11-02 17:29:15 +03:00
|
|
|
|
return 'Не ограничено';
|
2021-10-29 17:06:09 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-02 17:29:15 +03:00
|
|
|
|
return Html::tag(
|
|
|
|
|
'span',
|
|
|
|
|
Yii::$app->formatter->asDuration(strtotime($time_limit, '0')),
|
|
|
|
|
['class' => 'label label-primary']
|
|
|
|
|
);
|
2021-10-29 17:06:09 +03:00
|
|
|
|
}
|
|
|
|
|
}
|