public function QuestionListAction() { $request = Project::getRequest(); $param = $request->getKeys(); array_shift($param); $data = array(); $question_model = new QuestionModel(); $question_cat_model = new QuestionCatModel(); if ($request->getKeyByNumber(0) > 0) { $tag_model = new QuestionTagModel(); $data['tag_list'] = $tag_model->loadTags($request->getKeyByNumber(0)); } $data['cat_list'] = $question_cat_model->loadAll(); $pager = new DbPager($request->pn, 20); //TODO: pageSize $question_model->setPager($pager); $data['question_list'] = $question_model->loadWhere($request->getKeyByNumber(0), $request->getKeyByNumber(1)); $pager_view = new SitePagerView(); $data['pager'] = $pager_view->show($question_model->getPager(), 'AdminQuestionAnswer', 'QuestionList', $param); $this->BaseAdminData(); $this->_view->QuestionList($data); $this->_view->parse(); }
protected function _list(&$data, $action, $catId = null, $tagId = null, $userId = null, $order = null, $sort_type = null, $sort = null) { $param = Project::getRequest()->getKeys(); array_shift($param); $question_model = new QuestionModel(); $question_cat_model = new QuestionCatModel(); if ($catId > 0) { $tag_model = new QuestionTagModel(); $data['question_tag_list'] = $tag_model->loadTags($catId); } $v_request = Project::getRequest(); $v_session = Project::getSession(); $request_keys = $v_request->getKeys(); $questions_per_page = $request_keys['qpp']; if ($questions_per_page) { if (in_array($questions_per_page, array(10, 20, 30))) { $v_session->add('qpp', $questions_per_page); $v_list_per_page = $questions_per_page; } else { $v_list_per_page = 10; $v_session->add('qpp', $v_list_per_page); } } else { if ($v_session->getKey('qpp')) { $v_list_per_page = $v_session->getKey('qpp'); } else { $v_list_per_page = 10; } } //$pager = new DbPager($request->pn, 20); //TODO: pageSize $pager = new DbPager($request->pn, $v_list_per_page); $question_model->setPager($pager); $data['question_list'] = $question_model->loadWhere($catId, $tagId, $userId, $order, $sort_type, $sort); $data['question_cat_list'] = $question_cat_model->loadAll(); $pager_view = new SitePagerView(); $data['question_list_pager'] = $pager_view->show2($question_model->getPager(), 'QuestionAnswer', $action, $param); }