10
10
// The question type 'description' is not really a question type
11
11
// and it therefore often sticks to some kind of odd behaviour
14
* @package questionbank
15
* @subpackage questiontypes
14
17
class description_qtype extends default_questiontype {
17
20
return 'description';
20
23
function is_usable_by_random() {
27
function save_question($question, $form, $course) {
28
// Make very sure that descriptions can'e be created with a grade of
29
// anything other than 0.
30
$form->defaultgrade = 0;
31
return parent::save_question($question, $form, $course);
24
34
function get_question_options(&$question) {
25
35
// No options to be restored for this question type
34
44
function print_question(&$question, &$state, $number, $cmoptions, $options) {
46
$isfinished = question_state_is_graded($state->last_graded) || $state->event == QUESTION_EVENTCLOSE;
37
48
// For editing teachers print a link to an editing popup window
39
if (has_capability('moodle/question:manage', get_context_instance(CONTEXT_COURSE, $cmoptions->course))) {
40
$stredit = get_string('edit');
41
$linktext = '<img src="'.$CFG->pixpath.'/t/edit.gif" alt="'.$stredit.'" />';
42
$editlink = link_to_popup_window('/question/question.php?id='.$question->id, $stredit, $linktext, 450, 550, $stredit, '', true);
49
$editlink = $this->get_question_edit_link($question, $cmoptions, $options);
51
$questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
52
$image = get_question_image($question);
54
$generalfeedback = '';
55
if ($isfinished && $options->generalfeedback) {
56
$generalfeedback = $this->format_text($question->generalfeedback,
57
$question->questiontextformat, $cmoptions);
45
$questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
46
$image = get_question_image($question, $cmoptions->course);
48
60
include "$CFG->dirroot/question/type/description/question.html";