|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 require_once('../../../config.php'); 00004 require_once('../lib.php'); 00005 00006 $id = required_param('id', PARAM_INT); 00007 $groupid = optional_param('groupid', 0, PARAM_INT); //only for teachers 00008 00009 $url = new moodle_url('/mod/chat/gui_sockets/index.php', array('id'=>$id)); 00010 if ($groupid !== 0) { 00011 $url->param('groupid', $groupid); 00012 } 00013 $PAGE->set_url($url); 00014 00015 if (!$chat = $DB->get_record('chat', array('id'=>$id))) { 00016 print_error('invalidid', 'chat'); 00017 } 00018 00019 if (!$course = $DB->get_record('course', array('id'=>$chat->course))) { 00020 print_error('invalidcourseid'); 00021 } 00022 00023 if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) { 00024 print_error('invalidcoursemodule'); 00025 } 00026 00027 require_login($course, false, $cm); 00028 $context = get_context_instance(CONTEXT_MODULE, $cm->id); 00029 00030 if (isguestuser()) { 00031 print_error('noguests', 'chat'); 00032 } 00033 00035 if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used 00036 if ($groupid = groups_get_activity_group($cm)) { 00037 if (!$group = groups_get_group($groupid)) { 00038 print_error('invalidgroupid'); 00039 } 00040 $groupname = ': '.$group->name; 00041 } else { 00042 $groupname = ': '.get_string('allparticipants'); 00043 } 00044 } else { 00045 $groupid = 0; 00046 $groupname = ''; 00047 } 00048 00049 $strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!! 00050 00051 if (!$chat_sid = chat_login_user($chat->id, 'sockets', $groupid, $course)) { 00052 print_error('cantlogin'); 00053 } 00054 00055 $params = "chat_sid=$chat_sid"; 00056 $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))); 00057 00058 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> 00059 <html> 00060 <head> 00061 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 00062 <title> 00063 <?php echo "$strchat: " . $courseshortname . ": " . format_string($chat->name, true, array('context' => $context)) . "$groupname" ?> 00064 </title> 00065 </head> 00066 <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1"> 00067 <frameset rows="0,*,50" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1"> 00068 <frame src="../empty.php" name="empty" scrolling="auto" noresize marginwidth="2" marginheight="0"> 00069 <frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=chat&$params"; ?>" scrolling="auto" name="msg" noresize marginwidth="2" marginheight="0"> 00070 <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1"> 00071 </frameset> 00072 <frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=users&$params"; ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5"> 00073 </frameset> 00074 <noframes> 00075 Sorry, this version of Moodle Chat needs a browser that handles frames. 00076 </noframes> 00077 </html>