Permalink
Browse files

Merge branch 'MDL-32865_22' of git://github.com/jmvedrine/moodle into…

… MOODLE_22_STABLE
  • Loading branch information...
2 parents 774530f + 1d5c830 commit 80b7e5deb64b5ca871c32e18c5d4df4ce1754998 @danpoltawski danpoltawski committed Nov 20, 2012
Showing with 15 additions and 1 deletion.
  1. +15 −1 question/format/xml/format.php
@@ -440,7 +440,21 @@ public function import_multianswer($question) {
$qo->name = $this->clean_question_name($this->import_text($question['#']['name'][0]['#']['text']));
$qo->questiontextformat = $questiontext['format'];
$qo->questiontext = $qo->questiontext['text'];
- $qo->questiontextfiles = array();
+ $qo->questiontextfiles = $this->import_files($this->getpath($question,
+ array('#', 'questiontext', 0, '#', 'file'), array(), false));
+
+ // Backwards compatibility, deal with the old image tag.
+ $filedata = $this->getpath($question, array('#', 'image_base64', '0', '#'), null, false);
+ $filename = $this->getpath($question, array('#', 'image', '0', '#'), null, false);
+ if ($filedata && $filename) {
+ $data = new stdClass();
+ $data->content = $filedata;
+ $data->encoding = 'base64';
+ // Question file areas don't support subdirs, so convert path to filename if necessary.
+ $data->name = clean_param(str_replace('/', '_', $filename), PARAM_FILE);
+ $qo->questiontextfiles[] = $data;
+ $qo->questiontext .= ' <img src="@@PLUGINFILE@@/' . $data->name . '" />';
+ }
// restore files in generalfeedback
$qo->generalfeedback = $this->getpath($question,

0 comments on commit 80b7e5d

Please sign in to comment.