MDL-10524 minor simplification of median aggregation + fixed aggregation names in...
[moodle.git] / question / type / description / questiontype.php
CommitLineData
516cf3eb 1<?php // $Id$
2
3///////////////////
4/// DESCRIPTION ///
5///////////////////
6
7/// QUESTION TYPE CLASS //////////////////
8
9//
dfa47f96 10// The question type 'description' is not really a question type
516cf3eb 11// and it therefore often sticks to some kind of odd behaviour
12//
1976496e 13/**
14 * @package questionbank
15 * @subpackage questiontypes
7375c542 16 */
7518b645 17class description_qtype extends default_questiontype {
516cf3eb 18
19 function name() {
20 return 'description';
21 }
a2156789 22
23 function is_usable_by_random() {
24 return false;
25 }
516cf3eb 26
27 function get_question_options(&$question) {
28 // No options to be restored for this question type
29 return true;
30 }
31
32 function save_question_options($question) {
33 /// No options to be saved for this question type:
34 return true;
35 }
36
37 function print_question(&$question, &$state, $number, $cmoptions, $options) {
37a12367 38 global $CFG;
39
40 // For editing teachers print a link to an editing popup window
41 $editlink = '';
17d6a25e 42 if (has_capability('moodle/question:manage', get_context_instance(CONTEXT_COURSE, $cmoptions->course))) {
37a12367 43 $stredit = get_string('edit');
0fd5feef 44 $linktext = '<img src="'.$CFG->pixpath.'/t/edit.gif" alt="'.$stredit.'" />';
37a12367 45 $editlink = link_to_popup_window('/question/question.php?id='.$question->id, $stredit, $linktext, 450, 550, $stredit, '', true);
46 }
47
b2ba9f6e 48 $questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
37a12367 49 $image = get_question_image($question, $cmoptions->course);
50
aaae75b0 51 include "$CFG->dirroot/question/type/description/question.html";
516cf3eb 52 }
53
54 function actual_number_of_questions($question) {
55 /// Used for the feature number-of-questions-per-page
56 /// to determine the actual number of questions wrapped
57 /// by this question.
58 /// The question type description is not even a question
59 /// in itself so it will return ZERO!
60 return 0;
61 }
62
63 function grade_responses(&$question, &$state, $cmoptions) {
64 $state->raw_grade = 0;
65 $state->penalty = 0;
66 }
67
68}
69//// END OF CLASS ////
70
71//////////////////////////////////////////////////////////////////////////
72//// INITIATION - Without this line the question type is not in use... ///
73//////////////////////////////////////////////////////////////////////////
a2156789 74question_register_questiontype(new description_qtype());
516cf3eb 75?>