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 /************************************************************************/
14 define('TR_INCLUDE_PATH', '../include/');
15 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
16 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
17 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
20 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
22 if (isset($_GET['edit'], $_GET['id'])) {
23 header('Location: edit_test.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
25 } else if (isset($_GET['preview'], $_GET['id'])) {
26 header('Location: preview.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
28 } else if (isset($_GET['questions'], $_GET['id'])) {
29 header('Location: questions.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
31 } else if (isset($_GET['delete'], $_GET['id'])) {
32 header('Location: delete_test.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
34 } else if (isset($_GET['export'], $_GET['id'])){
35 header('Location: export_test.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
36 } else if (isset($_GET['edit'])
37 || isset($_GET['preview'])
38 || isset($_GET['questions'])
39 || isset($_GET['delete'])
40 || isset($_GET['export'])) {
42 $msg->addError('NO_ITEM_SELECTED');
45 $testsDAO = new TestsDAO();
46 /* get a list of all the tests we have, and links to create, edit, delete, preview */
47 $rows = $testsDAO->getByCourseID($_course_id);
49 require_once(TR_INCLUDE_PATH.'header.inc.php');
51 $savant->assign('course_id', $_course_id);
52 $savant->assign('rows', $rows);
54 $savant->display('tests/index.tmpl.php');
56 require_once(TR_INCLUDE_PATH.'footer.inc.php'); ?>