Merge branch 'MDL-38268-m23' of https://github.com/jfilip/moodle into MOODLE_23_STABLE
[moodle.git] / notes / edit_form.php
1 <?php
3 if (!defined('MOODLE_INTERNAL')) {
4     die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
5 }
7 require_once($CFG->libdir.'/formslib.php');
9 class note_edit_form extends moodleform {
11     function definition() {
12         $mform =& $this->_form;
13         $mform->addElement('header', 'general', get_string('note', 'notes'));
15         $mform->addElement('textarea', 'content', get_string('content', 'notes'), array('rows'=>15, 'cols'=>40));
16         $mform->setType('content', PARAM_RAW);
17         $mform->addRule('content', get_string('nocontent', 'notes'), 'required', null, 'client');
19         $mform->addElement('select', 'publishstate', get_string('publishstate', 'notes'), note_get_state_names());
20         $mform->setDefault('publishstate', NOTES_STATE_PUBLIC);
21         $mform->setType('publishstate', PARAM_ALPHA);
22         $mform->addHelpButton('publishstate', 'publishstate', 'notes');
24         $this->add_action_buttons();
26         $mform->addElement('hidden', 'courseid');
27         $mform->setType('course', PARAM_INT);
29         $mform->addElement('hidden', 'userid');
30         $mform->setType('user', PARAM_INT);
32         $mform->addElement('hidden', 'id');
33         $mform->setType('id', PARAM_INT);
34     }
35 }