2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
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 /************************************************************************/
13 define('TR_INCLUDE_PATH', '../include/');
14 require_once(TR_INCLUDE_PATH.'vitals.inc.php');
15 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsDAO.class.php');
16 require_once(TR_INCLUDE_PATH.'classes/DAO/TestsQuestionsAssocDAO.class.php');
17 require_once(TR_INCLUDE_PATH.'classes/Utility.class.php');
20 Utility::authenticate(TR_PRIV_ISAUTHOR_OF_CURRENT_COURSE);
21 $testsQuestionsDAO = new TestsQuestionsDAO();
22 $testsQuestionsAssocDAO = new TestsQuestionsAssocDAO();
24 $tid = intval($_REQUEST['tid']);
26 if (isset($_POST['submit_no'])) {
27 $msg->addFeedback('CANCELLED');
28 header('Location: question_db.php?_course_id='.$_course_id);
30 } else if (isset($_POST['submit_yes'])) {
31 $_POST['qid'] = explode(',', $_POST['qid']);
33 foreach ($_POST['qid'] as $id) {
36 if ($testsQuestionsDAO->Delete($id)) $testsQuestionsAssocDAO->DeleteByQuestionID($id);
39 $msg->addFeedback('QUESTION_DELETED');
40 header('Location: question_db.php?_course_id='.$_course_id);
44 require_once(TR_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 $row = $testsQuestionsDAO->get($this_question);
51 $confirm .= "<li>".$row['question']."</li>";
54 $confirm = array('DELETE', $confirm);
55 $hidden_vars['qid'] = $_REQUEST['qid'];
56 $hidden_vars['_course_id'] = $_course_id;
58 $msg->addConfirm($confirm, $hidden_vars);
61 require_once(TR_INCLUDE_PATH.'footer.inc.php');