84 lines
2.4 KiB
PHP
84 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace app\helpers;
|
|
|
|
use Yii;
|
|
use yii\helpers\Html;
|
|
use yii\helpers\Url;
|
|
|
|
class ListManagementGrid {
|
|
|
|
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 birthday() {
|
|
return function($model) {
|
|
return date("d/m/Y", $model->birthday);
|
|
};
|
|
}
|
|
|
|
public static function image() {
|
|
return function($model) {
|
|
$images = json_decode($model->image, true);
|
|
$return = [];
|
|
foreach ($images as $key => $value) {
|
|
$removeBtn = Html::button("<i class='fa fa-remove'></i>", [
|
|
"class" => "btn btn-danger btn-xs",
|
|
"style" => "position:absolute;top:0;right:0;visibility: hidden;",
|
|
"onclick" => "_deleteFeature(this);",
|
|
"data-img" => $value['url'],
|
|
"data-id" => $model->id,
|
|
"data-href" => Url::to(["/list-management/delete-feature"])
|
|
]);
|
|
$return[] = "<div class='feature-img'>" . Html::img("/BiFace/data/uploads/face/" . $value['url'], [
|
|
"class" => "img-thumbnail",
|
|
"style" => "width: 100px;height:100px;"
|
|
]) . $removeBtn . "</div>";
|
|
}
|
|
return implode(" ", $return);
|
|
};
|
|
}
|
|
|
|
public static function type($typeArray) {
|
|
return function($model) use ($typeArray) {
|
|
return $typeArray[$model->type];
|
|
};
|
|
}
|
|
|
|
public static function rows() {
|
|
return function($model, $index, $widget, $grid) {
|
|
return [
|
|
"ondblclick" => "_menu(this);",
|
|
"style" => "cursor: pointer;",
|
|
"data" => [
|
|
"id" => $model->id
|
|
]
|
|
];
|
|
};
|
|
}
|
|
|
|
}
|