Skip to content
Browse files

MDL-35147 lesson qformat import: Dirty hack to support array question…

…text structures.
  • Loading branch information...
1 parent f1f174e commit 4c6b8659f963b04f6c8aed91aca215e784086acc @stronk7 stronk7 committed Aug 30, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 mod/lesson/format.php
View
9 mod/lesson/format.php
@@ -384,6 +384,15 @@ function importprocess($filename, $lesson, $pageid) {
$newpage->title = "Page $count";
}
$newpage->contents = $question->questiontext;
+ $newpage->contentsformat = isset($question->questionformat) ? $question->questionformat : FORMAT_HTML;
+
+ // Sometimes, questiontext is not a simple text, but one array
+ // containing both text and format, so we need to support here
+ // that case with the following dirty patch. MDL-35147
+ if (is_array($question->questiontext)) {
+ $newpage->contents = isset($question->questiontext['text']) ? $question->questiontext['text'] : '';
+ $newpage->contentsformat = isset($question->questiontext['format']) ? $question->questiontext['format'] : FORMAT_HTML;
+ }
// set up page links
if ($pageid) {

0 comments on commit 4c6b865

Please sign in to comment.
Something went wrong with that request. Please try again.