MDL-37411 Notes: unset courseid and userid when updating the note to prevent accident...
[moodle.git] / notes / edit_form.php
CommitLineData
1d422980 1<?php
83e70cc2 2
bfebaf64
MD
3if (!defined('MOODLE_INTERNAL')) {
4 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
5}
6
83e70cc2 7require_once($CFG->libdir.'/formslib.php');
8
9class note_edit_form extends moodleform {
10
11 function definition() {
67b5883e 12 $mform =& $this->_form;
83e70cc2 13 $mform->addElement('header', 'general', get_string('note', 'notes'));
14
67b5883e 15 $mform->addElement('textarea', 'content', get_string('content', 'notes'), array('rows'=>15, 'cols'=>40));
83e70cc2 16 $mform->setType('content', PARAM_RAW);
17 $mform->addRule('content', get_string('nocontent', 'notes'), 'required', null, 'client');
83e70cc2 18
67b5883e 19 $mform->addElement('select', 'publishstate', get_string('publishstate', 'notes'), note_get_state_names());
83e70cc2 20 $mform->setDefault('publishstate', NOTES_STATE_PUBLIC);
21 $mform->setType('publishstate', PARAM_ALPHA);
67b5883e 22 $mform->addHelpButton('publishstate', 'publishstate', 'notes');
83e70cc2 23
24 $this->add_action_buttons();
25
241bcec5 26 $mform->addElement('hidden', 'courseid');
83e70cc2 27 $mform->setType('course', PARAM_INT);
28
241bcec5 29 $mform->addElement('hidden', 'userid');
7e7f6fda 30 $mform->setType('user', PARAM_INT);
31
241bcec5 32 $mform->addElement('hidden', 'id');
33 $mform->setType('id', PARAM_INT);
83e70cc2 34 }
35}