mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-36243 question->questiontext and question->generalfeedback should always be strings
This commit is contained in:
parent
4bd6f71bad
commit
7980a381cc
7 changed files with 32 additions and 91 deletions
|
@ -390,20 +390,11 @@ class qformat_default {
|
|||
'maxfiles' => -1,
|
||||
'maxbytes' => 0,
|
||||
);
|
||||
if (is_array($question->questiontext)) {
|
||||
// Importing images from draftfile.
|
||||
$questiontext = $question->questiontext;
|
||||
$question->questiontext = $questiontext['text'];
|
||||
}
|
||||
if (is_array($question->generalfeedback)) {
|
||||
$generalfeedback = $question->generalfeedback;
|
||||
$question->generalfeedback = $generalfeedback['text'];
|
||||
}
|
||||
|
||||
$question->id = $DB->insert_record('question', $question);
|
||||
|
||||
if (!empty($questiontext['itemid'])) {
|
||||
$question->questiontext = file_save_draft_area_files($questiontext['itemid'],
|
||||
if (isset($question->questiontextitemid)) {
|
||||
$question->questiontext = file_save_draft_area_files($question->questiontextitemid,
|
||||
$this->importcontext->id, 'question', 'questiontext', $question->id,
|
||||
$fileoptions, $question->questiontext);
|
||||
} else if (isset($question->questiontextfiles)) {
|
||||
|
@ -412,8 +403,8 @@ class qformat_default {
|
|||
$this->importcontext, 'question', 'questiontext', $question->id, $file);
|
||||
}
|
||||
}
|
||||
if (!empty($generalfeedback['itemid'])) {
|
||||
$question->generalfeedback = file_save_draft_area_files($generalfeedback['itemid'],
|
||||
if (isset($question->generalfeedbackitemid)) {
|
||||
$question->generalfeedback = file_save_draft_area_files($question->generalfeedbackitemid,
|
||||
$this->importcontext->id, 'question', 'generalfeedback', $question->id,
|
||||
$fileoptions, $question->generalfeedback);
|
||||
} else if (isset($question->generalfeedbackfiles)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue