3 require_once('../../../config.php');
4 require_once('../lib.php');
6 $id = required_param('id', PARAM_INT
);
7 $groupid = optional_param('groupid', 0, PARAM_INT
); //only for teachers
9 if (!$chat = get_record('chat', 'id', $id)) {
10 error('Could not find that chat room!');
13 if (!$course = get_record('course', 'id', $chat->course
)) {
14 error('Could not find the course this belongs to!');
17 if (!$cm = get_coursemodule_from_instance('chat', $chat->id
, $course->id
)) {
18 error('Course Module ID was incorrect');
21 require_login($course->id
, false, $cm);
24 error('Guest does not have access to chat rooms');
27 if (!$cm->visible
and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE
, $cm->id
))) {
29 notice(get_string("activityiscurrentlyhidden"));
32 /// Check to see if groups are being used here
33 if ($groupmode = groupmode($course, $cm)) { // Groups are being used
34 if ($groupid = get_and_set_current_group($course, $groupmode, $groupid)) {
35 if (! groups_group_exists($groupid)) {
36 error("That group (id $groupid) doesn't exist!");
38 $groupname = ': '.$group->name
;
40 $groupname = ': '.get_string('allparticipants');
47 $strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!!
49 if (!$chat_sid = chat_login_user($chat->id
, 'sockets', $groupid, $course)) {
50 error('Could not log in to chat room!!');
53 $params = "chat_sid=$chat_sid";
57 <!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
60 <meta http
-equiv
="content-type" content
="text/html; charset=utf-8" />
62 <?php
echo "$strchat: " . format_string($course->shortname
) . ": ".format_string($chat->name
,true)."$groupname" ?
>
65 <frameset cols
="*,200" border
="5" framespacing
="no" frameborder
="yes" marginwidth
="2" marginheight
="1">
66 <frameset rows
="0,*,50" border
="0" framespacing
="no" frameborder
="no" marginwidth
="2" marginheight
="1">
67 <frame src
="empty.php" name
="empty" scrolling
="auto" noresize marginwidth
="2" marginheight
="0">
68 <frame src
="<?php echo "http
://$CFG->chat_serverhost:$CFG->chat_serverport?win=chat&$params"; ?>" name="msg" scrolling="auto" noresize marginwidth="2" marginheight="0">
69 <frame src
="chatinput.php?<?php echo $params ?>" name
="input" scrolling
="no" marginwidth
="2" marginheight
="1">
71 <frame src
="<?php echo "http
://$CFG->chat_serverhost:$CFG->chat_serverport?win=users&$params"; ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
74 Sorry
, this version of Moodle Chat needs a browser that handles frames
.