77 lines
2.9 KiB
PHP
Raw Normal View History

<?php // $Id$
2004-08-23 14:40:53 +00:00
require_once('../../../config.php');
2004-07-30 15:33:52 +00:00
require_once('../lib.php');
$id = required_param('id', PARAM_INT);
$groupid = optional_param('groupid', 0, PARAM_INT); //only for teachers
2004-07-30 15:33:52 +00:00
2004-08-23 14:40:53 +00:00
if (!$chat = get_record('chat', 'id', $id)) {
error('Could not find that chat room!');
2004-07-30 15:33:52 +00:00
}
2004-08-23 14:40:53 +00:00
if (!$course = get_record('course', 'id', $chat->course)) {
error('Could not find the course this belongs to!');
2004-07-30 15:33:52 +00:00
}
2004-08-23 14:40:53 +00:00
if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
error('Course Module ID was incorrect');
2004-07-30 15:33:52 +00:00
}
require_login($course->id, false, $cm);
2004-07-30 15:33:52 +00:00
if (isguest()) {
2004-08-23 14:40:53 +00:00
error('Guest does not have access to chat rooms');
2004-07-30 15:33:52 +00:00
}
if (!$cm->visible and !isteacher($course->id)) {
print_header();
notice(get_string("activityiscurrentlyhidden"));
}
2004-07-30 15:33:52 +00:00
/// Check to see if groups are being used here
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
if ($groupid = get_and_set_current_group($course, $groupmode, $groupid)) {
if (!$group = get_record('groups', 'id', $groupid)) {
error("That group (id $groupid) doesn't exist!");
2004-07-30 15:33:52 +00:00
}
$groupname = ': '.$group->name;
} else {
$groupname = ': '.get_string('allparticipants');
}
} else {
$groupid = 0;
2004-07-30 15:33:52 +00:00
$groupname = '';
}
$strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!!
if (!$chat_sid = chat_login_user($chat->id, 'sockets', $groupid, $course)) {
error('Could not log in to chat room!!');
2004-07-30 15:33:52 +00:00
}
$params = "chat_sid=$chat_sid";
?>
2004-07-30 15:33:52 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=<?php echo get_string('thischarset'); ?>" />
<title>
2004-07-30 15:33:52 +00:00
<?php echo "$strchat: $course->shortname: $chat->name$groupname" ?>
</title>
</head>
2004-07-30 15:33:52 +00:00
<frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
<frameset rows="0,*,50" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1">
2004-07-30 15:33:52 +00:00
<frame src="empty.php" name="empty" scrolling="auto" noresize marginwidth="2" marginheight="0">
<frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=chat&amp;$params"; ?>" name="msg" scrolling="auto" noresize marginwidth="2" marginheight="0">
2004-07-30 15:33:52 +00:00
<frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1">
</frameset>
<frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=users&amp;$params"; ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
</frameset>
<noframes>
2004-07-30 15:33:52 +00:00
Sorry, this version of Moodle Chat needs a browser that handles frames.
</noframes>
</html>