[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/question/type/missingtype/ -> questiontype.php (source)

   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   * Question type class for the 'missingtype' type.
  19   *
  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
  24   */
  25  
  26  
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  
  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   *
  37   * @copyright  1999 onwards Martin Dougiamas  {@link http://moodle.com}
  38   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  39   */
  40  class qtype_missingtype extends question_type {
  41      public function menu_name() {
  42          return false;
  43      }
  44  
  45      public function is_usable_by_random() {
  46          return false;
  47      }
  48  
  49      public function can_analyse_responses() {
  50          return false;
  51      }
  52  
  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;
  60      }
  61  
  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;
  84      }
  85  
  86      public function get_random_guess_score($questiondata) {
  87          return null;
  88      }
  89  
  90      public function display_question_editing_page($mform, $question, $wizardnow) {
  91          global $OUTPUT;
  92          echo $OUTPUT->heading(get_string('warningmissingtype', 'qtype_missingtype'));
  93  
  94          $mform->display();
  95      }
  96  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1