made a copy
[atutor.git] / admin / language_delete.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 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 // $Id$
14
15 define('AT_INCLUDE_PATH', '../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_LANGUAGES);
18
19 if (isset($_POST['submit_no'])) {
20         $msg->addFeedback('CANCELLED');
21         //shozub -- is this supposed to be lang_codeinstead of delete_lang???
22         header('Location: language.php?lang_code='.$_POST['delete_lang']);
23         exit;
24 }
25
26 if (isset($_POST['submit_yes'])) {
27         require_once(AT_INCLUDE_PATH . 'classes/Language/LanguageEditor.class.php');
28
29         $lang =& $languageManager->getLanguage($_POST['lang_code']);
30         $languageEditor =& new LanguageEditor($lang);
31         $languageEditor->deleteLanguage();
32
33         $msg->addFeedback('LANG_DELETED');
34         header('Location: language.php');
35         exit;
36 }
37
38
39 $language =& $languageManager->getLanguage($_GET['lang_code']);
40 if ($language === FALSE) {
41         $msg->addError('ITEM_NOT_FOUND'); // Originally AT_LANG_NOT_FOUND, make error code
42
43         header('Location: language.php?lang_code='.$_POST['delete_lang']);
44         exit;
45 }
46
47 require(AT_INCLUDE_PATH.'header.inc.php'); 
48
49 $hidden_vars['lang_code'] = $_GET['lang_code'];
50
51 $confirm = array('DELETE_LANG', $language->getEnglishName());
52 $msg->addConfirm($confirm, $hidden_vars);
53 $msg->printConfirm();
54         
55 require(AT_INCLUDE_PATH.'footer.inc.php'); 
56
57 ?>