2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-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 /************************************************************************/
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 authenticate(AT_PRIV_TESTS);
19 if (isset($_GET['edit'], $_GET['id'])) {
20 header('Location: edit_test.php?tid='.$_GET['id']);
22 } else if (isset($_GET['preview'], $_GET['id'])) {
23 header('Location: preview.php?tid='.$_GET['id']);
25 } else if (isset($_GET['questions'], $_GET['id'])) {
26 header('Location: questions.php?tid='.$_GET['id']);
28 } else if (isset($_GET['submissions'], $_GET['id'])) {
29 header('Location: results.php?tid='.$_GET['id']);
31 } else if (isset($_GET['statistics'], $_GET['id'])) {
32 header('Location: results_all_quest.php?tid='.$_GET['id']);
34 } else if (isset($_GET['delete'], $_GET['id'])) {
35 header('Location: delete_test.php?tid='.$_GET['id']);
37 } else if (isset($_GET['export'], $_GET['id'])){
38 header('Location: export_test.php?tid='.$_GET['id']);
39 } else if (isset($_GET['edit'])
40 || isset($_GET['preview'])
41 || isset($_GET['questions'])
42 || isset($_GET['submissions'])
43 || isset($_GET['statistics'])
44 || isset($_GET['delete'])
45 || isset($_GET['export'])) {
47 $msg->addError('NO_ITEM_SELECTED');
50 require(AT_INCLUDE_PATH.'header.inc.php');
53 /* get a list of all the tests we have, and links to create, edit, delete, preview */
55 $sql = "SELECT *, UNIX_TIMESTAMP(start_date) AS us, UNIX_TIMESTAMP(end_date) AS ue FROM ".TABLE_PREFIX."tests WHERE course_id=$_SESSION[course_id] ORDER BY start_date DESC";
56 $result = mysql_query($sql, $db);
57 $num_tests = mysql_num_rows($result);
61 <form method="post" action="mods/_standard/tests/import_test.php" enctype="multipart/form-data" >
62 <div class="input-form" style="width: 90%">
63 <fieldset class="group_form"><legend class="group_form"><?php echo _AT('import_test'); ?></legend>
65 <label for="to_file"><?php echo _AT('upload_test'); ?></label><br />
66 <input type="file" name="file" id="to_file" />
69 <div class="row buttons">
70 <input type="submit" name="submit_import" value="<?php echo _AT('import'); ?>" />
76 <form name="form" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
77 <table class="data" summary="" style="width: 90%" rules="cols">
80 <th scope="col"> </th>
81 <th scope="col"><?php echo _AT('title'); ?></th>
82 <th scope="col"><?php echo _AT('status'); ?></th>
83 <th scope="col"><?php echo _AT('availability'); ?></th>
84 <th scope="col"><?php echo _AT('result_release'); ?></th>
85 <th scope="col"><?php echo _AT('submissions'); ?></th>
86 <th scope="col"><?php echo _AT('assigned_to'); ?></th>
90 <?php if ($num_tests): ?>
94 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" />
95 <input type="submit" name="preview" value="<?php echo _AT('preview'); ?>" />
96 <input type="submit" name="questions" value="<?php echo _AT('questions'); ?>" />
100 <td colspan="7" style="padding-left:38px;">
101 <input type="submit" name="submissions" value="<?php echo _AT('submissions'); ?>" />
102 <input type="submit" name="statistics" value="<?php echo _AT('statistics'); ?>" />
103 <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />
104 <input type="submit" name="export" value="<?php echo _AT('export'); ?>" />
110 <?php while ($row = mysql_fetch_assoc($result)) : ?>
111 <tr onmousedown="document.form['t<?php echo $row['test_id']; ?>'].checked = true;rowselect(this);" id="r_<?php echo $row['test_id']; ?>">
112 <td><input type="radio" name="id" value="<?php echo $row['test_id']; ?>" id="t<?php echo $row['test_id']; ?>" /></td>
113 <td><label for="t<?php echo $row['test_id']; ?>"><?php echo $row['title']; ?></label></td>
115 if ( ($row['us'] <= time()) && ($row['ue'] >= time() ) ) {
116 echo '<strong>'._AT('ongoing').'</strong>';
117 } else if ($row['ue'] < time() ) {
118 echo '<strong>'._AT('expired').'</strong>';
119 } else if ($row['us'] > time() ) {
120 echo '<strong>'._AT('pending').'</strong>';
122 <td><?php $startend_date_format=_AT('startend_date_format');
124 echo AT_date($startend_date_format, $row['start_date'], AT_DATE_MYSQL_DATETIME). ' ' ._AT('to_2').' ';
125 echo AT_date($startend_date_format, $row['end_date'], AT_DATE_MYSQL_DATETIME); ?></td>
128 if ($row['result_release'] == AT_RELEASE_IMMEDIATE) {
129 echo _AT('release_immediate');
130 } else if ($row['result_release'] == AT_RELEASE_MARKED) {
131 echo _AT('release_marked');
132 } else if ($row['result_release'] == AT_RELEASE_NEVER) {
133 echo _AT('release_never');
137 //get # marked submissions
138 $sql_sub = "SELECT COUNT(*) AS sub_cnt FROM ".TABLE_PREFIX."tests_results WHERE status=1 AND test_id=".$row['test_id'];
139 $result_sub = mysql_query($sql_sub, $db);
140 $row_sub = mysql_fetch_assoc($result_sub);
141 echo $row_sub['sub_cnt'].' '._AT('submissions').', ';
144 $sql_sub = "SELECT COUNT(*) AS marked_cnt FROM ".TABLE_PREFIX."tests_results WHERE status=1 AND test_id=".$row['test_id']." AND final_score=''";
145 $result_sub = mysql_query($sql_sub, $db);
146 $row_sub = mysql_fetch_assoc($result_sub);
147 echo $row_sub['marked_cnt'].' '._AT('unmarked');
151 //get assigned groups
152 $sql_sub = "SELECT G.title FROM ".TABLE_PREFIX."groups G INNER JOIN ".TABLE_PREFIX."tests_groups T USING (group_id) WHERE T.test_id=".$row['test_id'];
153 $result_sub = mysql_query($sql_sub, $db);
154 if (mysql_num_rows($result_sub) == 0) {
155 echo _AT('everyone');
157 $assigned_groups = '';
158 while ($row_sub = mysql_fetch_assoc($result_sub)) {
159 $assigned_groups .= $row_sub['title'].', ';
161 echo substr($assigned_groups, 0, -2);
170 <td colspan="7"><?php echo _AT('none_found'); ?></td>
177 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>