$testsQuestionsDAO = new TestsQuestionsDAO(); //remove category if ($testsQuestionsCategoriesDAO->Delete($_POST['catid']) && $testsQuestionsDAO->UpdateField($_POST['catid'], 'category_id', 0)) { //set all qestions that use this category to have category=0 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: ' . TR_BASE_HREF . 'tests/question_cats.php?_course_id=' . $_course_id); exit; } } else { if (isset($_POST['submit_no'])) { $msg->addFeedback('CANCELLED'); header('Location: ' . TR_BASE_HREF . 'tests/question_cats.php?_course_id=' . $_course_id); exit; } else { if (!isset($_GET['catid'])) { require_once TR_INCLUDE_PATH . 'header.inc.php'; $msg->addError('ITEM_NOT_FOUND'); $msg->printErrors(); require_once TR_INCLUDE_PATH . 'footer.inc.php'; exit; } } } require_once TR_INCLUDE_PATH . 'header.inc.php'; $_GET['catid'] = intval($_GET['catid']); $row = $testsQuestionsCategoriesDAO->get($_GET['catid']); $hidden_vars['catid'] = $_GET['catid']; $hidden_vars['_course_id'] = $_course_id; $msg->addConfirm(array('DELETE_TEST_CATEGORY', $row['title']), $hidden_vars); $msg->printConfirm(); require_once TR_INCLUDE_PATH . 'footer.inc.php';
if (isset($_GET['reset_filter'])) { unset($_GET['category_id']); } if (!isset($_GET['category_id'])) { // Suppress warnings $_GET['category_id'] = -1; } require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php'; require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsCategoriesDAO.class.php'; require_once TR_INCLUDE_PATH . 'classes/Utility.class.php'; //require_once(TR_INCLUDE_PATH.'../tests/classes/TestsUtility.class.php'); $testsQuestionsDAO = new TestsQuestionsDAO(); $testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO(); $cats = array(); if ($_GET['category_id'] >= 0) { $category_row = $testsQuestionsCategoriesDAO->get($_GET[category_id]); } else { $category_rows = $testsQuestionsCategoriesDAO->getByCourseID($_course_id); } //$result = mysql_query($sql, $db); if ($_GET['category_id'] <= 0) { $cats[] = array('title' => _AT('cats_uncategorized'), 'category_id' => 0); } if (is_array($category_rows)) { foreach ($category_rows as $row) { $cats[] = $row; } } else { if (isset($category_row) && $category_row != '') { $cats[] = $category_row; }