Merge branch 'MDL-25708' of git://github.com/stronk7/moodle
[moodle.git] / message / send_form.php
CommitLineData
8bdc9cac
SH
1<?php
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
8bdc9cac
SH
7require_once($CFG->dirroot.'/lib/formslib.php');
8
9class send_form extends moodleform {
10
11 function definition () {
12
13 $mform =& $this->_form;
14
c8621a02
AD
15 //$editoroptions = array('maxfiles'=>0, 'maxbytes'=>0, 'trusttext'=>false);
16 $editoroptions = array();
17
18 //width handled by css so cols is empty. Still present so the page validates.
19 $displayoptions = array('rows'=>'4', 'cols'=>'', 'class'=>'messagesendbox');
8bdc9cac
SH
20
21 $mform->addElement('hidden', 'id');
22 $mform->setType('id', PARAM_INT);
23
c8621a02
AD
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>');
8bdc9cac
SH
28
29 $this->add_action_buttons(false, get_string('sendmessage', 'message'));
8bdc9cac
SH
30 }
31
32 /**
33 * Used to structure incoming data for the message editor component
34 *
35 * @param <type> $data
36 */
37 function set_data($data) {
38
c8621a02 39 //$data->message = array('text'=>$data->message, 'format'=>$data->messageformat);
8bdc9cac
SH
40
41 parent::set_data($data);
42 }
43
44 /**
45 * Used to reformat the data from the editor component
46 *
47 * @return stdClass
48 */
49 function get_data() {
50 $data = parent::get_data();
51
c8621a02
AD
52 /*if ($data !== null) {
53 //$data->messageformat = $data->message_editor['format'];
54 //$data->message = clean_text($data->message_editor['text'], $data->messageformat);
55 }*/
8bdc9cac
SH
56
57 return $data;
58 }
59
60 /**
61 * Resets the value of the message
62 *
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
66 */
c8621a02
AD
67 //function reset_message() {
68 //$this->_form->_elements[$this->_form->_elementIndex['message']]->setValue(array('text'=>''));
69 //}
8bdc9cac
SH
70
71}
72
bfebaf64 73?>