コード例 #1
0
ファイル: MajorController.php プロジェクト: xw716825/git_back
 public function listAction($col_id)
 {
     //当前页码
     $page_id = (int) $this->request->getQuery('page');
     $page_id = $page_id < 1 ? 1 : $page_id;
     //专业学科
     $category = (int) $this->request->getQuery('category');
     //专业类别
     $parent = (int) $this->request->getQuery('parent');
     //关键字
     $keyword = preg_replace('/[^\\da-z\\x{4e00}-\\x{9fa5}]/iu', '', mb_substr($this->request->getQuery('keyword'), 0, 10, 'utf-8'));
     //关键字长度小于10,并且只能是字符数字中文
     //每页显示条数
     $limit = 20;
     //省市区县
     $major = new \Major();
     $categorys = $major->getCategory();
     //学科
     $major_parent = $major->getParent($category);
     //类别
     //学校
     $college = (new \College())->getDetail($col_id);
     //查询数据
     $list = (new \Major())->getList($col_id, $page_id, $limit, $category, $parent, $keyword);
     //数据
     $page_html = $this->pageHtml($list['page']);
     //分页html
     //加载js
     $this->assets->addJs('backend/mt-js/major-list.js');
     $this->view->setLayout('college');
     $this->view->setVars(['col_id' => $col_id, 'college' => $college, 'category' => $category, 'parent' => $parent, 'keyword' => $keyword, 'categorys' => $categorys, 'major_parent' => $major_parent, 'list' => $list['list'], 'page_html' => $page_html]);
 }