tagging as ATutor 1.5.4-release
[atutor.git] / tools / chat / delete_transcript.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2004 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
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
14 define('AT_INCLUDE_PATH', '../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16
17
18 if ($_POST['m']) {
19         $m =str_replace('.', '', $_POST['m']);
20 } else if ($_GET['m']) {
21         $m =str_replace('.', '', $_GET['m']);
22 }
23
24 if ($_POST['submit_no']) {
25         $msg->addFeedback('CANCELLED');
26         Header('Location: index.php');
27         exit;
28 }
29
30 if ($_POST['submit_yes']) {
31         unlink(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/'.$m.'.html');
32
33         //if its the current tran, unset it
34         if (str_replace('.html', '', $admin['tranFile']) == $m) {
35                 $admin['produceTran'] = 0;
36                 writeAdminSettings($admin);
37         }
38
39         $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
40         Header('Location: index.php');
41         exit;
42 }
43
44 require(AT_INCLUDE_PATH.'header.inc.php');
45
46 if (!file_exists(AT_CONTENT_DIR . 'chat/'.$_SESSION['course_id'].'/tran/'.$m.'.html')) {
47         $msg->printErrors('NOT_FOUND');
48         require (AT_INCLUDE_PATH.'footer.inc.php');
49         exit;
50 }
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 ?>