mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-28438 Aiken question import broken since MDL-24594.
This commit is contained in:
parent
7969f1ecf5
commit
45bdcf1134
@ -595,7 +595,9 @@ class qformat_default {
|
||||
$question->image = "";
|
||||
$question->usecase = 0;
|
||||
$question->multiplier = array();
|
||||
$question->questiontextformat = FORMAT_MOODLE;
|
||||
$question->generalfeedback = '';
|
||||
$question->generalfeedbackformat = FORMAT_MOODLE;
|
||||
$question->correctfeedback = '';
|
||||
$question->partiallycorrectfeedback = '';
|
||||
$question->incorrectfeedback = '';
|
||||
|
@ -76,12 +76,11 @@ class qformat_aiken extends qformat_default {
|
||||
}
|
||||
if (preg_match('/^[A-Z][).][ \t]/', $nowline)) {
|
||||
// A choice. Trim off the label and space, then save
|
||||
$question->answer[] = htmlspecialchars(trim(substr($nowline, 2)), ENT_NOQUOTES);
|
||||
$question->answer[] = $this->text_field(
|
||||
htmlspecialchars(trim(substr($nowline, 2)), ENT_NOQUOTES));
|
||||
$question->fraction[] = 0;
|
||||
$question->feedback[] = '';
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/^ANSWER:/', $nowline)) {
|
||||
$question->feedback[] = $this->text_field('');
|
||||
} else if (preg_match('/^ANSWER:/', $nowline)) {
|
||||
// The line that indicates the correct answer. This question is finised.
|
||||
$ans = trim(substr($nowline, strpos($nowline, ':') + 1));
|
||||
$ans = substr($ans, 0, 1);
|
||||
@ -97,15 +96,31 @@ class qformat_aiken extends qformat_default {
|
||||
// Must be the first line of a new question, since no recognised prefix.
|
||||
$question->qtype = MULTICHOICE;
|
||||
$question->name = shorten_text(s($nowline), 50);
|
||||
$question->questiontext = s($nowline);
|
||||
$question->questiontext = htmlspecialchars(trim($nowline), ENT_NOQUOTES);
|
||||
$question->questiontextformat = FORMAT_HTML;
|
||||
$question->generalfeedback = '';
|
||||
$question->generalfeedbackformat = FORMAT_HTML;
|
||||
$question->single = 1;
|
||||
$question->feedback[] = '';
|
||||
$question->answer = array();
|
||||
$question->fraction = array();
|
||||
$question->feedback = array();
|
||||
$question->correctfeedback = $this->text_field('');
|
||||
$question->partiallycorrectfeedback = $this->text_field('');
|
||||
$question->incorrectfeedback = $this->text_field('');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $questions;
|
||||
}
|
||||
|
||||
protected function text_field($text) {
|
||||
return array(
|
||||
'text' => htmlspecialchars(trim($text), ENT_NOQUOTES),
|
||||
'format' => FORMAT_HTML,
|
||||
'files' => array(),
|
||||
);
|
||||
}
|
||||
|
||||
public function readquestion($lines) {
|
||||
//this is no longer needed but might still be called by default.php
|
||||
return;
|
||||
|
@ -0,0 +1,11 @@
|
||||
The Moodle project was started by:
|
||||
A) Petr Skoda
|
||||
B) Martin Dougiamas
|
||||
C) Eloy Lafuente
|
||||
D) Tim Hunt
|
||||
ANSWER: B
|
||||
|
||||
Moodle's abilities include handling user input that includes <html class="cool"> & images:
|
||||
A) True
|
||||
B) False
|
||||
ANSWER: A
|
Loading…
x
Reference in New Issue
Block a user