weekly release 2.3dev (blame stronk7 for 0202 mistake)
[moodle.git] / question / type / missingtype / questiontype.php
CommitLineData
aeb15530 1<?php
d1b7e03d
TH
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
4eda4eec 16
4eda4eec 17/**
d1b7e03d 18 * Question type class for the 'missingtype' type.
4eda4eec 19 *
7764183a
TH
20 * @package qtype
21 * @subpackage missingtype
22 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
4eda4eec 24 */
4eda4eec 25
71534002 26
a17b297d
TH
27defined('MOODLE_INTERNAL') || die();
28
29
d1b7e03d
TH
30/**
31 * Missing question type class
32 *
33 * When we encounter a question of a type that is not currently installed, then
34 * we use this question type class instead so that some of the information about
35 * this question can be seen, and the rest of the system keeps working.
36 *
7764183a
TH
37 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
d1b7e03d
TH
39 */
40class qtype_missingtype extends question_type {
41 public function menu_name() {
a2156789 42 return false;
43 }
71534002 44
d1b7e03d 45 public function is_usable_by_random() {
a2156789 46 return false;
47 }
4eda4eec 48
d1b7e03d
TH
49 public function can_analyse_responses() {
50 return false;
51 }
71534002 52
d1b7e03d
TH
53 public function make_question($questiondata) {
54 $question = parent::make_question($questiondata);
55 $question->questiontext = html_writer::tag('div',
56 get_string('missingqtypewarning', 'qtype_missingtype'),
57 array('class' => 'warning missingqtypewarning')) .
58 $question->questiontext;
59 return $question;
4eda4eec 60 }
61
d1b7e03d
TH
62 public function make_deleted_instance($questionid, $maxmark) {
63 question_bank::load_question_definition_classes('missingtype');
64 $question = new qtype_missingtype_question();
65 $question->id = $questionid;
66 $question->category = null;
67 $question->parent = 0;
68 $question->qtype = question_bank::get_qtype('missingtype');
69 $question->name = get_string('deletedquestion', 'qtype_missingtype');
70 $question->questiontext = get_string('deletedquestiontext', 'qtype_missingtype');
71 $question->questiontextformat = FORMAT_HTML;
72 $question->generalfeedback = '';
73 $question->defaultmark = $maxmark;
74 $question->length = 1;
75 $question->penalty = 0;
76 $question->stamp = '';
77 $question->version = 0;
78 $question->hidden = 0;
79 $question->timecreated = null;
80 $question->timemodified = null;
81 $question->createdby = null;
82 $question->modifiedby = null;
83 return $question;
4eda4eec 84 }
71534002 85
d1b7e03d
TH
86 public function get_random_guess_score($questiondata) {
87 return null;
88 }
71534002 89
2b7c9bd2 90 public function display_question_editing_page(&$mform, $question, $wizardnow) {
94814340
TH
91 global $OUTPUT;
92 echo $OUTPUT->heading(get_string('warningmissingtype', 'qtype_missingtype'));
93
71534002 94 $mform->display();
71534002 95 }
4eda4eec 96}