|
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_header_js/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 $context = get_context_instance(CONTEXT_MODULE, $cm->id); 00028 00029 require_login($course->id, false, $cm); 00030 00031 require_capability('mod/chat:chat', $context); 00032 00034 if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used 00035 if ($groupid = groups_get_activity_group($cm)) { 00036 if (!$group = groups_get_group($groupid)) { 00037 print_error('invalidgroupid'); 00038 } 00039 $groupname = ': '.$group->name; 00040 } else { 00041 $groupname = ': '.get_string('allparticipants'); 00042 } 00043 } else { 00044 $groupid = 0; 00045 $groupname = ''; 00046 } 00047 00048 $strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!! 00049 00050 if (!$chat_sid = chat_login_user($chat->id, 'header_js', $groupid, $course)) { 00051 print_error('cantlogin', 'chat'); 00052 } 00053 00054 $params = "chat_id=$id&chat_sid={$chat_sid}"; 00055 00056 // fallback to the old jsupdate, but allow other update modes 00057 $updatemode = 'jsupdate'; 00058 if (!empty($CFG->chat_normal_updatemode)) { 00059 $updatemode = $CFG->chat_normal_updatemode; 00060 } 00061 00062 $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))); 00063 ?> 00064 00065 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> 00066 <html> 00067 <head> 00068 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 00069 <title> 00070 <?php echo "$strchat: " . $courseshortname . ": " . format_string($chat->name, true, array('context' => $context)) . "$groupname" ?> 00071 </title> 00072 </head> 00073 <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1"> 00074 <frameset rows="0,0,*,50" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1"> 00075 <frame src="../empty.php" name="empty" scrolling="no" marginwidth="0" marginheight="0"> 00076 <frame src="<?php echo $updatemode ?>.php?<?php echo $params ?>" name="jsupdate" scrolling="no" marginwidth="0" marginheight="0"> 00077 <frame src="chatmsg.php?<?php echo $params ?>" name="msg" scrolling="auto" marginwidth="2" marginheight="1"> 00078 <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1"> 00079 </frameset> 00080 <frame src="users.php?<?php echo $params ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5"> 00081 </frameset> 00082 <noframes> 00083 Sorry, this version of Moodle Chat needs a browser that handles frames. 00084 </noframes> 00085 </html>