MDL-35264 mod_chat Bigger frame for text input
[moodle.git] / mod / chat / gui_sockets / index.php
CommitLineData
eb588b22 1<?php
516121bd 2
eb588b22 3require_once('../../../config.php');
4require_once('../lib.php');
b19cad7f 5
eb588b22 6$id = required_param('id', PARAM_INT);
7$groupid = optional_param('groupid', 0, PARAM_INT); //only for teachers
b19cad7f 8
a6855934 9$url = new moodle_url('/mod/chat/gui_sockets/index.php', array('id'=>$id));
eb588b22 10if ($groupid !== 0) {
11 $url->param('groupid', $groupid);
12}
13$PAGE->set_url($url);
b19cad7f 14
eb588b22 15if (!$chat = $DB->get_record('chat', array('id'=>$id))) {
16 print_error('invalidid', 'chat');
17}
b19cad7f 18
eb588b22 19if (!$course = $DB->get_record('course', array('id'=>$chat->course))) {
20 print_error('invalidcourseid');
21}
b19cad7f 22
eb588b22 23if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
24 print_error('invalidcoursemodule');
25}
b19cad7f 26
4f0c2d00 27require_login($course, false, $cm);
8ebbb06a 28$context = get_context_instance(CONTEXT_MODULE, $cm->id);
b19cad7f 29
4f0c2d00 30if (isguestuser()) {
eb588b22 31 print_error('noguests', 'chat');
32}
33
b19cad7f 34/// Check to see if groups are being used here
eb588b22 35 if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used
36 if ($groupid = groups_get_activity_group($cm)) {
9250bf81 37 if (!$group = groups_get_group($groupid)) {
eb588b22 38 print_error('invalidgroupid');
b19cad7f 39 }
eb588b22 40 $groupname = ': '.$group->name;
b19cad7f 41 } else {
eb588b22 42 $groupname = ': '.get_string('allparticipants');
b19cad7f 43 }
eb588b22 44} else {
45 $groupid = 0;
46 $groupname = '';
47}
b19cad7f 48
eb588b22 49$strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!!
b19cad7f 50
eb588b22 51if (!$chat_sid = chat_login_user($chat->id, 'sockets', $groupid, $course)) {
52 print_error('cantlogin');
53}
516121bd 54
eb588b22 55$params = "chat_sid=$chat_sid";
8ebbb06a 56$courseshortname = format_string($course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
b19cad7f 57
eb588b22 58?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
1515a89e 59<html>
60 <head>
810944af 61 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
1515a89e 62 <title>
eb38d45b 63 <?php echo "$strchat: " . $courseshortname . ": " . format_string($chat->name, true, array('context' => $context)) . "$groupname" ?>
1515a89e 64 </title>
65 </head>
b19cad7f 66 <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
7737d24b 67 <frameset rows="0,*,70" border="0" framespacing="no" frameborder="no" marginwidth="2" marginheight="1">
1f8abb89 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&amp;$params"; ?>" scrolling="auto" name="msg" noresize marginwidth="2" marginheight="0">
b19cad7f 70 <frame src="chatinput.php?<?php echo $params ?>" name="input" scrolling="no" marginwidth="2" marginheight="1">
1515a89e 71 </frameset>
e2b5964e 72 <frame src="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport?win=users&amp;$params"; ?>" name="users" scrolling="auto" marginwidth="5" marginheight="5">
1515a89e 73 </frameset>
74 <noframes>
b19cad7f 75 Sorry, this version of Moodle Chat needs a browser that handles frames.
1515a89e 76 </noframes>
77</html>