weekly release 2.0.4+
[moodle.git] / message / send_form.php
blob88dd4b2e0d7b7c5f2bdf5c75a7ce2e3e930b7871
1 <?php
3 if (!defined('MOODLE_INTERNAL')) {
4 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
7 require_once($CFG->dirroot.'/lib/formslib.php');
9 class send_form extends moodleform {
11 function definition () {
13 $mform =& $this->_form;
15 //$editoroptions = array('maxfiles'=>0, 'maxbytes'=>0, 'trusttext'=>false);
16 $editoroptions = array();
18 //width handled by css so cols is empty. Still present so the page validates.
19 $displayoptions = array('rows'=>'4', 'cols'=>'', 'class'=>'messagesendbox');
21 $mform->addElement('hidden', 'id');
22 $mform->setType('id', PARAM_INT);
24 //$mform->addElement('html', '<div class="message-send-box">');
25 $mform->addElement('textarea', 'message', get_string('message', 'message'), $displayoptions, $editoroptions);
26 //$mform->addElement('editor', 'message_editor', get_string('message', 'message'), null, $editoroptions);
27 //$mform->addElement('html', '</div>');
29 $this->add_action_buttons(false, get_string('sendmessage', 'message'));
32 /**
33 * Used to structure incoming data for the message editor component
35 * @param <type> $data
37 function set_data($data) {
39 //$data->message = array('text'=>$data->message, 'format'=>$data->messageformat);
41 parent::set_data($data);
44 /**
45 * Used to reformat the data from the editor component
47 * @return stdClass
49 function get_data() {
50 $data = parent::get_data();
52 /*if ($data !== null) {
53 //$data->messageformat = $data->message_editor['format'];
54 //$data->message = clean_text($data->message_editor['text'], $data->messageformat);
55 }*/
57 return $data;
60 /**
61 * Resets the value of the message
63 * This is used because after we have acted on the submitted content we want to
64 * re-display the form but with an empty message so the user can type the next
65 * thing into it
67 //function reset_message() {
68 //$this->_form->_elements[$this->_form->_elementIndex['message']]->setValue(array('text'=>''));
69 //}