00ebe9e9d5b403db6e9cc7664a2b8d0d8243d071
[atutor.git] / docs / mods / _standard / tests / question_remove.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2010                                      */
6 /* Inclusive Design Institute                                   */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
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 /****************************************************************/
13 // $Id$
14
15 $page = 'tests';
16 define('AT_INCLUDE_PATH', '../../../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
18
19 authenticate(AT_PRIV_TESTS);
20
21 $tid = intval($_REQUEST['tid']);
22 $qid = intval($_REQUEST['qid']);
23
24 if (isset($_POST['submit_no'])) {
25         $msg->addFeedback('CANCELLED');
26         header('Location: questions.php?tid=' . $tid);
27         exit;
28 } else if (isset($_POST['submit_yes'])) {
29         $sql    = "DELETE FROM ".TABLE_PREFIX."tests_questions_assoc WHERE question_id=$qid AND test_id=$tid";
30         $result = mysql_query($sql, $db);
31                 
32         $msg->addFeedback('QUESTION_REMOVED');
33         header('Location: questions.php?tid=' . $tid);
34         exit;
35
36 } /* else: */
37
38 $_pages['mods/_standard/tests/questions.php?tid='.$_GET['tid']]['title_var']    = 'questions';
39 $_pages['mods/_standard/tests/questions.php?tid='.$_GET['tid']]['parent']   = 'mods/_standard/tests/index.php';
40 $_pages['mods/_standard/tests/questions.php?tid='.$_GET['tid']]['children'] = array('mods/_standard/tests/add_test_questions.php?tid='.$_GET['tid']);
41
42 $_pages['mods/_standard/tests/add_test_questions.php?tid='.$_GET['tid']]['title_var']    = 'add_questions';
43 $_pages['mods/_standard/tests/add_test_questions.php?tid='.$_GET['tid']]['parent']   = 'mods/_standard/tests/questions.php?tid='.$_GET['tid'];
44
45 $_pages['mods/_standard/tests/question_remove.php']['title_var'] = 'remove_question';
46 $_pages['mods/_standard/tests/question_remove.php']['parent']    = 'mods/_standard/tests/questions.php?tid='.$_GET['tid'];
47
48 require(AT_INCLUDE_PATH.'header.inc.php');
49
50 unset($hidden_vars);
51 $hidden_vars['qid'] = $_GET['qid'];
52 $hidden_vars['tid'] = $_GET['tid'];
53 $msg->addConfirm('REMOVE_TEST_QUESTION', $hidden_vars);
54
55 $msg->printConfirm();
56
57 require(AT_INCLUDE_PATH.'footer.inc.php');
58 ?>