moved code up one level to eliminate the docs subdirectory
[acontent.git] / include / classes / CoursesUtility.class.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 /**\r
14 * Courses Utility functions \r
15 * @access       public\r
16 * @author       Cindy Qi Li\r
17 */\r
18 \r
19 if (!defined('TR_INCLUDE_PATH')) exit;\r
20 \r
21 class CoursesUtility {\r
22 \r
23         /**\r
24         * This function prints the drop down list box for course categories\r
25         * @access  public\r
26         * @param   categoryID\r
27         * @author  Cindy Qi Li\r
28         */\r
29         public static function printCourseCatsInDropDown($categoryID = 0) {     \r
30                 require_once(TR_INCLUDE_PATH."classes/DAO/CourseCategoriesDAO.class.php");\r
31         \r
32                 echo '<option value="'.TR_COURSECATEGORY_UNCATEGORIZED.'"';\r
33                 if ($categoryID == TR_COURSECATEGORY_UNCATEGORIZED) {\r
34                         echo ' selected="selected"';\r
35                 }\r
36                 echo '>'._AT('cats_uncategorized').'</option>' . "\n";\r
37         \r
38                 $courseCategoriesDAO = new CourseCategoriesDAO();\r
39                 $rows = $courseCategoriesDAO->getAll();\r
40 \r
41                 if (is_array($rows)) {\r
42                         foreach ($rows as $row) {\r
43                                 echo '<option value="'.$row['category_id'].'"';\r
44                                 if ($row['category_id'] == $categoryID) {\r
45                                         echo ' selected="selected"';\r
46                                 }\r
47                                 echo '>'.$row['category_name'].'</option>'."\n";\r
48                         }\r
49                 }\r
50         }\r
51 }\r
52 ?>