AC_4897, AC_4898, AC_4899: Multifile uploader fixes.
[acontent.git] / course_category / index.php
1 <?php\r
2 /************************************************************************/\r
3 /* AContent                                                             */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2010                                                   */\r
6 /* Inclusive Design Institute                                           */\r
7 /*                                                                      */\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
12 \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
16 \r
17 $courseCategoriesDAO = new CourseCategoriesDAO();\r
18 \r
19 // handle submit\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
24         exit;\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
28         exit;\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
34 }\r
35 \r
36 $savant->assign('rows', $courseCategoriesDAO->getAll());\r
37 \r
38 $savant->display('course_category/index.tmpl.php');\r
39 \r
40 ?>\r