MDL-20636 More progress.
[moodle.git] / question / type / description / questiontype.php
CommitLineData
aeb15530 1<?php
516cf3eb 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/>.
17
516cf3eb 18
1976496e 19/**
d1b7e03d 20 * Question type class for the description 'question' type.
b974f947 21 *
d1b7e03d
TH
22 * @package qtype_description
23 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
7375c542 25 */
516cf3eb 26
d1b7e03d 27require_once($CFG->libdir . '/questionlib.php');
271e6dec 28
d1b7e03d
TH
29/**
30 * The description 'question' type.
31 *
32 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34 */
35class qtype_description extends question_type {
36 public function is_usable_by_random() {
b974f947 37 return false;
38 }
39
d1b7e03d 40 public function can_analyse_responses() {
a2156789 41 return false;
42 }
516cf3eb 43
d1b7e03d 44 public function save_question($question, $form, $course) {
bfbafdfe 45 // Make very sure that descriptions can'e be created with a grade of
46 // anything other than 0.
d1b7e03d
TH
47 $form->defaultmark = 0;
48 return parent::save_question($question, $form, $course);
bfbafdfe 49 }
50
d1b7e03d
TH
51 public function get_question_options(&$question) {
52 // No options to be restored for this question type
516cf3eb 53 return true;
54 }
55
d1b7e03d
TH
56 public function save_question_options($question) {
57 /// No options to be saved for this question type:
516cf3eb 58 return true;
59 }
60
d1b7e03d
TH
61 public function actual_number_of_questions($question) {
62 /// Used for the feature number-of-questions-per-page
63 /// to determine the actual number of questions wrapped
64 /// by this question.
65 /// The question type description is not even a question
66 /// in itself so it will return ZERO!
516cf3eb 67 return 0;
68 }
69
d1b7e03d
TH
70 public function get_random_guess_score($questiondata) {
71 return null;
516cf3eb 72 }
516cf3eb 73}