moved code up one level to eliminate the docs subdirectory
[acontent.git] / tests / index.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
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 /************************************************************************/
12
13 $page = 'tests';
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');
18
19 global $_course_id;
20 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
21
22 if (isset($_GET['edit'], $_GET['id'])) {
23         header('Location: edit_test.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
24         exit;
25 } else if (isset($_GET['preview'], $_GET['id'])) {
26         header('Location: preview.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
27         exit;
28 } else if (isset($_GET['questions'], $_GET['id'])) {
29         header('Location: questions.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
30         exit;
31 } else if (isset($_GET['delete'], $_GET['id'])) {
32         header('Location: delete_test.php?tid='.$_GET['id'].'&_course_id='.$_course_id);
33         exit;
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'])) {
41
42         $msg->addError('NO_ITEM_SELECTED');
43 }
44
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);
48
49 require_once(TR_INCLUDE_PATH.'header.inc.php');
50
51 $savant->assign('course_id', $_course_id);
52 $savant->assign('rows', $rows);
53
54 $savant->display('tests/index.tmpl.php');
55
56 require_once(TR_INCLUDE_PATH.'footer.inc.php'); ?>