2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or */
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /************************************************************************/
\r
16 define('AT_INCLUDE_PATH', '../../../include/');
\r
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
19 authenticate(AT_PRIV_TESTS);
\r
20 if (isset($_POST['submit_yes'])) {
\r
21 $_POST['catid'] = intval($_POST['catid']);
\r
24 $sql = "DELETE FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id=$_SESSION[course_id] AND category_id=".$_POST['catid'];
\r
25 $result = mysql_query($sql, $db);
\r
27 //set all q's that use this cat to have cat=0
\r
28 $sql = "UPDATE ".TABLE_PREFIX."tests_questions SET category_id=0 WHERE course_id=$_SESSION[course_id] AND category_id=".$_POST['catid'];
\r
29 $result = mysql_query($sql, $db);
\r
31 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
\r
32 header('Location: '.AT_BASE_HREF.'mods/_standard/tests/question_cats.php');
\r
35 } else if (isset($_POST['submit_no'])) {
\r
36 $msg->addFeedback('CANCELLED');
\r
37 header('Location: '.AT_BASE_HREF.'mods/_standard/tests/question_cats.php');
\r
39 } else if (!isset($_GET['catid'])) {
\r
40 require(AT_INCLUDE_PATH.'header.inc.php');
\r
41 $msg->addError('ITEM_NOT_FOUND');
\r
42 $msg->printErrors();
\r
43 require(AT_INCLUDE_PATH.'footer.inc.php');
\r
47 require(AT_INCLUDE_PATH.'header.inc.php');
\r
49 $_GET['catid'] = intval($_GET['catid']);
\r
51 $sql = "SELECT title FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id=$_SESSION[course_id] AND category_id=$_GET[catid]";
\r
52 $result = mysql_query($sql, $db);
\r
53 $row = mysql_fetch_array($result);
\r
55 $hidden_vars['catid'] = $_GET['catid'];
\r
57 $msg->addConfirm(array('DELETE_TEST_CATEGORY', $row['title']), $hidden_vars);
\r
59 $msg->printConfirm();
\r
61 require(AT_INCLUDE_PATH.'footer.inc.php');
\r