2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 require(AT_INCLUDE_PATH.'../mods/_standard/tests/lib/test_question_queries.inc.php');
19 authenticate(AT_PRIV_TESTS);
20 require(AT_INCLUDE_PATH.'../mods/_standard/tests/lib/test_result_functions.inc.php');
22 if (isset($_POST['cancel'])) {
23 $msg->addFeedback('CANCELLED');
24 header('Location: question_db.php');
26 } else if ($_POST['submit']) {
27 $_POST['required'] = 1; //intval($_POST['required']);
28 $_POST['feedback'] = trim($_POST['feedback']);
29 $_POST['question'] = trim($_POST['question']);
30 $_POST['category_id'] = intval($_POST['category_id']);
31 $_POST['answer'] = intval($_POST['answer']);
33 if ($_POST['question'] == ''){
34 $msg->addError(array('EMPTY_FIELDS', _AT('statement')));
37 if (!$msg->containsErrors()) {
38 $_POST['feedback'] = $addslashes($_POST['feedback']);
39 $_POST['question'] = $addslashes($_POST['question']);
42 $sql = 'SELECT content_id FROM '.TABLE_PREFIX."tests WHERE test_id=$_POST[tid]";
43 $result = mysql_query($sql, $db);
44 $row = mysql_fetch_assoc($result);
47 $sql_params = array( $_POST['category_id'],
48 $_SESSION['course_id'],
53 $sql = vsprintf(AT_SQL_QUESTION_TRUEFALSE, $sql_params);
54 $result = mysql_query($sql, $db);
56 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
57 header('Location: question_db.php');
61 $onload = 'document.form.category_id.focus();';
62 require(AT_INCLUDE_PATH.'header.inc.php');
65 <form action="mods/_standard/tests/create_question_tf.php" method="post" name="form">
66 <div class="input-form">
67 <fieldset class="group_form"><legend class="group_form"><?php echo _AT('test_tf'); ?></legend>
69 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="cats"><?php echo _AT('category'); ?></label><br />
70 <select name="category_id" id="cats">
71 <?php print_question_cats($_POST['category_id']); ?>
76 <label for="optional_feedback"><?php echo _AT('optional_feedback'); ?></label>
77 <?php print_VE('optional_feedback'); ?>
80 <textarea id="optional_feedback" cols="50" rows="3" name="feedback"><?php echo htmlspecialchars($stripslashes($_POST['feedback'])); ?></textarea>
84 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="question"><?php echo _AT('statement'); ?></label>
85 <?php print_VE('question'); ?>
88 <textarea id="question" cols="50" rows="6" name="question" style="width:90%;"><?php echo htmlspecialchars($stripslashes($_POST['question'])); ?></textarea>
92 <?php echo _AT('answer'); ?><br />
93 <input type="radio" name="answer" value="1" id="answer1" /><label for="answer1"><?php echo _AT('true'); ?></label>,
94 <input type="radio" name="answer" value="2" id="answer2" checked="checked" /><label for="answer2"><?php echo _AT('false'); ?></label>
97 <div class="row buttons">
98 <input type="submit" value="<?php echo _AT('save'); ?>" name="submit" accesskey="s" />
99 <input type="submit" value="<?php echo _AT('cancel'); ?>" name="cancel" />
105 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>