-
Bug
-
Resolution: Won't Do
-
Minor
-
None
-
2.4
-
MOODLE_24_STABLE
I have an IMS CC package with a QTI assessment. The assessment has both questions and answers that contain HTML content, including images. The images in the question text import fine. The images in the answer does not. I've found that the code performs an extra step for the question than for the answers. The code change is very simple:
1. Edit the file: backup/cc/entity11.quiz.class.php
2. Locate the function: private function get_questions ($assessment, &$last_question_id, &$last_answer_id, $root_path, $is_question_bank)
3. Near the end of the function is a line that calls "get_answers": $questions[$question_identifier]['answers'] = $this->get_answers($question_identifier, $assessment, $last_answer_id);
4. Add the parameter "$root_path" like this: $questions[$question_identifier]['answers'] = $this->get_answers($question_identifier, $assessment, $last_answer_id, $root_path);
NOTE: this is safe because get_answers is private and this is the only place in the file where it gets called.
5. Locate the function: private function get_answers ($identifier, $assessment, &$last_answer_id)
6. Add the paramer "$root_path" to the parameter list: private function get_answers ($identifier, $assessment, &$last_answer_id, $root_path)
7. In "get_answers", there is a line that looks like this: $answer_title = !empty($answer_title->item(0)>nodeValue)? $answer_title>item(0)->nodeValue: '';
8. Replace that line with this block of code:
if(!empty($answer_title->item(0)->nodeValue))
else
{ $answer_title = ''; }I can provide sample test data. Email me at pcross@montereyinstitute.org. It's such a tiny and safe change I have not committed it to github but if you really insist, let me know.