MDL-35264 mod_chat Changing the input frame of chat daemon method to a embedded page...
[moodle.git] / mod / chat / gui_sockets / chatinput.php
CommitLineData
eb588b22 1<?php
2
3define('NO_MOODLE_COOKIES', true); // session not used here
03f5a0f8 4
eb588b22 5require('../../../config.php');
6require('../lib.php');
03f5a0f8 7
eb588b22 8$chat_sid = required_param('chat_sid', PARAM_ALPHANUM);
03f5a0f8 9
a6855934 10$PAGE->set_url('/mod/chat/gui_sockets/chatinput.php', array('chat_sid'=>$chat_sid));
03f5a0f8 11
eb588b22 12if (!$chatuser = $DB->get_record('chat_users', array('sid'=>$chat_sid))) {
13 print_error('notlogged', 'chat');
14}
03f5a0f8 15
eb588b22 16//Get the user theme
17$USER = $DB->get_record('user', array('id'=>$chatuser->userid));
9152fc99 18
eb588b22 19//Setup course, lang and theme
476a235d 20$PAGE->set_pagelayout('embedded');
eb588b22 21$PAGE->set_course($DB->get_record('course', array('id' => $chatuser->course)));
60409fe1 22$PAGE->requires->js('/mod/chat/gui_sockets/chat_gui_sockets.js', true);
eb588b22 23$PAGE->requires->js_function_call('setfocus');
24$PAGE->set_focuscontrol('chat_message');
25$PAGE->set_cacheable(false);
26echo $OUTPUT->header();
03f5a0f8 27
28?>
29
30 <form action="../empty.php" method="get" target="empty" id="inputform"
31 onsubmit="return empty_field_and_submit();">
da248cbb 32 <label class="accesshide" for="chat_message"><?php print_string('entermessage', 'chat'); ?></label>
296b589e 33 <input type="text" name="chat_message" id="chat_message" size="60" value="" />
f4c73c06 34 <?php echo $OUTPUT->help_icon('usingchat', 'chat'); ?>
03f5a0f8 35 </form>
e7521559 36
03f5a0f8 37 <form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform">
38 <input type="hidden" name="win" value="message" />
39 <input type="hidden" name="chat_message" value="" />
40 <input type="hidden" name="chat_msgidnr" value="0" />
41 <input type="hidden" name="chat_sid" value="<?php echo $chat_sid ?>" />
42 </form>
d795bfdb 43<?php
d8772689 44 echo $OUTPUT->footer();
083acd24 45?>