76 lines
2.8 KiB
PHP
Raw Normal View History

<?php
require_once('../../../config.php');
require_once('../lib.php');
2004-07-30 15:33:52 +00:00
$id = required_param('id', PARAM_INT);
$groupid = optional_param('groupid', 0, PARAM_INT); //only for teachers
2004-07-30 15:33:52 +00:00
$url = new moodle_url('/mod/chat/gui_sockets/index.php', array('id'=>$id));
if ($groupid !== 0) {
$url->param('groupid', $groupid);
}
$PAGE->set_url($url);
2004-07-30 15:33:52 +00:00
if (!$chat = $DB->get_record('chat', array('id'=>$id))) {
print_error('invalidid', 'chat');
}
2004-07-30 15:33:52 +00:00
if (!$course = $DB->get_record('course', array('id'=>$chat->course))) {
print_error('invalidcourseid');
}
2004-07-30 15:33:52 +00:00
if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
print_error('invalidcoursemodule');
}
2004-07-30 15:33:52 +00:00
require_login($course->id, false, $cm);
2004-07-30 15:33:52 +00:00
if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), 0, false)) {
print_error('noguests', 'chat');
}
2004-07-30 15:33:52 +00:00
/// Check to see if groups are being used here
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used
if ($groupid = groups_get_activity_group($cm)) {
if (!$group = groups_get_group($groupid, false)) {
print_error('invalidgroupid');
2004-07-30 15:33:52 +00:00
}
$groupname = ': '.$group->name;
2004-07-30 15:33:52 +00:00
} else {
$groupname = ': '.get_string('allparticipants');
2004-07-30 15:33:52 +00:00
}
} else {
$groupid = 0;
$groupname = '';
}
2004-07-30 15:33:52 +00:00
$strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!!
2004-07-30 15:33:52 +00:00
if (!$chat_sid = chat_login_user($chat->id, 'sockets', $groupid, $course)) {
print_error('cantlogin');
}
$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=utf-8" />
<title>
<?php echo "$strchat: " . format_string($course->shortname) . ": ".format_string($chat->name,true)."$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">
<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"; ?>" scrolling="auto" name="msg" 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>