MDL-7077, MDL-10181, adding notes for students
[moodle.git] / notes / edit_form.php
1 <?php  // $Id$\r
2 \r
3 require_once($CFG->libdir.'/formslib.php');\r
4 \r
5 class note_edit_form extends moodleform {\r
6 \r
7     function definition() {\r
8         $mform    =& $this->_form;\r
9 \r
10         $mform->addElement('header', 'general', get_string('general', 'form'));\r
11 \r
12         $mform->addElement('select', 'user', get_string('user'), $this->_customdata['userlist']);\r
13         $mform->addRule('user', get_string('nouser', 'notes'), 'required', null, 'client');\r
14 \r
15         $mform->addElement('textarea', 'content', get_string('content', 'notes'), array('rows'=>15, 'cols'=>40));\r
16         $mform->setType('content', PARAM_RAW);\r
17         $mform->addRule('content', get_string('nocontent', 'notes'), 'required', null, 'client');\r
18         $mform->setHelpButton('content', array('writing', 'richtext'), false, 'editorhelpbutton');\r
19 \r
20         $mform->addElement('select', 'rating', get_string('rating', 'notes'), note_get_rating_names());\r
21         $mform->setDefault('rating', 3);\r
22 \r
23         $mform->addElement('select', 'publishstate', get_string('publishstate', 'notes'), note_get_state_names());\r
24         $mform->setDefault('publishstate', NOTES_STATE_PUBLIC);\r
25         $mform->setType('publishstate', PARAM_ALPHA);\r
26 \r
27         $this->add_action_buttons();\r
28 \r
29         $mform->addElement('hidden', 'course');\r
30         $mform->setType('course', PARAM_INT);\r
31 \r
32         $mform->addElement('hidden', 'note');\r
33         $mform->setType('note', PARAM_INT);\r
34     }\r
35 }\r