5e787506bf239c17bdedae796f260dcb0decc26d
[atutor.git] / mods / openmeetings / html / group_meeting.inc.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: group_meeting.inc.php 7208 2008-01-09 16:07:24Z harrisw $
14
15 if (empty($_SESSION['groups'])) {
16         echo '<div class="openmeetings"><h5>'._AT('openmeetings_group_conference').'</h5>';
17         echo _AT('openmeetings_no_group_meetings').'</div>';
18 } else {
19         echo '<div class="openmeetings"><h5>'._AT('openmeetings_group_conference').'</h5>';
20         $group_list = implode(',', $_SESSION['groups']);
21         $sql = "SELECT group_id, title FROM ".TABLE_PREFIX."groups WHERE group_id IN ($group_list) ORDER BY title";
22
23         $result = mysql_query($sql, $db);
24
25         echo '<ul>';
26         //loop through each group and print out a link beside them 
27         while ($row = mysql_fetch_assoc($result)) {
28                 //Check in the db and see if this group has a meeting alrdy, create on if not.
29                 $om_obj->setGid($row['group_id']);
30                 if ($om_obj->om_getRoom()){
31                         //Log into the room
32                         $room_id = $om_obj->om_addRoom($room_name);
33                         echo '<li>'.$row['title'].' <a href="mods/openmeetings/view_meetings.php?room_id='.$room_id.SEP.'sid='.$om_obj->getSid().'"> Room-id: '.$room_id.'</a>';
34                         if ($om_obj->isMine($room_id) || authenticate(AT_PRIV_OPENMEETINGS, true)) {
35                                 //if 'I' created this room, then I will have the permission to edit/delete it from the database.
36                                 echo ' <a href="mods/openmeetings/add_group_meetings.php?edit_room=yes&room_id='.$room_id.'">['._AT('edit').']</a>';
37                                 echo ' <a href="mods/openmeetings/openmeetings_delete.php?room_id='.$room_id.'">['._AT('delete').']</a>';
38                                 
39                         }
40                         echo '</li>';
41                 } else {
42                         echo '<li>'.$row['title'].' <a href="mods/openmeetings/add_group_meetings.php?group_id='.$row['group_id'].'"> Start a conference </a>'.'</li>';
43                 }
44         }
45         echo '</ul></div>';
46 }
47
48 ?>