move code up one directory
[atutor.git] / mods / _standard / chat / manage / delete_transcript.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* Inclusive Design Institute                                           */
7 /* http://atutor.ca                                                     */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12 // $Id$
13 define('AT_INCLUDE_PATH', '../../../../include/');
14 require(AT_INCLUDE_PATH.'vitals.inc.php');
15
16
17 if ($_POST['m']) {
18         $m =str_replace('.', '', $_POST['m']);
19 } else if ($_GET['m']) {
20         $m =str_replace('.', '', $_GET['m']);
21 }
22
23 if ($_POST['submit_no']) {
24         $msg->addFeedback('CANCELLED');
25         Header('Location: index.php');
26         exit;
27 }
28
29 if ($_POST['submit_yes']) {
30         unlink(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/'.$m.'.html');
31
32         //if its the current tran, unset it
33         if (str_replace('.html', '', $admin['tranFile']) == $m) {
34                 $admin['produceTran'] = 0;
35                 writeAdminSettings($admin);
36         }
37
38         $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
39         Header('Location: index.php');
40         exit;
41 }
42
43 if (!file_exists(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/'.$m.'.html')) {
44         $msg->addError('FILE_NOT_FOUND');
45
46         header('Location: index.php');
47         exit;
48 }
49
50 require(AT_INCLUDE_PATH.'header.inc.php');
51
52 $hidden_vars['m'] = $m;
53
54 $msg->addConfirm(array('DELETE_TRANSCRIPT', $m), $hidden_vars);
55 $msg->printConfirm();
56
57 require(AT_INCLUDE_PATH.'footer.inc.php');
58 ?>