Beispiel #1
0
    if (isset($_GET['preview'], $_GET['id'])) {
        header('Location: preview.php?tid=' . $_GET['id'] . '&_course_id=' . $_course_id);
        exit;
    } else {
        if (isset($_GET['questions'], $_GET['id'])) {
            header('Location: questions.php?tid=' . $_GET['id'] . '&_course_id=' . $_course_id);
            exit;
        } else {
            if (isset($_GET['delete'], $_GET['id'])) {
                header('Location: delete_test.php?tid=' . $_GET['id'] . '&_course_id=' . $_course_id);
                exit;
            } else {
                if (isset($_GET['export'], $_GET['id'])) {
                    header('Location: export_test.php?tid=' . $_GET['id'] . '&_course_id=' . $_course_id);
                } else {
                    if (isset($_GET['edit']) || isset($_GET['preview']) || isset($_GET['questions']) || isset($_GET['delete']) || isset($_GET['export'])) {
                        $msg->addError('NO_ITEM_SELECTED');
                    }
                }
            }
        }
    }
}
$testsDAO = new TestsDAO();
/* get a list of all the tests we have, and links to create, edit, delete, preview */
$rows = $testsDAO->getByCourseID($_course_id);
require_once TR_INCLUDE_PATH . 'header.inc.php';
$savant->assign('course_id', $_course_id);
$savant->assign('rows', $rows);
$savant->display('tests/index.tmpl.php');
require_once TR_INCLUDE_PATH . 'footer.inc.php';
Beispiel #2
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.                        */
/************************************************************************/
if (!defined('TR_INCLUDE_PATH')) {
    exit;
}
global $_course_id, $_content_id;
include_once TR_INCLUDE_PATH . 'classes/DAO/ContentTestsAssocDAO.class.php';
include_once TR_INCLUDE_PATH . 'classes/DAO/TestsDAO.class.php';
/* Get the list of associated tests with this content on page load */
$cid = $_REQUEST['cid'] = $_content_id;
//uses request 'cause after 'saved', the cid will become $_GET.
$testsDAO = new TestsDAO();
$num_tests = 0;
$all_tests = $testsDAO->getByCourseID($_course_id);
/* get a list of all the tests we have, and links to create, edit, delete, preview */
//$sql	= "SELECT *, UNIX_TIMESTAMP(start_date) AS us, UNIX_TIMESTAMP(end_date) AS ue
//             FROM ".TABLE_PREFIX."tests
//            WHERE course_id=$_SESSION[course_id]
//            ORDER BY start_date DESC";
//$result	= mysql_query($sql, $db);
if (is_array($all_tests)) {
    $num_tests = count($all_tests);
}
//If there are no tests, don't display anything except a message
if ($num_tests == 0) {
    $msg->addInfo(array('NO_TESTS', TR_BASE_HREF . 'tests/create_test.php?_course_id=' . $_course_id));
    $msg->printInfos();
    return;
} else {