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
26 // check that this topic_id belongs to this course:
\r
27 $sql = "DELETE FROM ".TABLE_PREFIX."faq_topics WHERE topic_id=$_POST[id] AND course_id=$_SESSION[course_id]";
\r
28 $result = mysql_query($sql, $db);
\r
29 if (mysql_affected_rows($db) == 1) {
\r
30 $sql = "DELETE FROM ".TABLE_PREFIX."faq_entries WHERE topic_id=$_POST[topic_id]";
\r
31 $result = mysql_query($sql, $db);
\r
34 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
\r
35 header('Location: index_instructor.php');
\r
39 require(AT_INCLUDE_PATH.'header.inc.php');
\r
42 $_GET['id'] = intval($_GET['id']);
\r
44 $sql = "SELECT name, topic_id FROM ".TABLE_PREFIX."faq_topics WHERE topic_id=$_GET[id]";
\r
46 $result = mysql_query($sql,$db);
\r
47 if ($row = mysql_fetch_assoc($result)) {
\r
48 $hidden_vars['id'] = $_GET['id'];
\r
50 $confirm = array('DELETE_FAQ_TOPIC', AT_print($row['name'], 'faqs.topic'));
\r
51 $msg->addConfirm($confirm, $hidden_vars);
\r
52 $msg->printConfirm();
\r
54 $msg->addError('ITEM_NOT_FOUND');
\r
57 require(AT_INCLUDE_PATH.'footer.inc.php');
\r