Línea 51... |
Línea 51... |
51 |
}
|
51 |
}
|
Línea 52... |
Línea 52... |
52 |
|
52 |
|
53 |
public function save_defaults_for_new_questions(stdClass $fromform): void {
|
53 |
public function save_defaults_for_new_questions(stdClass $fromform): void {
|
54 |
parent::save_defaults_for_new_questions($fromform);
|
54 |
parent::save_defaults_for_new_questions($fromform);
|
- |
|
55 |
$this->set_default_value('shuffleanswers', $fromform->shuffleanswers);
|
55 |
$this->set_default_value('shuffleanswers', $fromform->shuffleanswers);
|
56 |
$this->set_default_value('dropzonevisibility', $fromform->dropzonevisibility);
|
Línea 56... |
Línea 57... |
56 |
}
|
57 |
}
|
57 |
|
58 |
|
58 |
public function save_question_options($formdata) {
|
59 |
public function save_question_options($formdata) {
|
Línea 68... |
Línea 69... |
68 |
$options->incorrectfeedback = '';
|
69 |
$options->incorrectfeedback = '';
|
69 |
$options->id = $DB->insert_record('qtype_ddimageortext', $options);
|
70 |
$options->id = $DB->insert_record('qtype_ddimageortext', $options);
|
70 |
}
|
71 |
}
|
Línea 71... |
Línea 72... |
71 |
|
72 |
|
- |
|
73 |
$options->shuffleanswers = !empty($formdata->shuffleanswers);
|
72 |
$options->shuffleanswers = !empty($formdata->shuffleanswers);
|
74 |
$options->dropzonevisibility = !empty($formdata->dropzonevisibility);
|
73 |
$options = $this->save_combined_feedback_helper($options, $formdata, $context, true);
|
75 |
$options = $this->save_combined_feedback_helper($options, $formdata, $context, true);
|
74 |
$this->save_hints($formdata, true);
|
76 |
$this->save_hints($formdata, true);
|
75 |
$DB->update_record('qtype_ddimageortext', $options);
|
77 |
$DB->update_record('qtype_ddimageortext', $options);
|
76 |
$DB->delete_records('qtype_ddimageortext_drops', array('questionid' => $formdata->id));
|
78 |
$DB->delete_records('qtype_ddimageortext_drops', array('questionid' => $formdata->id));
|
Línea 183... |
Línea 185... |
183 |
$output = '';
|
185 |
$output = '';
|
Línea 184... |
Línea 186... |
184 |
|
186 |
|
185 |
if ($question->options->shuffleanswers) {
|
187 |
if ($question->options->shuffleanswers) {
|
186 |
$output .= " <shuffleanswers/>\n";
|
188 |
$output .= " <shuffleanswers/>\n";
|
- |
|
189 |
}
|
- |
|
190 |
if ($question->options->dropzonevisibility) {
|
- |
|
191 |
$output .= " <dropzonevisibility/>\n";
|
187 |
}
|
192 |
}
|
188 |
$output .= $format->write_combined_feedback($question->options,
|
193 |
$output .= $format->write_combined_feedback($question->options,
|
189 |
$question->id,
|
194 |
$question->id,
|
190 |
$question->contextid);
|
195 |
$question->contextid);
|
191 |
$files = $fs->get_area_files($contextid, 'qtype_ddimageortext', 'bgimage', $question->id);
|
196 |
$files = $fs->get_area_files($contextid, 'qtype_ddimageortext', 'bgimage', $question->id);
|
Línea 225... |
Línea 230... |
225 |
$question = $format->import_headers($data);
|
230 |
$question = $format->import_headers($data);
|
226 |
$question->qtype = 'ddimageortext';
|
231 |
$question->qtype = 'ddimageortext';
|
Línea 227... |
Línea 232... |
227 |
|
232 |
|
228 |
$question->shuffleanswers = array_key_exists('shuffleanswers',
|
233 |
$question->shuffleanswers = array_key_exists('shuffleanswers',
|
- |
|
234 |
$format->getpath($data, array('#'), array()));
|
- |
|
235 |
$question->dropzonevisibility = array_key_exists('dropzonevisibility',
|
Línea 229... |
Línea 236... |
229 |
$format->getpath($data, array('#'), array()));
|
236 |
$format->getpath($data, ['#'], []));
|
230 |
|
237 |
|
231 |
$filexml = $format->getpath($data, array('#', 'file'), array());
|
238 |
$filexml = $format->getpath($data, array('#', 'file'), array());
|
232 |
$question->bgimage = $format->import_files_as_draft($filexml);
|
239 |
$question->bgimage = $format->import_files_as_draft($filexml);
|