示例#1
0
 public function actionIndex()
 {
     $model = new AdminUser();
     $filter = false;
     $sort = false;
     if (isset($_GET['AdminUser'])) {
         $filter = $_GET['AdminUser'];
         $model->attributes = $_GET['AdminUser'];
     }
     if (isset($_GET['sort'])) {
         $sort = $_GET['sort'];
     }
     $page = Yii::$app->request->get('page');
     $count = AdminUser::getCountUsers($filter);
     $pages = new CustomPagination(['limit' => 10, 'page' => $page, 'count' => $count]);
     $users = AdminUser::getUsers($filter, $sort, $pages->offset, $pages->limit);
     $th_array = [['id', 'ID'], [false, 'Аватар'], ['name', 'Ім\'я'], ['email', 'Email'], ['sex', 'Стать'], ['last_visit', 'Останній візит'], ['rating', 'Рейтинг'], [false, 'Видалити'], [false, 'Редагувати']];
     return $this->render('index', ['model' => $model, 'pages' => $pages, 'count' => $count, 'users' => $users, 'sort' => $sort, 'th_array' => $th_array]);
 }