29dd71e3430af74748b577ad19c4cc7adc92bf32
[acontent.git] / docs / tests / preview_question.php
1 <?php\r
2 /************************************************************************/\r
3 /* AContent                                                             */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2010                                                   */\r
6 /* Inclusive Design Institute                                           */\r
7 /*                                                                      */\r
8 /* This program is free software. You can redistribute it and/or        */\r
9 /* modify it under the terms of the GNU General Public License          */\r
10 /* as published by the Free Software Foundation.                        */\r
11 /************************************************************************/\r
12 \r
13 define('TR_INCLUDE_PATH', '../include/');\r
14 require_once(TR_INCLUDE_PATH.'vitals.inc.php');\r
15 require_once(TR_INCLUDE_PATH.'classes/testQuestions.class.php');\r
16 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');\r
17 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');\r
18 \r
19 global $_course_id;\r
20 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);\r
21 $testsQuestionsDAO = new TestsQuestionsDAO();\r
22 \r
23 $_letters = array(_AT('A'), _AT('B'), _AT('C'), _AT('D'), _AT('E'), _AT('F'), _AT('G'), _AT('H'), _AT('I'), _AT('J'));\r
24 \r
25 if (isset($_GET['submit'])) {\r
26         header('Location: '.TR_BASE_HREF.'tests/question_db.php?_course_id='.$_course_id);\r
27         exit;\r
28 }\r
29 \r
30 if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE) {\r
31         $content_base_href = 'get.php/';\r
32 } else {\r
33         $content_base_href = 'content/' . $_SESSION['course_id'] . '/';\r
34 }\r
35 \r
36 require_once(TR_INCLUDE_PATH.'header.inc.php');\r
37 \r
38 $qids = explode(',', $_GET['qid']);\r
39 $rows = $testsQuestionsDAO->getByQuestionIDs($qids);\r
40 ?>\r
41 \r
42 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">\r
43 <input type="hidden" name="_course_id" value="<?php echo $_course_id; ?>" />\r
44 <div class="input-form">\r
45         <?php\r
46         if (is_array($rows)) {\r
47                 foreach ($rows as $row) {\r
48                         $obj = TestQuestions::getQuestion($row['type']);\r
49                         $obj->display($row);\r
50                 }\r
51         }\r
52         ?>\r
53         <div class="row buttons"><input type="submit" name="submit" value="<?php echo _AT('back'); ?>"/></div>\r
54 </div>\r
55 </form>\r
56 <script type="text/javascript">\r
57 //<!--\r
58 function iframeSetHeight(id, height) {\r
59         document.getElementById("qframe" + id).style.height = (height + 30) + "px";\r
60 }\r
61 //-->\r
62 </script>\r
63 <?php require_once(TR_INCLUDE_PATH.'footer.inc.php'); ?>