MDL-8857
[moodle-linuxchix.git] / question / type / missingtype / questiontype.php
blobd91a136ce92f897ee107009ee42a109b55ace152
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.
16 class question_missingtype_qtype extends default_questiontype {
18 function name() {
19 return 'missingtype';
22 function menu_name() {
23 return false;
26 function is_usable_by_random() {
27 return false;
30 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) {
31 global $CFG;
33 $answers = &$question->options->answers;
35 $formatoptions = new stdClass;
36 $formatoptions->noclean = true;
37 $formatoptions->para = false;
39 // Print formulation
40 $questiontext = format_text($question->questiontext,
41 $question->questiontextformat,
42 $formatoptions, $cmoptions->course);
43 $image = get_question_image($question, $cmoptions->course);
45 // Print each answer in a separate row if there are any
46 $anss = array();
47 if ($answers) {
48 foreach ($answers as $answer) {
49 $a = new stdClass;
50 $a->text = format_text("$answer->answer", FORMAT_MOODLE, $formatoptions, $cmoptions->course);
52 $anss[] = clone($a);
55 include("$CFG->dirroot/question/type/missingtype/display.html");
58 function grade_responses(&$question, &$state, $cmoptions) {
59 return true;
62 function display_question_editing_page(&$mform, $question, $wizardnow){
64 print_heading(get_string('warningmissingtype', 'quiz'));
66 $mform->display();
70 //// END OF CLASS ////
72 //////////////////////////////////////////////////////////////////////////
73 //// INITIATION - Without this line the question type is not in use... ///
74 //////////////////////////////////////////////////////////////////////////
75 question_register_questiontype(new question_missingtype_qtype());