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 /****************************************************************/
14 define('AT_INCLUDE_PATH', '../../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 authenticate(AT_PRIV_TESTS);
18 $tid = intval($_REQUEST['tid']);
20 if (isset($_POST['submit_no'])) {
21 $msg->addFeedback('CANCELLED');
22 header('Location: question_db.php');
24 } else if (isset($_POST['submit_yes'])) {
25 $_POST['qid'] = explode(',', $_POST['qid']);
27 foreach ($_POST['qid'] as $id) {
30 $sql = "DELETE FROM ".TABLE_PREFIX."tests_questions WHERE question_id=$id AND course_id=$_SESSION[course_id]";
31 $result = mysql_query($sql, $db) or die(mysql_error());
33 if (mysql_affected_rows($db) == 1) {
34 $sql = "DELETE FROM ".TABLE_PREFIX."tests_questions_assoc WHERE question_id=$id";
35 $result = mysql_query($sql, $db) or die(mysql_error());
39 $msg->addFeedback('QUESTION_DELETED');
40 header('Location: question_db.php');
44 require(AT_INCLUDE_PATH.'header.inc.php');
46 $these_questions= explode(",", $_REQUEST['qid']);
48 foreach($these_questions as $this_question){
49 $this_question = intval($this_question);
50 $sql = "SELECT question FROM ".TABLE_PREFIX."tests_questions WHERE question_id = '$this_question' ";
51 $result = mysql_query($sql, $db);
52 $row = mysql_fetch_assoc($result);
53 $confirm .= "<li>".$row['question']."</li>";
56 $confirm = array('DELETE', $confirm);
57 $hidden_vars['qid'] = $_REQUEST['qid'];
59 $msg->addConfirm($confirm, $hidden_vars);
62 require(AT_INCLUDE_PATH.'footer.inc.php');