AC_4897, AC_4898, AC_4899: Multifile uploader fixes.
[acontent.git] / tests / edit_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 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
21
22 $tid = intval($_REQUEST['tid']);
23 $testsDAO = new TestsDAO();
24 $row = $testsDAO->get($tid);
25
26 if (isset($_POST['cancel'])) {
27         $msg->addFeedback('CANCELLED');
28         header('Location: index.php?_course_id='.$_course_id);
29         exit;
30 } else if (isset($_POST['submit'])) {
31         if ($testsDAO->Update($_POST['tid'], $_POST['title'], $_POST['description']))
32         {
33                 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');             
34                 header('Location: index.php?_course_id='.$_course_id);
35                 exit;
36         }
37 }
38
39 $onload = 'document.form.title.focus();';
40
41 require_once(TR_INCLUDE_PATH.'header.inc.php');
42 $msg->printErrors();
43
44 $savant->assign('course_id', $_course_id);
45 $savant->assign('tid', $tid);
46 $savant->assign('row', $row);
47
48 $savant->display('tests/create_edit_test.tmpl.php');
49
50 require (TR_INCLUDE_PATH.'footer.inc.php'); 
51
52 ?>