37 lines
990 B
PHP
37 lines
990 B
PHP
<?php
|
|
|
|
namespace app\helpers;
|
|
|
|
use yii\helpers\Html;
|
|
use yii\helpers\Url;
|
|
|
|
class DepartmentGrid extends CommonGrid {
|
|
|
|
public static function pid($departmentArray) {
|
|
return function($model) use ($departmentArray) {
|
|
return isset($departmentArray[$model->pid]) ? $departmentArray[$model->pid] : "";
|
|
};
|
|
}
|
|
|
|
public static function checkbox() {
|
|
return function($model) {
|
|
if ($model->id == 1)
|
|
return "";
|
|
return "<input type='checkbox' value='{$model->id}' name='checkbox-department' class='checkbox-department'>";
|
|
};
|
|
}
|
|
|
|
public static function rows() {
|
|
return function($model, $index, $widget, $grid) {
|
|
return [
|
|
"onclick" => "common.form(this, 'department');",
|
|
"style" => "cursor: pointer;",
|
|
"data" => [
|
|
"href" => Url::to(["update", "id" => $model->id])
|
|
]
|
|
];
|
|
};
|
|
}
|
|
|
|
}
|