+|
diff --git a/question/type/missingtype/display.html b/question/type/missingtype/display.html
new file mode 100644
index 00000000000..a8337066960
--- /dev/null
+++ b/question/type/missingtype/display.html
@@ -0,0 +1,24 @@
+Please alert your Moodle administrator.'); ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/question/type/missingtype/editquestion.html b/question/type/missingtype/editquestion.html
new file mode 100644
index 00000000000..85dfb37d681
--- /dev/null
+++ b/question/type/missingtype/editquestion.html
@@ -0,0 +1,127 @@
+
+
diff --git a/question/type/missingtype/editquestion.php b/question/type/missingtype/editquestion.php
new file mode 100644
index 00000000000..28710898c76
--- /dev/null
+++ b/question/type/missingtype/editquestion.php
@@ -0,0 +1,22 @@
+answers)) {
+ $answersraw = get_records_list("question_answers", "id", $options->answers);
+
+ }
+
+ $answers = array();
+ if (!empty($answersraw)) {
+ foreach ($answersraw as $answer) {
+ $answers[] = $answer; // insert answers into slots
+ }
+ }
+
+ $yesnooptions = array();
+ $yesnooptions[0] = get_string("no");
+ $yesnooptions[1] = get_string("yes");
+
+ print_heading_with_help(get_string("editingmissingtype", "quiz"), "multichoice", "quiz");
+ require("$CFG->dirroot/question/type/missingtype/editquestion.html");
+
+?>
diff --git a/question/type/missingtype/icon.gif b/question/type/missingtype/icon.gif
new file mode 100644
index 00000000000..d264c818ae5
Binary files /dev/null and b/question/type/missingtype/icon.gif differ
diff --git a/question/type/missingtype/questiontype.php b/question/type/missingtype/questiontype.php
new file mode 100644
index 00000000000..f759bbd6e29
--- /dev/null
+++ b/question/type/missingtype/questiontype.php
@@ -0,0 +1,57 @@
+options->answers;
+
+ $formatoptions = new stdClass;
+ $formatoptions->noclean = true;
+ $formatoptions->para = false;
+
+ // Print formulation
+ $questiontext = format_text($question->questiontext,
+ $question->questiontextformat,
+ $formatoptions, $cmoptions->course);
+ $image = get_question_image($question, $cmoptions->course);
+
+ // Print each answer in a separate row
+ foreach ($answers as $answer) {
+ $a->text = format_text("$answer->answer", FORMAT_MOODLE, $formatoptions, $cmoptions->course);
+
+ $anss[] = clone($a);
+ }
+ include("$CFG->dirroot/question/type/missingtype/display.html");
+ }
+
+ function grade_responses(&$question, &$state, $cmoptions) {
+ return true;
+ }
+}
+//// END OF CLASS ////
+
+//////////////////////////////////////////////////////////////////////////
+//// INITIATION - Without this line the question type is not in use... ///
+//////////////////////////////////////////////////////////////////////////
+$QTYPES['missingtype']= new question_missingtype_qtype();
+
+?>
diff --git a/question/type/question.html b/question/type/question.html
index 83b73a280ec..8e438da4553 100644
--- a/question/type/question.html
+++ b/question/type/question.html
@@ -3,7 +3,7 @@
* print_question() method.
*/
?>
-
+|
diff --git a/question/type/questiontype.php b/question/type/questiontype.php
index e70d93ebcd4..cf9c6f6efd3 100644
--- a/question/type/questiontype.php
+++ b/question/type/questiontype.php
@@ -126,10 +126,7 @@ class default_questiontype {
* it is not a standard question object.
*/
function save_question_options($question) {
- /// This default implementation must be overridden:
-
- $result->error = "Unsupported question type ($question->qtype)!";
- return $result;
+ return null;
}
/**
@@ -330,9 +327,11 @@ class default_questiontype {
function get_correct_responses(&$question, &$state) {
/* The default implementation returns the response for the first answer
that gives full marks. */
- foreach ($question->options->answers as $answer) {
- if (((int) $answer->fraction) === 1) {
- return array('' => $answer->answer);
+ if ($question->options->answers) {
+ foreach ($question->options->answers as $answer) {
+ if (((int) $answer->fraction) === 1) {
+ return array('' => $answer->answer);
+ }
}
}
return null;
|
|
|
|