change time widget in question and questionnaire forms
This commit is contained in:
@ -22,7 +22,7 @@ class AnswerHelper
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function statusLabel($status): string
|
||||
public static function answerStatusLabel($status): string
|
||||
{
|
||||
switch ($status) {
|
||||
case self::FLAG_FALSE:
|
||||
@ -39,4 +39,27 @@ class AnswerHelper
|
||||
'class' => $class,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function answerFlagLable($answer_flag)
|
||||
{
|
||||
$class = 'label label-warning';
|
||||
$content = 'Не проверен';
|
||||
|
||||
if ($answer_flag > 0)
|
||||
{
|
||||
$class = 'label label-success';
|
||||
$answer_flag < 1 ? $content = $answer_flag *100 . '%' : $content = 'Верен';
|
||||
}
|
||||
else if ($answer_flag === 0.0)
|
||||
{
|
||||
$class = 'label label-danger';
|
||||
$content = 'Не верен';
|
||||
}
|
||||
|
||||
return Html::tag('span', $content,
|
||||
[
|
||||
'class' => $class,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace common\helpers;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
|
||||
@ -11,13 +12,13 @@ class TimeHelper
|
||||
{
|
||||
if ($time_limit === null)
|
||||
{
|
||||
return 'Не ограниченоTEST';
|
||||
return 'Не ограничено';
|
||||
}
|
||||
|
||||
return date("H:i:s", mktime(null, null, $time_limit)) . ' (HH:mm:ss)';
|
||||
|
||||
// $date
|
||||
// return Html::tag('span', $date, ['class' => 'label label-primary']);
|
||||
return Html::tag(
|
||||
'span',
|
||||
Yii::$app->formatter->asDuration(strtotime($time_limit, '0')),
|
||||
['class' => 'label label-primary']
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user