Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / mod / chat / gui_header_js / index.php
blob231899521b68a24b217899206a0a00103fc00d49
1 <?php // $Id$
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 $context = get_context_instance(CONTEXT_MODULE, $cm->id);
23 require_login($course->id, false, $cm);
25 require_capability('mod/chat:chat',$context);
27 if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id))) {
28 print_header();
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 (!$group = groups_get_group($groupid, false)) {
36 error("That group (id $groupid) doesn't exist!");
38 $groupname = ': '.$group->name;
39 } else {
40 $groupname = ': '.get_string('allparticipants');
42 } else {
43 $groupid = 0;
44 $groupname = '';
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, 'header_js', $groupid, $course)) {
50 error('Could not log in to chat room!!');
53 $params = "chat_sid=$chat_sid";
55 // fallback to the old jsupdate, but allow other update modes
56 $updatemode = 'jsupdate';
57 if (!empty($CFG->chat_normal_updatemode)) {
58 $updatemode = $CFG->chat_normal_updatemode;
62 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
63 <html>
64 <head>
65 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
66 <title>
67 <?php echo "$strchat: " . format_string($course->shortname) . ": ".format_string($chat->name,true)."$groupname" ?>
68 </title>
69 </head>
70 <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
71 <frameset rows="0,0,*,50" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1">
72 <frame src="../empty.php" name="empty" scrolling="no" marginwidth="0" marginheight="0">
73 <frame src="<?php echo $updatemode ?>.php?<?php echo $params ?>" name="jsupdate" scrolling="no" marginwidth="0" marginheight="0">
74 <frame src="chatmsg.php?<?php echo $params ?>" name="msg" scrolling="auto" marginwidth="2" marginheight="1">
75 <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1">
76 </frameset>
77 <frame src="users.php?<?php echo $params ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
78 </frameset>
79 <noframes>
80 Sorry, this version of Moodle Chat needs a browser that handles frames.
81 </noframes>
82 </html>