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'));
33 * Used to structure incoming data for the message editor component
37 function set_data($data) {
39 //$data->message = array('text'=>$data->message, 'format'=>$data->messageformat);
41 parent
::set_data($data);
45 * Used to reformat the data from the editor component
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);
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
67 //function reset_message() {
68 //$this->_form->_elements[$this->_form->_elementIndex['message']]->setValue(array('text'=>''));