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
13 define('TR_INCLUDE_PATH', '../include/');
\r
14 include(TR_INCLUDE_PATH.'vitals.inc.php');
\r
15 include(TR_INCLUDE_PATH.'classes/DAO/CourseCategoriesDAO.class.php');
\r
17 $courseCategoriesDAO = new CourseCategoriesDAO();
\r
20 if (isset($_POST['edit']) && isset($_POST['id']) && count($_POST['id']) > 1) {
\r
21 $msg->addError('SELECT_ONE_ITEM');
\r
22 } else if (isset($_POST['edit'], $_POST['id'])) {
\r
23 header('Location: course_category_edit.php?id='.$_POST['id'][0]);
\r
25 } else if ( isset($_POST['delete'], $_POST['id'])) {
\r
26 $ids = implode(',', $_POST['id']);
\r
27 header('Location: course_category_delete.php?id='.$ids);
\r
29 } else if (isset($_POST['edit']) || isset($_POST['delete'])) {
\r
30 $msg->addError('NO_ITEM_SELECTED');
\r
31 } else if (isset($_POST['add'])) {
\r
32 if ($courseCategoriesDAO->Create($_POST['category_name']))
\r
33 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
\r
36 $savant->assign('rows', $courseCategoriesDAO->getAll());
\r
38 $savant->display('course_category/index.tmpl.php');
\r