2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
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 /************************************************************************/
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/Utility.class.php');
17 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsDAO.class.php');
18 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsAssocDAO.class.php');
21 //Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
22 $testsDAO = new TestsDAO();
23 $testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
25 $_letters = array(_AT('a'), _AT('b'), _AT('c'), _AT('d'), _AT('e'), _AT('f'), _AT('g'), _AT('h'), _AT('i'), _AT('j'));
28 header('Location: index.php?_course_id='.$_course_id);
32 if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE) {
33 $content_base_href = 'get.php/';
35 $content_base_href = 'content/' . $_SESSION['course_id'] . '/';
38 require_once(TR_INCLUDE_PATH.'header.inc.php');
40 $tid = intval($_GET['tid']);
42 // check that the test_id is correct
43 if (!($test_row = $testsDAO->get($tid))) {
44 $msg->printErrors('ITEM_NOT_FOUND');
45 require (TR_INCLUDE_PATH.'footer.inc.php');
49 $rows = $testsQuestionsAssocDAO->getByTestID($tid);
52 <form method="post" action="<?php echo $_SERVER['PHP_SELF'].'?_course_id='.$_course_id; ?>" name="preview">
54 <?php if (is_array($rows)) {?>
55 <div class="input-form">
56 <div class="row"><h2><?php echo $test_row['title']; ?></h2></div>
59 <?php if ($test_row['instructions'] != ''): ?>
60 <div style="background-color: #f3f3f3; padding: 5px 10px; margin: 0px; border-top: 1px solid">
61 <strong><?php echo _AT('instructions'); ?></strong>
63 <div class="row" style="padding-bottom: 20px"><?php echo $test_row['instructions']; ?></div>
67 foreach ($rows as $row) {
68 $o = TestQuestions::getQuestion($row['type']);
72 // "back" button only appears when the request is from index page of "tests" module
73 if (stripos($_SERVER['HTTP_REFERER'], 'tests/index.php')) { ?>
74 <div class="row buttons">
75 <input type="submit" value="<?php echo _AT('back'); ?>" name="back" />
80 <script type="text/javascript">
82 function iframeSetHeight(id, height) {
83 document.getElementById("qframe" + id).style.height = (height + 20) + "px";
89 $msg->printErrors('NO_QUESTIONS');
93 require_once(TR_INCLUDE_PATH.'footer.inc.php');