Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / question / type / missingtype / questiontype.php
blob1bbdcf6d41ae0a268d4eab82afb30b67ff0cec56
1 <?php // $Id$
3 ///////////////////
4 /// missingtype ///
5 ///////////////////
7 /// QUESTION TYPE CLASS //////////////////
9 /**
10 * Missing question type class
12 * When a question is encountered with a type that is not installed then its
13 * type is changed to 'missingtype'. This questiontype just makes sure that the
14 * necessary information is printed about the question.
15 * @package questionbank
16 * @subpackage questiontypes
18 class question_missingtype_qtype extends default_questiontype {
20 function name() {
21 return 'missingtype';
24 function menu_name() {
25 return false;
28 function is_usable_by_random() {
29 return false;
32 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) {
33 global $CFG;
35 $answers = &$question->options->answers;
37 $formatoptions = new stdClass;
38 $formatoptions->noclean = true;
39 $formatoptions->para = false;
41 // Print formulation
42 $questiontext = format_text($question->questiontext,
43 $question->questiontextformat,
44 $formatoptions, $cmoptions->course);
45 $image = get_question_image($question);
47 // Print each answer in a separate row if there are any
48 $anss = array();
49 if ($answers) {
50 foreach ($answers as $answer) {
51 $a = new stdClass;
52 $a->text = format_text("$answer->answer", FORMAT_MOODLE, $formatoptions, $cmoptions->course);
54 $anss[] = clone($a);
57 include("$CFG->dirroot/question/type/missingtype/display.html");
60 function grade_responses(&$question, &$state, $cmoptions) {
61 return true;
64 function display_question_editing_page(&$mform, $question, $wizardnow){
66 print_heading(get_string('warningmissingtype', 'quiz'));
68 $mform->display();
72 //// END OF CLASS ////
74 //////////////////////////////////////////////////////////////////////////
75 //// INITIATION - Without this line the question type is not in use... ///
76 //////////////////////////////////////////////////////////////////////////
77 question_register_questiontype(new question_missingtype_qtype());