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