|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 define('NO_MOODLE_COOKIES', true); // session not used here 00004 00005 require_once('../../../config.php'); 00006 require_once($CFG->dirroot.'/mod/chat/lib.php'); 00007 00008 $chat_sid = required_param('chat_sid', PARAM_ALPHANUM); 00009 $chatid = required_param('chat_id', PARAM_INT); 00010 00011 if (!$chatuser = $DB->get_record('chat_users', array('sid'=>$chat_sid))) { 00012 print_error('notlogged', 'chat'); 00013 } 00014 if (!$chat = $DB->get_record('chat', array('id'=>$chatid))) { 00015 print_error('invalidid', 'chat'); 00016 } 00017 00018 if (!$course = $DB->get_record('course', array('id'=>$chat->course))) { 00019 print_error('invalidcourseid'); 00020 } 00021 00022 if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) { 00023 print_error('invalidcoursemodule'); 00024 } 00025 00026 $PAGE->set_url('/mod/chat/gui_header_js/chatinput.php', array('chat_sid'=>$chat_sid, 'chat_id'=>$chatid)); 00027 00028 $context = get_context_instance(CONTEXT_MODULE, $cm->id); 00029 00030 //Get the user theme 00031 $USER = $DB->get_record('user', array('id'=>$chatuser->userid)); 00032 00033 00034 $module = array( 00035 'name' => 'mod_chat_header', 00036 'fullpath' => '/mod/chat/gui_header_js/module.js', 00037 'requires' => array('node') 00038 ); 00039 $PAGE->requires->js_init_call('M.mod_chat_header.init_input', array(false), false, $module); 00040 00041 //Setup course, lang and theme 00042 $PAGE->set_course($course); 00043 $PAGE->set_pagelayout('embedded'); 00044 $PAGE->set_focuscontrol('input_chat_message'); 00045 $PAGE->set_cacheable(false); 00046 echo $OUTPUT->header(); 00047 00048 echo html_writer::start_tag('form', array('action'=>'../empty.php', 'method'=>'post', 'target'=>'empty', 'id'=>'inputForm', 'style'=>'margin:0')); 00049 echo html_writer::empty_tag('input', array('type'=>'text', 'id'=>'input_chat_message', 'name'=>'chat_message', 'size'=>'50', 'value'=>'')); 00050 echo html_writer::empty_tag('input', array('type'=>'checkbox', 'id'=>'auto', 'checked'=>'checked', 'value'=>'')); 00051 echo html_writer::tag('label', get_string('autoscroll', 'chat'), array('for'=>'auto')); 00052 echo $OUTPUT->help_icon('usingchat', 'chat'); 00053 echo html_writer::end_tag('form'); 00054 00055 echo html_writer::start_tag('form', array('action'=>'insert.php', 'method'=>'post', 'target'=>'empty', 'id'=>'sendForm')); 00056 echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'chat_sid', 'value'=>$chat_sid)); 00057 echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'chat_message', 'id'=>'insert_chat_message')); 00058 echo html_writer::end_tag('form'); 00059 00060 echo $OUTPUT->footer();