move code up one directory
[atutor.git] / mods / _standard / social / groups / delete.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2009                                                                              */
6 /* Inclusive Design Institute                                   */
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$
14 $_user_location = 'public';
15
16 define('AT_INCLUDE_PATH', '../../../../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 require(AT_SOCIAL_INCLUDE.'constants.inc.php');
19 require(AT_SOCIAL_INCLUDE.'friends.inc.php');
20 require(AT_SOCIAL_INCLUDE.'classes/SocialGroups/SocialGroup.class.php');
21 require(AT_SOCIAL_INCLUDE.'classes/SocialGroups/SocialGroups.class.php');
22
23
24 // Get social group class
25 $social_groups = new SocialGroups();
26
27 // Get this group
28 $id = intval($_REQUEST['id']);  //make sure $_GET and $_POST don't overlap the use of 'id'
29 $sg = new SocialGroup($id);
30 $sgs = new SocialGroups();
31
32 //validate if this user is the administrator of the group
33 if ($sg->getUser() != $_SESSION['member_id']){
34         $msg->addError('CANT_DELETE_GROUP');
35         header('Location: index.php');
36         exit;
37 }
38
39 //delete group 
40 $msg->addFeedback('GROUP_DELETED');
41 $sgs->removeGroup($id);
42 header('Location: '.url_rewrite(AT_SOCIAL_BASENAME.'groups/index.php', AT_PRETTY_URL_HEADER));
43 exit;
44
45 //Display
46 /*
47 include(AT_INCLUDE_PATH.'header.inc.php');
48 $savant->assign('group_obj', $group);
49 $savant->assign('group_types', $social_groups->getAllGroupType());
50 $savant->display('sgroup_edit.tmpl.php');
51 include(AT_INCLUDE_PATH.'footer.inc.php');
52 */
53 ?>