public function actionSearch()
 {
     \Yii::$app->response->format = Response::FORMAT_JSON;
     $id = $this->helpGpost('id', '0');
     $name = $this->helpGpost('name', '');
     $page = $this->helpGpost('page', 1);
     $page = empty($page) ? 1 : $page;
     $conditions = [];
     if (!empty($id)) {
         $conditions['id'] = $id;
     }
     if (!empty($name)) {
         $conditions['name'] = $name;
     }
     $size = 9;
     $offset = ($page - 1) * $size;
     $orderby = 'id ASC';
     if (!empty($conditions) && isset($conditions['name']) && !empty($conditions['name'])) {
         $archive_name_arr = ['LIKE', 'name', $conditions['name']];
         unset($conditions['name']);
         $conditions[] = $archive_name_arr;
     }
     $position = new Position();
     $values = $position->getPositions($conditions, $offset, $size, $orderby);
     $pageHTML = $this->getPageHTML($page, $size, $values['total']);
     return ['positions' => $values['list'], 'pageHTML' => $pageHTML];
 }
 public function actionAdd()
 {
     $position = new Position();
     $positions = $position->getPositions(null, null, null, null, false);
     $positions = $positions['list'];
     $params = ['positions' => $positions];
     return $this->render('add', $params);
 }