Пример #1
0
    function viewQuestionPage($user_id)
    {
        /*    $htmlPage = '
                       <table class="questions">
           			<tr>
           				<td style="width: 100%; text-align: left;"><b>Вопросы пользователей</b></td>
           				<td><b>Автор</b></td>
           				<!--<td><b>Ответов</b></td>-->
           				<td><b>Дата создания</b></td>
           			</tr>'; */
        $user_id = (int) $user_id;
        $questionModel = new QuestionModel();
        $aQuestions = $questionModel->loadWhere();
        $htmlPage = '<ul class="question-preview-list clearfix">';
        foreach ($aQuestions as $question) {
            /*    $htmlPage .= '
               			<tr id="cmod_tab2">
               				<td style="width: 100%; text-align: left;"><img height="14" width="14" id="ico2" src="'.$this->image_url.'faq.png"/> <a href="'.Project::getRequest()->createUrl('QuestionAnswer', 'ViewQuestion').'/'.$question['id'].'">'.$question['q_text'].'</a></td>
               				<td><a href="'.UserController::getProfileUrl($question['login']).'">'.$question['login'].'</a></td>
               				<!--<td>'.$question['a_count'].'</td>-->
               				<td>'.$question['creation_date'].'</td>
               			</tr>
                       '; */
            $htmlPage .= '<li>
							<dl>
								<dt><a href="' . UserController::getProfileUrl($question['login']) . '" class="with-icon-s"><i class="icon-s user-icon"></i>' . $question['login'] . '</a> спрашивает</dt>
								<dd class="question"><a href="' . Project::getRequest()->createUrl('QuestionAnswer', 'ViewQuestion') . '/' . $question['id'] . '">' . $question['q_text'] . '</a></dd>
								<dd class="reply"><a href="' . Project::getRequest()->createUrl('QuestionAnswer', 'ViewQuestion') . '/' . $question['id'] . '">' . $question['a_count'] . ' ответов</a></dd>
							</dl>
						</li>';
        }
        //    $htmlPage .= '</table>';
        $htmlPage .= '</ul>';
        return $htmlPage;
    }
Пример #2
0
 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);
 }
 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();
 }