/**
  * This function prints the drop down list box for question categories
  * @access  public
  * @param   categoryID
  * @author  Cindy Qi Li
  */
 public static function printQuestionCatsInDropDown($categoryID = 0)
 {
     global $_course_id;
     require_once TR_INCLUDE_PATH . "classes/DAO/TestsQuestionsCategoriesDAO.class.php";
     echo '<option value="0"';
     if ($categoryID == 0) {
         echo ' selected="selected"';
     }
     echo '>' . _AT('cats_uncategorized') . '</option>' . "\n";
     $testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
     $rows = $testsQuestionsCategoriesDAO->getByCourseID($_course_id);
     if (is_array($rows)) {
         foreach ($rows as $row) {
             echo '<option value="' . $row['category_id'] . '"';
             if ($row['category_id'] == $categoryID) {
                 echo ' selected="selected"';
             }
             echo '>' . $row['title'] . '</option>' . "\n";
         }
     }
 }
/* 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.                        */
/************************************************************************/
$page = 'tests';
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsCategoriesDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
if (isset($_POST['submit_yes'])) {
    $_POST['catid'] = intval($_POST['catid']);
    $testsQuestionsDAO = new TestsQuestionsDAO();
    //remove category
    if ($testsQuestionsCategoriesDAO->Delete($_POST['catid']) && $testsQuestionsDAO->UpdateField($_POST['catid'], 'category_id', 0)) {
        //set all qestions that use this category to have category=0
        $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
        header('Location: ' . TR_BASE_HREF . 'tests/question_cats.php?_course_id=' . $_course_id);
        exit;
    }
} else {
    if (isset($_POST['submit_no'])) {
        $msg->addFeedback('CANCELLED');
        header('Location: ' . TR_BASE_HREF . 'tests/question_cats.php?_course_id=' . $_course_id);
        exit;
Beispiel #3
0
/* as published by the Free Software Foundation.                        */
/************************************************************************/
$page = 'tests';
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsCategoriesDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id, $msg;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
if (isset($_POST['edit'], $_POST['category'])) {
    //	debug('question_cats_manage.php?catid='.$_POST['category'].'&_course_id='.$_course_id);exit;
    header('Location: question_cats_manage.php?catid=' . $_POST['category'] . '&_course_id=' . $_course_id);
    exit;
} else {
    if (isset($_POST['delete'], $_POST['category'])) {
        header('Location: question_cats_delete.php?catid=' . $_POST['category'] . '&_course_id=' . $_course_id);
        exit;
    } else {
        if (!empty($_POST)) {
            $msg->addError('NO_ITEM_SELECTED');
        }
    }
}
require_once TR_INCLUDE_PATH . 'header.inc.php';
$testsQuestionsCategories = new TestsQuestionsCategoriesDAO();
$rows = $testsQuestionsCategories->getByCourseID($_course_id);
$savant->assign('course_id', $_course_id);
$savant->assign('rows', $rows);
$savant->assign('msg', $msg);
$savant->display('tests/question_cats.tmpl.php');
require_once TR_INCLUDE_PATH . 'footer.inc.php';
/************************************************************************/
/* 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.                        */
/************************************************************************/
$page = 'tests';
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsCategoriesDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: question_cats.php');
    exit;
} else {
    if (isset($_POST['submit'])) {
        $_POST['title'] = trim($_POST['title']);
        if (!empty($_POST['title']) && !isset($_POST['catid'])) {
            if ($testsQuestionsCategoriesDAO->Create($_course_id, $_POST['title'])) {
                $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
                header('Location: question_cats.php?_course_id=' . $_course_id);
                exit;
            }
        } else {
            if (!empty($_POST['title']) && isset($_POST['catid'])) {
    exit;
}
global $_course_id;
if (isset($_GET['reset_filter'])) {
    unset($_GET['category_id']);
}
if (!isset($_GET['category_id'])) {
    // Suppress warnings
    $_GET['category_id'] = -1;
}
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsCategoriesDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
//require_once(TR_INCLUDE_PATH.'../tests/classes/TestsUtility.class.php');
$testsQuestionsDAO = new TestsQuestionsDAO();
$testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
$cats = array();
if ($_GET['category_id'] >= 0) {
    $category_row = $testsQuestionsCategoriesDAO->get($_GET[category_id]);
} else {
    $category_rows = $testsQuestionsCategoriesDAO->getByCourseID($_course_id);
}
//$result	= mysql_query($sql, $db);
if ($_GET['category_id'] <= 0) {
    $cats[] = array('title' => _AT('cats_uncategorized'), 'category_id' => 0);
}
if (is_array($category_rows)) {
    foreach ($category_rows as $row) {
        $cats[] = $row;
    }
} else {
Beispiel #6
0
/* 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.                        */
/************************************************************************/
$page = 'tests';
define('TR_INCLUDE_PATH', '../include/');
require_once TR_INCLUDE_PATH . 'vitals.inc.php';
require_once TR_INCLUDE_PATH . 'classes/testQuestions.class.php';
require_once TR_INCLUDE_PATH . 'classes/Utility.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsCategoriesDAO.class.php';
require_once TR_INCLUDE_PATH . 'classes/DAO/TestsQuestionsAssocDAO.class.php';
global $_course_id;
Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
$testsDAO = new TestsDAO();
$testsQuestionsCategoriesDAO = new TestsQuestionsCategoriesDAO();
$testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
$_pages['tests/questions.php']['title_var'] = 'questions';
$_pages['tests/questions.php']['parent'] = 'tests/index.php';
$_pages['tests/questions.php']['children'] = array('tests/add_test_questions.php?tid=' . $_GET['tid'] . '&_course_id=' . $_course_id);
$_pages['tests/add_test_questions.php?tid=' . $_GET['tid'] . '&_course_id=' . $_course_id]['title_var'] = 'add_questions';
$_pages['tests/add_test_questions.php?tid=' . $_GET['tid'] . '&_course_id=' . $_course_id]['parent'] = 'tests/questions.php?tid=' . $_GET['tid'] . '&_course_id=' . $_course_id;
$_pages['tests/questions.php']['guide'] = 'instructor/?p=add_questions.php';
$tid = intval($_REQUEST['tid']);
if (isset($_POST['submit'])) {
    $count = 1;
    foreach ($_POST['weight'] as $qid => $weight) {
        $qid = intval($qid);
        $weight = intval($weight);
        $orders = $_POST['ordering'];
        asort($orders);