Moving quiz-independent question scripts to their new location. In a following commit...
[moodle.git] / question / questiontypes / description / questiontype.php
CommitLineData
516cf3eb 1<?php // $Id$
2
3///////////////////
4/// DESCRIPTION ///
5///////////////////
6
7/// QUESTION TYPE CLASS //////////////////
8
9//
10// The question type DESCRIPTION is not really a question type
11// and it therefore often sticks to some kind of odd behaviour
12//
13
14class quiz_description_qtype extends quiz_default_questiontype {
15
16 function name() {
17 return 'description';
18 }
19
20 function get_question_options(&$question) {
21 // No options to be restored for this question type
22 return true;
23 }
24
25 function save_question_options($question) {
26 /// No options to be saved for this question type:
27 return true;
28 }
29
30 function print_question(&$question, &$state, $number, $cmoptions, $options) {
31 print_simple_box_start('center', '90%');
32 echo format_text($question->questiontext,
33 $question->questiontextformat,
34 NULL, $cmoptions->course);
35 quiz_print_possible_question_image($question, $cmoptions->course);
36 if (isteacher($cmoptions->course)) {
37 echo '<font size="1">';
38 link_to_popup_window ('/mod/quiz/question.php?id=' . $question->id,
39 'editquestion', get_string('edit'), 450, 550, get_string('edit'));
40 echo '</font>';
41 }
42 print_simple_box_end('center', '90%');
43 }
44
45 function actual_number_of_questions($question) {
46 /// Used for the feature number-of-questions-per-page
47 /// to determine the actual number of questions wrapped
48 /// by this question.
49 /// The question type description is not even a question
50 /// in itself so it will return ZERO!
51 return 0;
52 }
53
54 function grade_responses(&$question, &$state, $cmoptions) {
55 $state->raw_grade = 0;
56 $state->penalty = 0;
57 }
58
59}
60//// END OF CLASS ////
61
62//////////////////////////////////////////////////////////////////////////
63//// INITIATION - Without this line the question type is not in use... ///
64//////////////////////////////////////////////////////////////////////////
65$QUIZ_QTYPES[DESCRIPTION]= new quiz_description_qtype();
66
67?>