remove old readme
[atutor.git] / docs / mods / _standard / forums / delete_forum.php
1 <?php
2 /****************************************************************************/
3 /* ATutor                                                                                                                                       */
4 /****************************************************************************/
5 /* Copyright (c) 2002-2010                                                  */
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
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17
18 authenticate(AT_PRIV_FORUMS);
19
20 require (AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');
21
22 if (isset($_POST['submit_no'])) {
23         $msg->addFeedback('CANCELLED');
24         header('Location: '.AT_BASE_HREF.'mods/_standard/forums/index.php');
25         exit;
26 } else if (isset($_POST['submit_yes'])) {
27         $_POST['fid'] = intval($_POST['fid']);
28
29         // check if this forum is shared:
30         // (if this forum is shared, then we do not want to delete it.)
31         if (!is_shared_forum($_POST['fid']) && valid_forum_user($_POST['fid'])) {
32                 delete_forum($_POST['fid']);
33                 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
34         } else {
35                 $msg->addError('FORUM_NO_DEL_SHARE');
36         }
37         
38         header('Location: '.AT_BASE_HREF.'mods/_standard/forums/index.php');
39         exit;
40 }
41
42 $_section[0][0] = _AT('discussions');
43 $_section[0][1] = 'discussions/';
44 $_section[1][0] = _AT('forums');
45 $_section[1][1] = 'forum/list.php';
46 $_section[2][0] = _AT('delete_forum');
47
48 require(AT_INCLUDE_PATH.'header.inc.php');
49
50
51 $_GET['fid'] = intval($_GET['fid']); 
52
53 $row = get_forum($_GET['fid'], $_SESSION['course_id']);
54
55 if (!is_array($row)) {
56         $msg->addError('FORUM_NOT_ADDED');
57 } else { ?>
58         <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
59         <input type="hidden" name="delete_forum" value="true">
60         <input type="hidden" name="fid" value="<?php echo $_GET['fid']; ?>">
61                 
62         <?php
63         $hidden_vars['delete_forum'] = TRUE;
64         $hidden_vars['fid'] = $_GET['fid'];
65                         
66         $confirm = array('DELETE_FORUM', AT_print($row['title'], 'forums.title'));
67         $msg->addConfirm($confirm, $hidden_vars);
68         $msg->printConfirm();
69 }
70
71
72 require(AT_INCLUDE_PATH.'footer.inc.php');
73 ?>