AC_4897, AC_4898, AC_4899: Multifile uploader fixes.
[acontent.git] / docs / tests / export_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 define('TR_INCLUDE_PATH', '../include/');
14 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
15 require_once(TR_INCLUDE_PATH.'classes/testQuestions.class.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 $testsDAO = new TestsDAO();
22
23 $tid = intval($_GET['tid']);
24
25 /* Retrieve the content_id of this test */
26 if (!($test_row = $testsDAO->get($tid))) {
27         $msg->addError('ITEM_NOT_FOUND');
28         header('Location: index.php?_course_id='.$_course_id);
29         exit;
30 }
31
32 //export
33 if (!test_qti_export($tid, $test_row['title'])) {
34         $msg->addInfo('TEST_NO_QUESTION');
35         header('Location: index.php?_course_id='.$_course_id);
36         exit;
37 }
38 ?>