MDL-35264 mod_chat Changing the input frame of chat daemon method to a embedded page...
[moodle.git] / mod / chat / gui_sockets / chatinput.php
1 <?php
3 define('NO_MOODLE_COOKIES', true); // session not used here
5 require('../../../config.php');
6 require('../lib.php');
8 $chat_sid = required_param('chat_sid', PARAM_ALPHANUM);
10 $PAGE->set_url('/mod/chat/gui_sockets/chatinput.php', array('chat_sid'=>$chat_sid));
12 if (!$chatuser = $DB->get_record('chat_users', array('sid'=>$chat_sid))) {
13     print_error('notlogged', 'chat');
14 }
16 //Get the user theme
17 $USER = $DB->get_record('user', array('id'=>$chatuser->userid));
19 //Setup course, lang and theme
20 $PAGE->set_pagelayout('embedded');
21 $PAGE->set_course($DB->get_record('course', array('id' => $chatuser->course)));
22 $PAGE->requires->js('/mod/chat/gui_sockets/chat_gui_sockets.js', true);
23 $PAGE->requires->js_function_call('setfocus');
24 $PAGE->set_focuscontrol('chat_message');
25 $PAGE->set_cacheable(false);
26 echo $OUTPUT->header();
28 ?>
30     <form action="../empty.php" method="get" target="empty" id="inputform"
31           onsubmit="return empty_field_and_submit();">
32         <label class="accesshide" for="chat_message"><?php print_string('entermessage', 'chat'); ?></label>
33         <input type="text" name="chat_message" id="chat_message" size="60" value="" />
34         <?php echo $OUTPUT->help_icon('usingchat', 'chat'); ?>
35     </form>
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>
43 <?php
44     echo $OUTPUT->footer();
45 ?>