weekly version bump
[moodle.git] / question / type / missingtype / questiontype.php
CommitLineData
aeb15530 1<?php
4eda4eec 2
3///////////////////
4/// missingtype ///
5///////////////////
6
7/// QUESTION TYPE CLASS //////////////////
8
9/**
10 * Missing question type class
11 *
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.
1976496e 15 * @package questionbank
16 * @subpackage questiontypes
4eda4eec 17 */
18class question_missingtype_qtype extends default_questiontype {
19
20 function name() {
21 return 'missingtype';
22 }
71534002 23
a2156789 24 function menu_name() {
25 return false;
26 }
71534002 27
a2156789 28 function is_usable_by_random() {
29 return false;
30 }
4eda4eec 31
32 function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) {
33 global $CFG;
34
35 $answers = &$question->options->answers;
36
37 $formatoptions = new stdClass;
38 $formatoptions->noclean = true;
39 $formatoptions->para = false;
40
41 // Print formulation
42 $questiontext = format_text($question->questiontext,
43 $question->questiontextformat,
44 $formatoptions, $cmoptions->course);
4eda4eec 45
2be604b6 46 // Print each answer in a separate row if there are any
47 $anss = array();
48 if ($answers) {
49 foreach ($answers as $answer) {
d7444d44 50 $a = new stdClass;
a9efae50 51 $a->text = format_text($answer->answer, $answer->answerformat, $formatoptions, $cmoptions->course);
71534002 52
2be604b6 53 $anss[] = clone($a);
54 }
4eda4eec 55 }
56 include("$CFG->dirroot/question/type/missingtype/display.html");
57 }
58
59 function grade_responses(&$question, &$state, $cmoptions) {
60 return true;
61 }
71534002 62
63 function display_question_editing_page(&$mform, $question, $wizardnow){
723d610c 64 global $OUTPUT;
65 echo $OUTPUT->heading(get_string('warningmissingtype', 'qtype_missingtype'));
71534002 66
67 $mform->display();
68
69 }
4eda4eec 70}
71//// END OF CLASS ////
72
73//////////////////////////////////////////////////////////////////////////
74//// INITIATION - Without this line the question type is not in use... ///
75//////////////////////////////////////////////////////////////////////////
a2156789 76question_register_questiontype(new question_missingtype_qtype());
4eda4eec 77
aeb15530 78