1
<?php // $Id: index.php,v 1.12 2005/03/27 11:36:54 stronk7 Exp $
2
3
require_once('../../../config.php');
3
4
require_once('../lib.php');
6
optional_variable($groupid, -1);
6
$id = required_param('id', PARAM_INT);
7
$groupid = optional_param('groupid', 0, PARAM_INT); //only for teachers
8
9
if (!$chat = get_record('chat', 'id', $id)) {
9
10
error('Could not find that chat room!');
17
18
error('Course Module ID was incorrect');
20
require_login($course->id);
21
require_login($course->id, false, $cm);
23
24
error('Guest does not have access to chat rooms');
27
if (!$cm->visible and !isteacher($course->id)) {
29
notice(get_string("activityiscurrentlyhidden"));
26
32
/// Check to see if groups are being used here
27
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
28
if ($currentgroup = get_and_set_current_group($course, $groupmode, $groupid)) {
29
if (!$group = get_record('groups', 'id', $currentgroup)) {
30
error("That group (id $currentgroup) doesn't exist!");
33
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
34
if ($groupid = get_and_set_current_group($course, $groupmode, $groupid)) {
35
if (!$group = get_record('groups', 'id', $groupid)) {
36
error("That group (id $groupid) doesn't exist!");
32
38
$groupname = ': '.$group->name;
34
40
$groupname = ': '.get_string('allparticipants');
37
$currentgroup = false;
41
if (!$chat_sid = chat_login_user($chat->id, 'sockets', $currentgroup)) {
42
error("Could not log in to chat room!!");
45
if ($currentgroup !== false) {
46
$params = "chat_enter=true&chat_sid=$chat_sid&groupid=$currentgroup";
48
$params = "chat_enter=true&chat_sid=$chat_sid&groupid=0";
51
$strchat = get_string("modulename", "chat");
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";
56
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=<?php echo get_string('thischarset'); ?>" />
60
<?php echo "$strchat: $course->shortname: $chat->name$groupname" ?>
62
<?php echo "$strchat: $course->shortname: ".format_string($chat->name,true)."$groupname" ?>
63
65
<frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
64
<frameset rows="0,*,40" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1">
66
<frameset rows="0,*,50" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1">
65
67
<frame src="empty.php" name="empty" scrolling="auto" noresize marginwidth="2" marginheight="0">
66
<frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=chat&$params"; ?>" NAME="msg" 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">
67
69
<frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1">
69
71
<frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=users&$params"; ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
71
<frame src="../users.php?<?php echo $params ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
75
74
Sorry, this version of Moodle Chat needs a browser that handles frames.