|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00027 defined('MOODLE_INTERNAL') || die(); 00028 00029 00040 class qtype_missingtype extends question_type { 00041 public function menu_name() { 00042 return false; 00043 } 00044 00045 public function is_usable_by_random() { 00046 return false; 00047 } 00048 00049 public function can_analyse_responses() { 00050 return false; 00051 } 00052 00053 public function make_question($questiondata) { 00054 $question = parent::make_question($questiondata); 00055 $question->questiontext = html_writer::tag('div', 00056 get_string('missingqtypewarning', 'qtype_missingtype'), 00057 array('class' => 'warning missingqtypewarning')) . 00058 $question->questiontext; 00059 return $question; 00060 } 00061 00062 public function make_deleted_instance($questionid, $maxmark) { 00063 question_bank::load_question_definition_classes('missingtype'); 00064 $question = new qtype_missingtype_question(); 00065 $question->id = $questionid; 00066 $question->category = null; 00067 $question->parent = 0; 00068 $question->qtype = question_bank::get_qtype('missingtype'); 00069 $question->name = get_string('deletedquestion', 'qtype_missingtype'); 00070 $question->questiontext = get_string('deletedquestiontext', 'qtype_missingtype'); 00071 $question->questiontextformat = FORMAT_HTML; 00072 $question->generalfeedback = ''; 00073 $question->defaultmark = $maxmark; 00074 $question->length = 1; 00075 $question->penalty = 0; 00076 $question->stamp = ''; 00077 $question->version = 0; 00078 $question->hidden = 0; 00079 $question->timecreated = null; 00080 $question->timemodified = null; 00081 $question->createdby = null; 00082 $question->modifiedby = null; 00083 return $question; 00084 } 00085 00086 public function get_random_guess_score($questiondata) { 00087 return null; 00088 } 00089 00090 public function display_question_editing_page($mform, $question, $wizardnow) { 00091 global $OUTPUT; 00092 echo $OUTPUT->heading(get_string('warningmissingtype', 'qtype_missingtype')); 00093 00094 $mform->display(); 00095 } 00096 }