send_form.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. /**
  17. * Contains the definition of the form used to send messages
  18. *
  19. * @package core_message
  20. * @copyright 2009 Sam Hemelryk
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22. */
  23. if (!defined('MOODLE_INTERNAL')) {
  24. die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
  25. }
  26. require_once($CFG->dirroot.'/lib/formslib.php');
  27. /**
  28. * The form used by users to send instant messages
  29. *
  30. * @package core_message
  31. * @copyright 2009 Sam Hemelryk
  32. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  33. */
  34. class send_form extends moodleform {
  35. /**
  36. * Define the mform elements required
  37. */
  38. function definition () {
  39. $mform =& $this->_form;
  40. $editoroptions = array();
  41. //width handled by css so cols is empty. Still present so the page validates.
  42. $displayoptions = array('rows'=>'4', 'cols'=>'', 'class'=>'messagesendbox');
  43. $mform->addElement('hidden', 'id');
  44. $mform->setType('id', PARAM_INT);
  45. $mform->addElement('hidden', 'viewing');
  46. $mform->setType('viewing', PARAM_ALPHANUMEXT);
  47. $mform->addElement('textarea', 'message', get_string('message', 'message'), $displayoptions, $editoroptions);
  48. $this->add_action_buttons(false, get_string('sendmessage', 'message'));
  49. }
  50. }
  51. ?>