app->app_name;
};
}
public static function getLayout() {
return "{items}
";
}
public static function actionTemplate() {
return "{update} {delete}";
}
public static function createdAt() {
return function($model) {
$common = new common();
return $common->formatTime($model->created_at, "H:i d/m/Y");
};
}
public static function modifiedAt() {
return function($model) {
$common = new common();
return $common->formatTime($model->modified_at, "H:i d/m/Y");
};
}
public static function update($obj) {
return function($url, $model) use ($obj) {
return Html::button("", [
'class' => 'btn btn-success btn-xs',
'data' => ['toggle' => 'tooltip', 'href' => Url::to(['update', 'id' => $model->id])],
'title' => Yii::t('app', 'Chỉnh sửa'),
'onclick' => "common.form(this, '{$obj}');"
]);
};
}
public static function delete($deleteConfirmMess) {
return function($url, $model) use ($deleteConfirmMess) {
return Html::a('', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger btn-xs',
'title' => Yii::t("app", "Xóa"),
'data' => [
'toggle' => 'tooltip',
'confirm' => $deleteConfirmMess,
'method' => 'post'
]
]);
};
}
public static function checkbox($type, $haveRoot = true) {
return function($model) use ($type, $haveRoot) {
if ($model->id == 1 && $haveRoot)
return "";
return "";
};
}
public static function rows($type, $bigSize = false) {
return function($model, $index, $widget, $grid) use ($type, $bigSize) {
if (!\Yii::$app->user->can($type . "Update"))
return [];
return [
"ondblclick" => "common.form(this, '{$type}', {$bigSize});",
"style" => "cursor: pointer;",
"data" => [
"href" => Url::to(["update", "id" => $model->id])
]
];
};
}
public static function pid($array) {
return function($model) use ($array) {
return isset($array[$model->pid]) ? $array[$model->pid] : "";
};
}
}