Ejemplo n.º 1
0
 public function get_all_question()
 {
     // return "helloword23333333";
     if ($result = $this->fetch_all('question', "", "update_time DESC")) {
         foreach ($result as $key => $val) {
             $data[$key]['question_info'] = $val;
             // here should parse answer_content for get img url directly by anxiang.xiao 20150827
             $data[$key]['question_info']['question_detail'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs2(nl2br(FORMAT::parse_bbcode($data[$key]['question_info']['question_detail']))));
             $data[$key]['question_publish_user_info'] = $this->fetch_row('users', 'uid = ' . $val['published_uid']);
             if ($data[$key]['question_publish_user_info']['avatar_file']) {
                 $data[$key]['question_publish_user_info']['avatar_file'] = get_avatar_url($data[$key]['question_publish_user_info']['uid'], 'min');
             }
             $data[$key]['category_info'] = $this->fetch_row('category', 'id = ' . $val['category_id']);
             $data[$key]['question_newest_answer_info'] = $this->fetch_row('answer', 'question_id = ' . $val['question_id'], "add_time DESC");
             /*
             				 *
             				 * $data[$key]['question_info'] = $val;
             
             if ($val['published_uid'] != 0)
             $data[$key]['question_publish_user_info'] =  $this->fetch_row('users','uid = ' .$val['published_uid'] );
             else
             $data[$key]['question_publish_user_info'] =  "{}";
             
             if ($val['category_id'] != 0)
             $data[$key]['category_info'] =  $this->fetch_row('category','id = ' .$val['category_id'] );
             else
             $data[$key]['category_info'] =  "{}";
             */
         }
         return $data;
         // return  $posts_index;
     }
 }
Ejemplo n.º 2
0
 public function get_answer_info_action()
 {
     if (isset($_GET['answer_id'])) {
         $answer_id = trim($_GET['answer_id']);
     }
     $question_answer = $this->model('test')->get_answer_by_id($answer_id);
     // here should parse answer_content for get img url directly by anxiang.xiao 20150827
     $question_answer['answer_content'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs2(nl2br(FORMAT::parse_bbcode($question_answer['answer_content']))));
     echo json_encode($array = array("value" => $question_answer));
 }