moved code up one level to eliminate the docs subdirectory
[acontent.git] / tests / create_test.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/DAO/TestsDAO.class.php');
17 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
18
19 global $_course_id;
20
21 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
22
23 $test_type = 'normal';
24
25 if (isset($_POST['cancel'])) {
26         $msg->addFeedback('CANCELLED');
27         header('Location: index.php?_course_id='.$_course_id);
28         exit;
29 } else if (isset($_POST['submit'])) {
30         $testsDAO = new TestsDAO();
31         
32         if ($testsDAO->Create($_course_id, $_POST['title'], $_POST['description']))
33         {
34                 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
35                 header('Location: index.php?_course_id='.$_course_id);
36                 exit;
37         }
38 }
39
40 $onload = 'document.form.title.focus();';
41
42 $savant->assign('course_id', $_course_id);
43
44 require_once(TR_INCLUDE_PATH.'header.inc.php');
45 $msg->printErrors();
46
47 $savant->display('tests/create_edit_test.tmpl.php');
48
49 require (TR_INCLUDE_PATH.'footer.inc.php'); 
50
51 ?>