30035c20ab3001ad281059df43b003f5d0fd903b
[atutor.git] / mods / openmeetings / openmeetings_group.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Cindy Qi Li, Harris Wong                */
6 /* Adaptive Technology Resource Centre / University of Toronto                  */
7 /* http://atutor.ca                                                                                                             */
8 /*                                                                                                                                              */
9 /* This program is free software. You can redistribute it and/or                */
10 /* modify it under the terms of the GNU General Public License                  */
11 /* as published by the Free Software Foundation.                                                */
12 /************************************************************************/
13 // $Id: openmeetings_group.php 7575 2008-06-02 18:17:14Z hwong $
14
15 define('AT_INCLUDE_PATH', '../../include/');
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
17 require ('lib/openmeetings.class.php');
18 require ('lib/openmeetings.inc.php');
19 //$_custom_css = $_base_path . 'mods/openmeetings/module.css'; // use a custom stylesheet
20
21 //local variables
22 $course_id = $_SESSION['course_id'];
23
24 // Check access
25 checkAccess($course_id);
26
27 $_GET['gid'] = intval($_GET['gid']);
28
29 //Initiate Openmeeting
30 $om_obj = new Openmeetings($course_id, $_SESSION['member_id']);
31
32 //Login
33 $om_obj->om_login();
34
35 //Group meetings
36 $sql = "SELECT title FROM ".TABLE_PREFIX."groups WHERE group_id=$_GET[gid] ORDER BY title";
37 //TODO: Check group permission from group table.
38 $result = mysql_query($sql, $db);
39 $row = mysql_fetch_assoc($result);
40
41 if (mysql_numrows($result) == 0){
42         echo '<div class="openmeetings">'._AT('openmeetings_no_group_meetings').'</div>';
43         require (AT_INCLUDE_PATH.'footer.inc.php');
44         exit;
45
46
47 //Check in the db and see if this group has a meeting alrdy, create on if not.
48 $om_obj->setGid($_GET['gid']);
49 if ($om_obj->om_getRoom()){
50         //Log into the room
51         $room_id = $om_obj->om_addRoom($room_name);
52         header('Location: '.AT_BASE_HREF.'mods/openmeetings/view_meetings.php?room_id='.$room_id.SEP.'sid='.$om_obj->getSid());
53         exit;
54 } else {
55         //Header begins here
56         require (AT_INCLUDE_PATH.'header.inc.php');
57         echo '<div class="openmeetings">'.$row['title'].'<a href="mods/openmeetings/add_group_meetings.php?group_id='.$_GET['gid'].'"> Start a conference </a></div>';
58         require (AT_INCLUDE_PATH.'footer.inc.php');
59 }
60 ?>