2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
13 if (!defined('TR_INCLUDE_PATH')) { exit; }
14 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
15 require_once(TR_INCLUDE_PATH.'classes/DAO/CourseCategoriesDAO.class.php');
16 require_once(TR_INCLUDE_PATH.'classes/DAO/CoursesDAO.class.php');
20 $courseCategoriesDAO = new CourseCategoriesDAO();
21 $coursesDAO = new CoursesDAO();
24 // get the number of courses in each category
25 $courses_in_category = $coursesDAO->getCategoriesAndNumOfCourses();
27 if (is_array($courses_in_category)) {
28 foreach ($courses_in_category as $row){
29 $course_num_summary[$row['category_id']] = $row['num_of_courses'];
34 $categories = $courseCategoriesDAO->getAll();
36 if (is_array($categories)) {
37 foreach ($categories as $category) {
38 $output .= '<a href="'.TR_BASE_HREF.'home/index.php?catid='.$category['category_id'].'">';
40 if ($_GET['catid'] <> '' && $_GET['catid'] == $category['category_id']) {
41 $output .= '<span class="selected-sidemenu">';
43 $output .= $category['category_name'].' ';
44 if (isset($course_num_summary[$category['category_id']])) {
45 $output .= '('.$course_num_summary[$category['category_id']].')';
50 if ($_GET['catid'] <> '' && $_GET['catid'] == $category['category_id']) {
53 $output .= '</a><br />';
58 if (isset($course_num_summary[0])) {
59 $output .= '<a href="'.TR_BASE_HREF.'home/index.php?catid=0">';
61 if ($_GET['catid'] <> '' && $_GET['catid'] == 0) {
62 $output .= '<span class="selected-sidemenu">';
65 $output .= _AT('cats_uncategorized').' ('.$course_num_summary[0].')';
66 if ($_GET['catid'] <> '' && $_GET['catid'] == 0) {
69 $output .= '</a><br />';
73 $output = _AT('none_found');
75 $savant->assign('title', _AT('category'));
76 $savant->assign('dropdown_contents', $output);
77 //$savant->assign('default_status', "hide");
79 $savant->display('include/box.tmpl.php');