moved code up one level to eliminate the docs subdirectory
[acontent.git] / themes / default / tests / questions.tmpl.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 global $strlen, $substr;\r
13 \r
14 ?>\r
15 \r
16 <form action="<?php echo $_SERVER['PHP_SELF']; ?>?tid=<?php echo $this->tid.SEP; ?>_course_id=<?php echo $this->course_id;?>" method="post" name="form">\r
17 <input type="hidden" name="tid" value="<?php echo $this->tid; ?>" />\r
18 <input type="hidden" name="_course_id" value="<?php echo $this->course_id; ?>" />\r
19 <table class="data static" summary="" rules="rows">\r
20 <thead>\r
21 <tr>\r
22         <th scope="col"><?php echo _AT('num');      ?></th>\r
23         <th scope="col"><?php echo _AT('points');   ?></th>\r
24         <th scope="col"><?php echo _AT('order'); ?></th>\r
25         <th scope="col"><?php echo _AT('question'); ?></th>\r
26         <th scope="col"><?php echo _AT('type');     ?></th>\r
27         <th scope="col"><?php echo _AT('category'); ?></th>\r
28         <th scope="col">&nbsp;</th>\r
29 </tr>\r
30 </thead>\r
31 <?php\r
32 if (is_array($this->rows)) {\r
33         foreach ($this->rows as $row) {\r
34                 $count++;\r
35 \r
36                 if (isset($_POST['submit'])) {\r
37                         $row['weight'] = $_POST['weight'][$row['question_id']];\r
38                         $row['required'] = (isset($_POST['required'][$row['question_id']]) ? 1 : 0);\r
39                 }\r
40 ?>\r
41         <tr>\r
42                 <td class="row1" align="center"><strong><?php echo $count; ?></strong></td>\r
43                 <td class="row1" align="center">\r
44                 \r
45                 <?php if ($row['type'] == 4) {?>\r
46                         <?php echo _AT('na'); ?>\r
47                         <input type="hidden" value="0" name="weight[<?php echo $row['question_id']; ?>]" />\r
48                 <?php } else {?>\r
49                         <input type="text" value="<?php echo $row['weight']; ?>" name="weight[<?php echo $row['question_id']; ?>]" size="2" />\r
50                 <?php }?>\r
51                 </td>\r
52 \r
53                 <td class="row1" align="center"><input type="text" name="ordering[<?php echo $row['question_id']; ?>]" value="<?php echo $row['ordering']; ?>" size="2" /></td>\r
54 \r
55                 <td class="row1">\r
56                 <?php if ($strlen($row['question']) > 45) {\r
57                         echo htmlspecialchars(AT_print($substr($row['question'], 0, 43), 'tests_questions.question'), ENT_COMPAT, "UTF-8") . '...';\r
58                 } else {\r
59                         echo AT_print(htmlspecialchars($row['question'], ENT_COMPAT, "UTF-8"), 'tests_questions.question');\r
60                 }?>\r
61 \r
62                 </td>\r
63                 <td nowrap="nowrap">\r
64                 <?php $o = TestQuestions::getQuestion($row['type']); echo $o->printName();\r
65                 $link = 'tests/edit_question_'.$o->getPrefix().'.php?tid='.$this->tid.SEP.'qid='.$row['question_id'].SEP.'_course_id='.$this->course_id;?>\r
66                 </td>\r
67 \r
68                 <td align="center"><?php echo $this->cats[$row['category_id']]; ?></td>\r
69 \r
70                 <td nowrap="nowrap">\r
71                 <a href="<?php echo $link; ?>"><?php echo _AT('edit'); ?></a> |\r
72                 <a href="tests/question_remove.php?tid=<?php echo $this->tid . SEP; ?>qid=<?php echo $row['question_id'].SEP; ?>_course_id=<?php echo $this->course_id; ?>"><?php echo _AT('remove'); ?></a>\r
73                 </td>\r
74 \r
75                 </tr>\r
76         <?php } ?>\r
77 \r
78         <tfoot>\r
79         <tr><td>&nbsp;</td>\r
80         <td colspan="6" align="left" nowrap="nowrap"><input type="submit" value="<?php echo _AT('update'); ?>" name="submit" /></td>\r
81         </tr>\r
82         </tfoot>\r
83 <?php } else {?>\r
84         <tr><td colspan="6" ><?php echo _AT('none_found'); ?></td></tr>\r
85 <?php }?>\r
86 \r
87 </table><br />\r
88 </form>\r
89 \r