3 define('NO_MOODLE_COOKIES', true); // session not used here
5 require_once('../../../config.php');
6 require_once($CFG->dirroot
.'/mod/chat/lib.php');
8 $chat_sid = required_param('chat_sid', PARAM_ALPHANUM
);
9 $chatid = required_param('chat_id', PARAM_INT
);
11 if (!$chatuser = $DB->get_record('chat_users', array('sid'=>$chat_sid))) {
12 print_error('notlogged', 'chat');
14 if (!$chat = $DB->get_record('chat', array('id'=>$chatid))) {
15 print_error('invalidid', 'chat');
18 if (!$course = $DB->get_record('course', array('id'=>$chat->course
))) {
19 print_error('invalidcourseid');
22 if (!$cm = get_coursemodule_from_instance('chat', $chat->id
, $course->id
)) {
23 print_error('invalidcoursemodule');
26 $PAGE->set_url('/mod/chat/gui_header_js/chatinput.php', array('chat_sid'=>$chat_sid, 'chat_id'=>$chatid));
27 $PAGE->set_popup_notification_allowed(false);
30 $USER = $DB->get_record('user', array('id'=>$chatuser->userid
));
34 'name' => 'mod_chat_header',
35 'fullpath' => '/mod/chat/gui_header_js/module.js',
36 'requires' => array('node')
38 $PAGE->requires
->js_init_call('M.mod_chat_header.init_input', array(false), false, $module);
40 //Setup course, lang and theme
41 $PAGE->set_course($course);
42 $PAGE->set_pagelayout('embedded');
43 $PAGE->set_focuscontrol('input_chat_message');
44 $PAGE->set_cacheable(false);
45 echo $OUTPUT->header();
47 echo html_writer
::start_tag('form', array('action'=>'../empty.php', 'method'=>'post', 'target'=>'empty', 'id'=>'inputForm', 'style'=>'margin:0'));
48 echo html_writer
::label(get_string('entermessage', 'chat'), 'input_chat_message', false, array('class' => 'accesshide'));
49 echo html_writer
::empty_tag('input', array('type'=>'text', 'id'=>'input_chat_message', 'name'=>'chat_message', 'size'=>'50', 'value'=>''));
50 echo html_writer
::empty_tag('input', array('type'=>'checkbox', 'id'=>'auto', 'checked'=>'checked', 'value'=>''));
51 echo html_writer
::tag('label', get_string('autoscroll', 'chat'), array('for'=>'auto'));
52 echo html_writer
::end_tag('form');
54 echo html_writer
::start_tag('form', array('action'=>'insert.php', 'method'=>'post', 'target'=>'empty', 'id'=>'sendForm'));
55 echo html_writer
::empty_tag('input', array('type'=>'hidden', 'name'=>'chat_sid', 'value'=>$chat_sid));
56 echo html_writer
::empty_tag('input', array('type'=>'hidden', 'name'=>'chat_message', 'id'=>'insert_chat_message'));
57 echo html_writer
::end_tag('form');
59 echo $OUTPUT->footer();