2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2010 */
\r
6 /* Inclusive Design Institute */
\r
8 /* This program is free software. You can redistribute it and/or */
\r
9 /* modify it under the terms of the GNU General Public License */
\r
10 /* as published by the Free Software Foundation. */
\r
11 /************************************************************************/
\r
14 define('TR_INCLUDE_PATH', '../include/');
\r
15 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
\r
16 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsCategoriesDAO.class.php');
\r
17 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
\r
18 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
\r
22 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
\r
24 $testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
\r
26 if (isset($_POST['submit_yes'])) {
\r
27 $_POST['catid'] = intval($_POST['catid']);
\r
29 $testsQuestionsDAO = new TestsQuestionsDAO();
\r
31 if ($testsQuestionsCategoriesDAO->Delete($_POST['catid']) && $testsQuestionsDAO->UpdateField($_POST['catid'], 'category_id', 0))
\r
33 //set all qestions that use this category to have category=0
\r
34 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
\r
35 header('Location: '.TR_BASE_HREF.'tests/question_cats.php?_course_id='.$_course_id);
\r
39 } else if (isset($_POST['submit_no'])) {
\r
40 $msg->addFeedback('CANCELLED');
\r
41 header('Location: '.TR_BASE_HREF.'tests/question_cats.php?_course_id='.$_course_id);
\r
43 } else if (!isset($_GET['catid'])) {
\r
44 require_once(TR_INCLUDE_PATH.'header.inc.php');
\r
45 $msg->addError('ITEM_NOT_FOUND');
\r
46 $msg->printErrors();
\r
47 require_once(TR_INCLUDE_PATH.'footer.inc.php');
\r
51 require_once(TR_INCLUDE_PATH.'header.inc.php');
\r
53 $_GET['catid'] = intval($_GET['catid']);
\r
55 $row = $testsQuestionsCategoriesDAO->get($_GET['catid']);
\r
57 $hidden_vars['catid'] = $_GET['catid'];
\r
58 $hidden_vars['_course_id'] = $_course_id;
\r
60 $msg->addConfirm(array('DELETE_TEST_CATEGORY', $row['title']), $hidden_vars);
\r
62 $msg->printConfirm();
\r
64 require_once(TR_INCLUDE_PATH.'footer.inc.php');
\r