예제 #1
0
 /**
  * This function prints the drop down list box for course categories
  * @access  public
  * @param   categoryID
  * @author  Cindy Qi Li
  */
 public static function printCourseCatsInDropDown($categoryID = 0)
 {
     require_once TR_INCLUDE_PATH . "classes/DAO/CourseCategoriesDAO.class.php";
     echo '<option value="' . TR_COURSECATEGORY_UNCATEGORIZED . '"';
     if ($categoryID == TR_COURSECATEGORY_UNCATEGORIZED) {
         echo ' selected="selected"';
     }
     echo '>' . _AT('cats_uncategorized') . '</option>' . "\n";
     $courseCategoriesDAO = new CourseCategoriesDAO();
     $rows = $courseCategoriesDAO->getAll();
     if (is_array($rows)) {
         foreach ($rows as $row) {
             echo '<option value="' . $row['category_id'] . '"';
             if ($row['category_id'] == $categoryID) {
                 echo ' selected="selected"';
             }
             echo '>' . $row['category_name'] . '</option>' . "\n";
         }
     }
 }
<?php

/************************************************************************/
/* AContent                                                             */
/************************************************************************/
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
include TR_INCLUDE_PATH . 'vitals.inc.php';
include_once TR_INCLUDE_PATH . 'classes/DAO/CourseCategoriesDAO.class.php';
$courseCategoriesDAO = new CourseCategoriesDAO();
$ids = explode(',', $_REQUEST['id']);
if (isset($_POST['submit_no'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: index.php');
    exit;
} else {
    if (isset($_POST['submit_yes'])) {
        foreach ($ids as $id) {
            $courseCategoriesDAO->Delete($id);
        }
        $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        header('Location: index.php');
        exit;
    }
}
예제 #3
0
        $_tmp_base_href .= $content_base_href;
    }
}
// Setup array of content tools for shortcuts tool bar.
$savant->assign('tool_shortcuts', $_tool_shortcuts);
// array of content tools for shortcuts tool bar.
$savant->assign('content_base_href', $_tmp_base_href);
$savant->assign('lang_code', $_SESSION['lang']);
$savant->assign('lang_charset', $myLang->getCharacterSet());
$savant->assign('base_path', $_base_path);
$savant->assign('theme', $_SESSION['prefs']['PREF_THEME']);
$theme_img = $_base_path . 'themes/' . $_SESSION['prefs']['PREF_THEME'] . '/images/';
$savant->assign('img', $theme_img);
// course categories for search tool
require_once TR_INCLUDE_PATH . 'classes/DAO/CourseCategoriesDAO.class.php';
$courseCategoriesDAO = new CourseCategoriesDAO();
$savant->assign('categories', $courseCategoriesDAO->getAll());
// get custom css
$custom_css = '';
if (isset($_custom_css)) {
    $custom_css = '<link rel="stylesheet" href="' . $_custom_css . '" type="text/css" />';
}
if (isset($_custom_head)) {
    $custom_css .= '
' . $_custom_head;
}
if (isset($_pages[$current_page]['guide'])) {
    $script_name = substr($_SERVER['PHP_SELF'], strlen($_base_path));
    $savant->assign('guide', TR_GUIDES_PATH . 'index.php?p=' . htmlentities_utf8($script_name));
}
$savant->assign('custom_css', $custom_css);
/************************************************************************/
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
include TR_INCLUDE_PATH . 'vitals.inc.php';
include_once TR_INCLUDE_PATH . 'classes/DAO/CourseCategoriesDAO.class.php';
if ($_POST['value'] == '') {
    $rtn['status'] = 'fail';
    $rtn['error'][] = _AT('TR_ERROR_EMPTY_FIELD');
}
if (isset($_POST['field']) && isset($_POST['value']) && $_POST['value'] != '') {
    $courseCategoriesDAO = new CourseCategoriesDAO();
    // Format of $_POST['field']: [fieldName]|[user_id]
    $pieces = explode('-', $_POST['field']);
    $status = $courseCategoriesDAO->Update($pieces[1], $_POST['value']);
    if (is_array($status)) {
        $rtn['status'] = 'fail';
        foreach ($status as $err) {
            $rtn['error'][] = $err;
        }
    } else {
        $rtn['status'] = 'success';
        $rtn['success'][] = _AT('TR_FEEDBACK_ACTION_COMPLETED_SUCCESSFULLY');
    }
}
echo json_encode($rtn);
예제 #5
0
/************************************************************************/
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
if (!defined('TR_INCLUDE_PATH')) {
    exit;
}
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/CourseCategoriesDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/CoursesDAO.class.php';
global $savant;
$courseCategoriesDAO = new CourseCategoriesDAO();
$coursesDAO = new CoursesDAO();
$output = '';
// get the number of courses in each category
$courses_in_category = $coursesDAO->getCategoriesAndNumOfCourses();
if (is_array($courses_in_category)) {
    foreach ($courses_in_category as $row) {
        $course_num_summary[$row['category_id']] = $row['num_of_courses'];
    }
}
// get all categories
$categories = $courseCategoriesDAO->getAll();
if (is_array($categories)) {
    foreach ($categories as $category) {
        $output .= '<a href="' . TR_BASE_HREF . 'home/index.php?catid=' . $category['category_id'] . '">';
        if ($_GET['catid'] != '' && $_GET['catid'] == $category['category_id']) {
예제 #6
0
<?php

/************************************************************************/
/* AContent                                                             */
/************************************************************************/
/* Copyright (c) 2010                                                   */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
define('TR_INCLUDE_PATH', '../include/');
include TR_INCLUDE_PATH . 'vitals.inc.php';
include TR_INCLUDE_PATH . 'classes/DAO/CourseCategoriesDAO.class.php';
$courseCategoriesDAO = new CourseCategoriesDAO();
// handle submit
if (isset($_POST['edit']) && isset($_POST['id']) && count($_POST['id']) > 1) {
    $msg->addError('SELECT_ONE_ITEM');
} else {
    if (isset($_POST['edit'], $_POST['id'])) {
        header('Location: course_category_edit.php?id=' . $_POST['id'][0]);
        exit;
    } else {
        if (isset($_POST['delete'], $_POST['id'])) {
            $ids = implode(',', $_POST['id']);
            header('Location: course_category_delete.php?id=' . $ids);
            exit;
        } else {
            if (isset($_POST['edit']) || isset($_POST['delete'])) {
                $msg->addError('NO_ITEM_SELECTED');