Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
   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   * Defines the 'qtype_missingtype' question definition class.
  19   *
  20   * @package    qtype
  21   * @subpackage missingtype
  22   * @copyright  2009 The Open University
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  require_once($CFG->dirroot . '/question/type/questionbase.php');
  30  
  31  /**
  32   * This question definition class is used when the actual question type of this
  33   * question cannot be found.
  34   *
  35   * Why does this this class implement question_automatically_gradable? I am not
  36   * sure at the moment. Perhaps it is important for it to work with as many
  37   * behaviours as possible.
  38   *
  39   * @copyright  2009 The Open University
  40   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  41   */
  42  class qtype_missingtype_question extends question_definition
  43          implements question_automatically_gradable {
  44      public function get_expected_data() {
  45          return array();
  46      }
  47  
  48      public function get_correct_response() {
  49          return array();
  50      }
  51  
  52      public function is_complete_response(array $response) {
  53          return false;
  54      }
  55  
  56      public function is_gradable_response(array $response) {
  57          return false;
  58      }
  59  
  60      public function get_validation_error(array $response) {
  61          return '';
  62      }
  63  
  64      public function is_same_response(array $prevresponse, array $newresponse) {
  65          return true;
  66      }
  67  
  68      public function get_right_answer_summary() {
  69          return '';
  70      }
  71  
  72      public function summarise_response(array $response) {
  73          return null;
  74      }
  75  
  76      public function un_summarise_response(string $response) {
  77          return [];
  78      }
  79  
  80      public function classify_response(array $response) {
  81          return array();
  82      }
  83  
  84      public function start_attempt(question_attempt_step $step, $variant) {
  85          throw new coding_exception('This question is of a type that is not installed ' .
  86                  'on your system. No processing is possible.');
  87      }
  88  
  89      public function grade_response(array $response) {
  90          throw new coding_exception('This question is of a type that is not installed ' .
  91                  'on your system. No processing is possible.');
  92      }
  93  
  94      public function get_hint($hintnumber, question_attempt $qa) {
  95          return null;
  96      }
  97  }