2 /****************************************************************/
\r
4 /****************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or*/
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /****************************************************************/
\r
14 define('AT_INCLUDE_PATH', '../../../include/');
\r
15 require (AT_INCLUDE_PATH.'vitals.inc.php');
\r
17 authenticate(AT_PRIV_FAQ);
\r
19 if (isset($_POST['submit_no'])) {
\r
20 $msg->addFeedback('CANCELLED');
\r
21 Header('Location: index_instructor.php');
\r
23 } else if (isset($_POST['submit_yes'])) {
\r
24 $_POST['id'] = intval($_POST['id']);
\r
25 $_POST['topic_id'] = intval($_POST['topic_id']);
\r
27 // check that this topic_id belongs to this course:
\r
28 $sql = "SELECT topic_id FROM ".TABLE_PREFIX."faq_topics WHERE topic_id=$_POST[topic_id] AND course_id=$_SESSION[course_id]";
\r
29 $result = mysql_query($sql, $db);
\r
30 if ($row = mysql_fetch_assoc($result)) {
\r
31 $sql = "DELETE FROM ".TABLE_PREFIX."faq_entries WHERE entry_id=$_POST[id] AND topic_id=$_POST[topic_id]";
\r
32 $result = mysql_query($sql, $db);
\r
35 $msg->addFeedback('QUESTION_DELETED');
\r
36 header('Location: index_instructor.php');
\r
40 require(AT_INCLUDE_PATH.'header.inc.php');
\r
43 $_GET['id'] = intval($_GET['id']);
\r
45 $sql = "SELECT question, topic_id FROM ".TABLE_PREFIX."faq_entries WHERE entry_id=$_GET[id]";
\r
47 $result = mysql_query($sql,$db);
\r
48 if ($row = mysql_fetch_assoc($result)) {
\r
49 $hidden_vars['topic_id'] = $row['topic_id'];
\r
50 $hidden_vars['id'] = $_GET['id'];
\r
52 $confirm = array('DELETE_FAQ_QUESTION', AT_print($row['question'], 'faqs.question'));
\r
53 $msg->addConfirm($confirm, $hidden_vars);
\r
54 $msg->printConfirm();
\r
56 $msg->addError('ITEM_NOT_FOUND');
\r
59 require(AT_INCLUDE_PATH.'footer.inc.php');
\r