282d441c02ca519b797b37f0dd1671aaeb1d37df
[atutor.git] / docs / mods / _standard / tests / export_test.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* Inclusive Design Institute                                           */
7 /* http://atutor.ca                                                     */
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 // $Id$
13 define('AT_INCLUDE_PATH', '../../../include/');
14 require(AT_INCLUDE_PATH.'vitals.inc.php');
15 require(AT_INCLUDE_PATH.'../mods/_standard/tests/classes/testQuestions.class.php');
16
17 authenticate(AT_PRIV_TESTS);
18
19 $tid = intval($_GET['tid']);
20
21 /* Retrieve the content_id of this test */
22 $sql = "SELECT title, random, num_questions, instructions FROM ".TABLE_PREFIX."tests WHERE test_id=$tid";
23 $result = mysql_query($sql, $db); 
24 if (!($test_row = mysql_fetch_assoc($result))) {
25         $msg->addError('ITEM_NOT_FOUND');
26         header(url_rewrite('mods/_standard/tests/index.php', AT_PRETTY_URL_IS_HEADER));
27         exit;
28 }
29
30 //export
31 test_qti_export($tid, $test_row['title']);
32 ?>