108 lines
3.2 KiB
PHP
108 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace app\helpers;
|
|
|
|
use Yii;
|
|
use yii\helpers\Html;
|
|
use yii\helpers\Url;
|
|
|
|
class CaptureLogsGrid {
|
|
|
|
static $path = "";
|
|
|
|
public static function path() {
|
|
return self::$path;
|
|
}
|
|
|
|
public static function engineNameFunc() {
|
|
return function ($data) {
|
|
return $data->app->app_name;
|
|
};
|
|
}
|
|
|
|
public static function getLayout() {
|
|
return "{items}<div class='row'><div class='col-md-4'>{summary}</div><div class='col-md-8 text-right'>{pager}</div></div>";
|
|
}
|
|
|
|
public static function actionTemplate() {
|
|
return "{update} {delete}";
|
|
}
|
|
|
|
public static function time() {
|
|
return function($model) {
|
|
return date("H:i:s d/m/Y", $model->time);
|
|
};
|
|
}
|
|
|
|
public static function image($process = false) {
|
|
return function($model) use ($process) {
|
|
$btn = "";
|
|
if ($process)
|
|
$btn = Html::button("<i class='fa fa-reply'></i>", [
|
|
"class" => "btn btn-info btn-xs",
|
|
"style" => "position:absolute;top:0;right:0;visibility: hidden;",
|
|
"data" => [
|
|
"toggle" => "tooltip",
|
|
"href" => Url::to(["/control-logs/use-feature", "id" => $model->id])
|
|
],
|
|
"title" => "Chuyển làm ảnh mẫu",
|
|
"onclick" => "_useFeature(this);"
|
|
]);
|
|
return "<div class='feature-img'>" . Html::img("/data/uploads/face/" . $model->image, [
|
|
"class" => "img-thumbnail",
|
|
"style" => "width: 150px;height:150px;"
|
|
]) . $btn . "</div>";
|
|
};
|
|
}
|
|
|
|
public static function status($statusArray) {
|
|
return function($model) use ($statusArray) {
|
|
return $statusArray[$model->status];
|
|
};
|
|
}
|
|
|
|
public static function confidence() {
|
|
return function($model) {
|
|
return number_format($model->confidence, 2);
|
|
};
|
|
}
|
|
|
|
public static function rows() {
|
|
return function($model, $index, $widget, $grid) {
|
|
return [
|
|
"ondblclick" => "_form(this);",
|
|
"style" => "cursor: pointer;",
|
|
"data" => [
|
|
"id" => $model->id,
|
|
"img" => "/data/uploads/face/" . $model->image
|
|
]
|
|
];
|
|
};
|
|
}
|
|
|
|
public static function birthday() {
|
|
return function($model) {
|
|
$staff = $model->listManagement;
|
|
if ($staff)
|
|
return date("d/m/Y", $staff->birthday);
|
|
return "";
|
|
};
|
|
}
|
|
|
|
public static function registrationImage() {
|
|
return function($model) {
|
|
$staff = $model->listManagement;
|
|
if ($staff) {
|
|
$images = json_decode($staff->image, true);
|
|
if (count($images) > 0)
|
|
return Html::img("/data/uploads/face/" . $images[count($images) - 1]['url'], [
|
|
"class" => "img-thumbnail",
|
|
"style" => "width: 150px;height:150px;"
|
|
]);
|
|
}
|
|
return "";
|
|
};
|
|
}
|
|
|
|
}
|