Exemplo n.º 1
0
 /**
  * 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";
         }
     }
 }
Exemplo n.º 2
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';
Exemplo n.º 3
0
}
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 {
    if (isset($category_row) && $category_row != '') {
        $cats[] = $category_row;
    }
}
$cols = 3;