PageRenderTime 48ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/notes/edit_form.php

https://bitbucket.org/moodle/moodle
PHP | 53 lines | 26 code | 10 blank | 17 comment | 1 complexity | 3af3bf9f177d9a19f44ad2ede983db36 MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.1, BSD-3-Clause, MIT, GPL-3.0
  1. <?php
  2. // This file is part of Moodle - http://moodle.org/
  3. //
  4. // Moodle is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // Moodle is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
  16. if (!defined('MOODLE_INTERNAL')) {
  17. die('Direct access to this script is forbidden.'); // It must be included from a Moodle page.
  18. }
  19. require_once($CFG->libdir.'/formslib.php');
  20. class note_edit_form extends moodleform {
  21. /**
  22. * Define the form for editing notes
  23. */
  24. public function definition() {
  25. $mform =& $this->_form;
  26. $mform->addElement('header', 'general', get_string('note', 'notes'));
  27. $mform->addElement('textarea', 'content', get_string('content', 'notes'), array('rows' => 15, 'cols' => 40));
  28. $mform->setType('content', PARAM_RAW);
  29. $mform->addRule('content', get_string('nocontent', 'notes'), 'required', null, 'client');
  30. $mform->setForceLtr('content', false);
  31. $mform->addElement('select', 'publishstate', get_string('publishstate', 'notes'), note_get_state_names());
  32. $mform->setDefault('publishstate', NOTES_STATE_PUBLIC);
  33. $mform->setType('publishstate', PARAM_ALPHA);
  34. $mform->addHelpButton('publishstate', 'publishstate', 'notes');
  35. $this->add_action_buttons();
  36. $mform->addElement('hidden', 'courseid');
  37. $mform->setType('courseid', PARAM_INT);
  38. $mform->addElement('hidden', 'userid');
  39. $mform->setType('userid', PARAM_INT);
  40. $mform->addElement('hidden', 'id');
  41. $mform->setType('id', PARAM_INT);
  42. }
  43. }