moved code up one level to eliminate the docs subdirectory
[acontent.git] / tests / question_remove.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12
13 $page = 'tests';
14 define('TR_INCLUDE_PATH', '../include/');
15 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
16 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
17 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsAssocDAO.class.php');
18
19 global $_course_id;
20 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
21
22 $tid = intval($_REQUEST['tid']);
23 $qid = intval($_REQUEST['qid']);
24
25 if (isset($_POST['submit_no'])) {
26         $msg->addFeedback('CANCELLED');
27         header('Location: questions.php?tid=' . $tid.SEP.'_course_id='.$_course_id);
28         exit;
29 } else if (isset($_POST['submit_yes'])) {
30         $testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
31         $testsQuestionsAssocDAO->Delete($tid, $qid);
32         $msg->addFeedback('QUESTION_REMOVED');
33         header('Location: questions.php?tid=' . $tid.SEP.'_course_id='.$_course_id);
34         exit;
35
36 } /* else: */
37
38 $_pages['tests/questions.php?tid='.$_GET['tid']]['title_var']    = 'questions';
39 $_pages['tests/questions.php?tid='.$_GET['tid']]['parent']   = 'tests/index.php';
40 $_pages['tests/questions.php?tid='.$_GET['tid']]['children'] = array('tests/add_test_questions.php?tid='.$_GET['tid']);
41
42 $_pages['tests/add_test_questions.php?tid='.$_GET['tid']]['title_var']    = 'add_questions';
43 $_pages['tests/add_test_questions.php?tid='.$_GET['tid']]['parent']   = 'tests/questions.php?tid='.$_GET['tid'];
44
45 $_pages['tests/question_remove.php']['title_var'] = 'remove_question';
46 $_pages['tests/question_remove.php']['parent']    = 'tests/questions.php?tid='.$_GET['tid'];
47
48 require_once(TR_INCLUDE_PATH.'header.inc.php');
49
50 unset($hidden_vars);
51 $hidden_vars['qid'] = $_GET['qid'];
52 $hidden_vars['tid'] = $_GET['tid'];
53 $hidden_vars['_course_id'] = $_course_id;
54 $msg->addConfirm('REMOVE_TEST_QUESTION', $hidden_vars);
55
56 $msg->printConfirm();
57
58 require_once(TR_INCLUDE_PATH.'footer.inc.php');
59 ?>