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 $url = new moodle_url('/mod/chat/gui_sockets/index.php', array('id'=>$id));
11 $url->param('groupid', $groupid);
15 if (!$chat = $DB->get_record('chat', array('id'=>$id))) {
16 print_error('invalidid', 'chat');
19 if (!$course = $DB->get_record('course', array('id'=>$chat->course))) {
20 print_error('invalidcourseid');
23 if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
24 print_error('invalidcoursemodule');
27 require_login($course, false, $cm);
28 $context = get_context_instance(CONTEXT_MODULE, $cm->id);
31 print_error('noguests', 'chat');
34 /// Check to see if groups are being used here
35 if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used
36 if ($groupid = groups_get_activity_group($cm)) {
37 if (!$group = groups_get_group($groupid)) {
38 print_error('invalidgroupid');
40 $groupname = ': '.$group->name;
42 $groupname = ': '.get_string('allparticipants');
49 $strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!!
51 if (!$chat_sid = chat_login_user($chat->id, 'sockets', $groupid, $course)) {
52 print_error('cantlogin');
55 $params = "chat_sid=$chat_sid";
56 $courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
58 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
61 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
63 <?php echo "$strchat: " . $courseshortname . ": " . format_string($chat->name, true, array('context' => $context)) . "$groupname" ?>
66 <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
67 <frameset rows="0,*,50" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1">
68 <frame src="../empty.php" name="empty" scrolling="auto" noresize marginwidth="2" marginheight="0">
69 <frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=chat&$params"; ?>" scrolling="auto" name="msg" noresize marginwidth="2" marginheight="0">
70 <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1">
72 <frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=users&$params"; ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
75 Sorry, this version of Moodle Chat needs a browser that handles frames.