Differences Between: [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 require_once('../../../config.php'); 18 require_once ('../lib.php'); 19 20 $id = required_param('id', PARAM_INT); 21 $groupid = optional_param('groupid', 0, PARAM_INT); // Only for teachers. 22 23 $url = new moodle_url('/mod/chat/gui_header_js/index.php', array('id' => $id)); 24 if ($groupid !== 0) { 25 $url->param('groupid', $groupid); 26 } 27 $PAGE->set_url($url); 28 29 if (!$chat = $DB->get_record('chat', array('id' => $id))) { 30 print_error('invalidid', 'chat'); 31 } 32 33 if (!$course = $DB->get_record('course', array('id' => $chat->course))) { 34 print_error('invalidcourseid'); 35 } 36 37 if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) { 38 print_error('invalidcoursemodule'); 39 } 40 41 $context = context_module::instance($cm->id); 42 43 require_login($course, false, $cm); 44 45 require_capability('mod/chat:chat', $context); 46 47 // Check to see if groups are being used here. 48 if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used. 49 if ($groupid = groups_get_activity_group($cm)) { 50 if (!$group = groups_get_group($groupid)) { 51 print_error('invalidgroupid'); 52 } 53 $groupname = ': '.$group->name; 54 } else { 55 $groupname = ': '.get_string('allparticipants'); 56 } 57 } else { 58 $groupid = 0; 59 $groupname = ''; 60 } 61 62 $strchat = get_string('modulename', 'chat'); // Must be before current_language() in chat_login_user() to force course language! 63 64 if (!$chatsid = chat_login_user($chat->id, 'header_js', $groupid, $course)) { 65 print_error('cantlogin', 'chat'); 66 } 67 68 $params = "chat_id=$id&chat_sid={$chatsid}"; 69 70 // Fallback to the old jsupdate, but allow other update modes. 71 $updatemode = 'jsupdate'; 72 if (!empty($CFG->chat_normal_updatemode)) { 73 $updatemode = $CFG->chat_normal_updatemode; 74 } 75 76 $courseshortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id))); 77 ?> 78 79 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> 80 <html> 81 <head> 82 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 83 <title> 84 <?php echo "$strchat: " . $courseshortname . ": ". 85 format_string($chat->name, true, array('context' => $context)) . "$groupname" ?> 86 </title> 87 </head> 88 <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1"> 89 <frameset rows="0,0,*,50" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1"> 90 <frame src="../empty.php" name="empty" scrolling="no" marginwidth="0" marginheight="0"> 91 <frame src="<?php echo $updatemode ?>.php?<?php echo $params ?>" name="jsupdate" scrolling="no" marginwidth="0" marginheight="0"> 92 <frame src="chatmsg.php?<?php echo $params ?>" name="msg" scrolling="auto" marginwidth="2" marginheight="1"> 93 <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1"> 94 </frameset> 95 <frame src="users.php?<?php echo $params ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5"> 96 </frameset> 97 <noframes> 98 Sorry, this version of Moodle Chat needs a browser that handles frames. 99 </noframes> 100 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body