cecd9c2707d310e0790546f6978ea7f588da3316
[atutor.git] / mods / openmeetings / openmeetings_delete.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_delete.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
19 //local variables
20 $course_id = $_SESSION['course_id'];
21
22 //validate variables
23 $_REQUEST['room_id'] = intval($_REQUEST['room_id']);
24
25 //Initiate Openmeeting
26 $om_obj = new Openmeetings($course_id, $_SESSION['member_id']);
27
28 //Login
29 $om_obj->om_login();
30
31 //Handles form actions
32 if (isset($_POST['submit']) && $_REQUEST['room_id']){
33         //have to makesure the user really do have permission over the paramater room id
34         if ($om_obj->isMine($_REQUEST['room_id']) || authenticate(AT_PRIV_OPENMEETINGS, true)){
35                 $om_obj->om_deleteRoom($_REQUEST['room_id']);
36                 $msg->addFeedback('OPENMEETINGS_DELETE_SUCEEDED');
37                 header('Location: index.php');
38                 exit;
39         } else {
40                 $msg->addError('OPENMEETINGS_DELETE_FAILED');
41         }
42 } elseif (isset($_POST['cancel'])) {
43         $msg->addFeedback('OPENMEETINGS_CANCELLED');
44         header('Location: index.php');
45         exit;
46 }
47
48 //Header begins here
49 require (AT_INCLUDE_PATH.'header.inc.php');
50 ?>
51
52 <form action="<?php  $_SERVER['PHP_SELF']; ?>" method="post">
53         <div class="input-form">
54                 <div class="row">
55                         <p><?php echo _AT('openmeetings_confirm_delete'); ?></p>        
56                 </div>
57                 <div class="row buttons">
58                         <input type="hidden" name="room_id" value="<?php echo $_REQUEST['room_id']; ?>" />
59                         <input type="submit" name="submit" value="<?php echo _AT('yes'); ?>"  />
60                         <input type="submit" name="cancel" value="<?php echo _AT('no'); ?>" />
61                 </div>
62         </div>
63 </form>
64
65 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>