init
This commit is contained in:
94
helpers/LogsGrid.php
Normal file
94
helpers/LogsGrid.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace app\helpers;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use app\models\common;
|
||||
|
||||
class LogsGrid {
|
||||
|
||||
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 plateIn() {
|
||||
return function($model) {
|
||||
$style = "width:50px";
|
||||
if ($model->mod_in == 1) {
|
||||
$style = "width:100%";
|
||||
}
|
||||
$image = $model->plate_image_in;
|
||||
if (!$image) {
|
||||
$image = $model->frame_image_in;
|
||||
$style = "width:100%";
|
||||
}
|
||||
return Html::img(Yii::$app->request->hostInfo . "/data/uploads/" . $image, [
|
||||
'class' => "img-thumbnail",
|
||||
"style" => $style
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
||||
public static function cardId() {
|
||||
return function($model) {
|
||||
if ($model->card_id != 0) {
|
||||
return sprintf("%06d", $model->card_id);
|
||||
} else {
|
||||
return "<i class='text-red'>Thẻ đã bị xóa!</i>";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static function plateOut() {
|
||||
return function($model) {
|
||||
if ($model->time_out) {
|
||||
$style = "width:50px";
|
||||
if ($model->mod_out == 1) {
|
||||
$style = "width:100%";
|
||||
}
|
||||
$image = $model->plate_image_out;
|
||||
if (!$image) {
|
||||
$image = $model->frame_image_out;
|
||||
$style = "width:100%";
|
||||
}
|
||||
return Html::img(Yii::$app->request->hostInfo . "/data/uploads/" . $image, [
|
||||
'class' => "img-thumbnail",
|
||||
"style" => $style
|
||||
]);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static function timeIn() {
|
||||
return function($model) {
|
||||
$common = new common();
|
||||
return $common->formatTime($model->time_in, "H:i:s d/m/Y");
|
||||
};
|
||||
}
|
||||
|
||||
public static function timeOut() {
|
||||
return function($model) {
|
||||
if ($model->time_out) {
|
||||
$common = new common();
|
||||
return $common->formatTime($model->time_out, "H:i:s d/m/Y");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user