1 <?php 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/>. 16 17 /** 18 * Fake question behaviour that is used when the actual behaviour was not 19 * available. 20 * 21 * @package qbehaviour 22 * @subpackage missing 23 * @copyright 2009 The Open University 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 31 /** 32 * Fake question behaviour that is used when the actual behaviour 33 * is not available. 34 * 35 * Imagine, for example, that a quiz attempt has been restored from another 36 * Moodle site with more behaviours installed, or a behaviour 37 * that used to be available in this site has been uninstalled. Obviously all we 38 * can do is have some code to prevent fatal errors. 39 * 40 * The approach we take is: The rendering code is still implemented, as far as 41 * possible. A warning is shown that behaviour specific bits may be missing. 42 * Any attempt to process anything causes an exception to be thrown. 43 * 44 * @copyright 2009 The Open University 45 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 46 */ 47 class qbehaviour_missing extends question_behaviour { 48 49 public function is_compatible_question(question_definition $question) { 50 return true; 51 } 52 53 public function summarise_action(question_attempt_step $step) { 54 return ''; 55 } 56 57 public function init_first_step(question_attempt_step $step, $variant) { 58 throw new coding_exception('The behaviour used for this question is not available. ' . 59 'No processing is possible.'); 60 } 61 62 public function process_action(question_attempt_pending_step $pendingstep) { 63 throw new coding_exception('The behaviour used for this question is not available. ' . 64 'No processing is possible.'); 65 } 66 67 public function get_min_fraction() { 68 throw new coding_exception('The behaviour used for this question is not available. ' . 69 'No processing is possible.'); 70 } 71 72 public function get_max_fraction() { 73 throw new coding_exception('The behaviour used for this question is not available. ' . 74 'No processing is possible.'); 75 } 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body