2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or */
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /************************************************************************/
\r
15 if (!defined('AT_INCLUDE_PATH')) { exit; }
\r
17 if (isset($_GET['reset_filter'])) {
\r
18 unset($_GET['category_id']);
\r
20 if (!isset($_GET['category_id'])) {
\r
21 // Suppress warnings
\r
22 $_GET['category_id'] = -1;
\r
24 require(AT_INCLUDE_PATH.'../mods/_standard/tests/lib/test_result_functions.inc.php');
\r
26 <fieldset class="group_form" style="width:93%"><legend class="group_form"><?php echo _AT('category'); ?></legend>
\r
27 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
\r
28 <input type="hidden" name="tid" value="<?php echo $tid; ?>" />
\r
30 <label for="cats"><?php echo _AT('category'); ?></label><br />
\r
31 <select name="category_id" id="cats">
\r
32 <option value="-1"><?php echo _AT('cats_all'); ?></option>
\r
33 <?php print_question_cats($_GET['category_id']); ?>
\r
36 <div class="row buttons">
\r
37 <input type="submit" name="filter" value="<?php echo _AT('filter'); ?>" />
\r
38 <input type="submit" name="reset_filter" value="<?php echo _AT('reset_filter'); ?>" />
\r
47 if ($_GET['category_id'] >= 0) {
\r
48 $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id=$_SESSION[course_id] AND category_id=$_GET[category_id] ORDER BY title";
\r
50 $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions_categories WHERE course_id=$_SESSION[course_id] ORDER BY title";
\r
53 $result = mysql_query($sql, $db);
\r
54 if ($_GET['category_id'] <= 0) {
\r
55 $cats[] = array('title' => _AT('cats_uncategorized'), 'category_id' => 0);
\r
58 while ($row = mysql_fetch_assoc($result)) {
\r
65 <form method="post" action="mods/_standard/tests/add_test_questions_confirm.php" name="form">
\r
67 <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="form">
\r
69 <table class="data" summary="" rules="cols">
\r
72 <th scope="col"> </th>
\r
73 <th scope="col"><?php echo _AT('question'); ?></th>
\r
74 <th scope="col"><?php echo _AT('type'); ?></th>
\r
81 <input type="hidden" name="tid" value="<?php echo $tid; ?>" />
\r
82 <input type="submit" name="submit" value="<?php echo _AT('add_to_test_survey'); ?>" accesskey="s" />
\r
83 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
\r
89 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" />
\r
90 <input type="submit" name="preview" value="<?php echo _AT('preview'); ?>" />
\r
91 <input type="submit" name="export" value="<?php echo _AT('export'); ?>" />
\r
92 <select name='qti_export_version' >
\r
93 <option selected='selected' value='1.2.1'>QTI 1.2.1</option>
\r
94 <option value='2.1'>QTI 2.1</option>
\r
96 <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />
\r
104 $question_flag = FALSE;
\r
106 //output categories
\r
107 foreach ($cats as $cat) {
\r
109 $sql = "SELECT * FROM ".TABLE_PREFIX."tests_questions WHERE course_id=$_SESSION[course_id] AND category_id=".$cat['category_id']." ORDER BY question";
\r
110 $result = mysql_query($sql, $db);
\r
111 if ($row = mysql_fetch_assoc($result)) {
\r
112 $question_flag = TRUE;
\r
114 echo '<th colspan="'.$cols.'">';
\r
116 echo '<input type="checkbox" name="cat'.$cat['category_id'].'" id="cat'.$cat['category_id'].'" onclick="javascript:selectCat('.$cat['category_id'].', this);" /><label for="cat'.$cat['category_id'].'">'.$cat['title'].'</label>';
\r
121 echo '<tr onmousedown="document.form[\'q' . $row['question_id'] . '\'].checked = !document.form[\'q' . $row['question_id'] . '\'].checked; togglerowhighlight(this, \'q'.$row['question_id'].'\');" id="rq'.$row['question_id'].'">';
\r
123 echo '<input type="checkbox" value="'.$row['question_id'].'|'.$row['type'].'" name="questions['.$cat['category_id'].'][]" id="q'.$row['question_id'].'" onmouseup="this.checked=!this.checked" /></td>';
\r
125 echo '<a title="'.AT_print($row[question], 'tests_questions.question').'">';
\r
126 echo AT_print((validate_length($row['question'], 100, VALIDATE_LENGTH_FOR_DISPLAY)), 'tests_questions.question');
\r
130 $o = TestQuestions::getQuestion($row['type']);
\r
137 } while ($row = mysql_fetch_assoc($result));
\r
140 if (!$question_flag) {
\r
141 echo '<tr><td colspan="'.$cols.'">'._AT('none_found').'</td></tr>';
\r
148 <script language="javascript" type="text/javascript">
\r
150 function selectCat(catID, cat) {
\r
151 for (var i=0;i<document.form.elements.length;i++) {
\r
152 var e = document.form.elements[i];
\r
153 if ((e.name == 'questions[' + catID + '][]') && (e.type=='checkbox')) {
\r
154 e.checked = cat.checked;
\r
155 togglerowhighlight(document.getElementById("r" + e.id), e.id);
\r
160 function togglerowhighlight(obj, boxid) {
\r
161 if (document.getElementById(boxid).checked) {
\r
162 obj.className = 'selected';
\r
164 obj.className = '';
\r