/** * Build the Survey Questions * @param int $courseId Internal course ID */ public function build_survey_questions($courseId) { $table_que = Database::get_course_table(TABLE_SURVEY_QUESTION); $table_opt = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION); $sql = 'SELECT * FROM ' . $table_que . ' WHERE c_id = ' . $courseId . ' '; $db_result = Database::query($sql); while ($obj = Database::fetch_object($db_result)) { $question = new SurveyQuestion($obj->question_id, $obj->survey_id, $obj->survey_question, $obj->survey_question_comment, $obj->type, $obj->display, $obj->sort, $obj->shared_question_id, $obj->max_value); $sql = 'SELECT * FROM ' . $table_opt . ' WHERE c_id = ' . $courseId . ' AND question_id = ' . $obj->question_id; $db_result2 = Database::query($sql); while ($obj2 = Database::fetch_object($db_result2)) { $question->add_answer($obj2->option_text, $obj2->sort); } $this->course->add_resource($question); } }