curl now mandatory
[moodle.git] / question / type / essay / edit_essay_form.php
CommitLineData
aeb15530 1<?php
271ffe3f 2/**
3 * Defines the editing form for the essay question type.
4 *
5 * @copyright &copy; 2007 Jamie Pratt
6 * @author Jamie Pratt me@jamiep.org
7 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
830e47a8 8 * @package questionbank
9 * @subpackage questiontypes
271ffe3f 10 */
11
12/**
13 * essay editing form definition.
14 */
15class question_edit_essay_form extends question_edit_form {
16 /**
17 * Add question-type specific form fields.
18 *
19 * @param MoodleQuickForm $mform the form being built.
20 */
21 function definition_inner(&$mform) {
271e6dec 22 $mform->addElement('htmleditor', 'feedback', get_string("feedback", "quiz"),
23 array('course' => $this->coursefilesid));
271ffe3f 24 $mform->setType('feedback', PARAM_RAW);
25
26 $mform->addElement('hidden', 'fraction', 0);
d18e0fe6 27 $mform->setType('fraction', PARAM_RAW);
b63c5b59 28
29 //don't need this default element.
30 $mform->removeElement('penalty');
31 $mform->addElement('hidden', 'penalty', 0);
d18e0fe6 32 $mform->setType('penalty', PARAM_RAW);
271ffe3f 33 }
34
32db0d42 35 function set_data($question) {
4454447d 36 if (!empty($question->options) && !empty($question->options->answers)) {
3023608c 37 $answer = reset($question->options->answers);
38 $question->feedback = $answer->feedback;
271ffe3f 39 }
b63c5b59 40 $question->penalty = 0;
32db0d42 41 parent::set_data($question);
271ffe3f 42 }
43
44 function qtype() {
45 return 'essay';
46 }
271ffe3f 47}
aeb15530 48