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
15 define('AT_INCLUDE_PATH', '../../../include/');
\r
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
\r
17 authenticate(AT_PRIV_FAQ);
\r
19 if (isset($_GET['edit'], $_GET['item'])) {
\r
20 $item = intval($_GET['item']);
\r
21 if (substr($_GET['item'], -1) == 'q') {
\r
22 header('Location: edit_question.php?id=' . $item);
\r
24 header('Location: edit_topic.php?id=' . $item);
\r
27 } else if (isset($_GET['delete'], $_GET['item'])) {
\r
28 $item = intval($_GET['item']);
\r
30 if (substr($_GET['item'], -1) == 'q') {
\r
31 header('Location: delete_question.php?id=' . $item);
\r
33 header('Location: delete_topic.php?id=' . $item);
\r
36 } else if (!empty($_GET)) {
\r
37 $msg->addError('NO_ITEM_SELECTED');
\r
40 require(AT_INCLUDE_PATH.'header.inc.php');
\r
43 $sql = "SELECT name, topic_id FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$_SESSION[course_id] ORDER BY name";
\r
44 $result = mysql_query($sql, $db);
\r
46 $faq_topics = array();
\r
47 while ($row = mysql_fetch_assoc($result)) {
\r
49 $faq_topics[$row['topic_id']] = $row;
\r
50 $entry_sql = "SELECT * FROM ".TABLE_PREFIX."faq_entries WHERE topic_id=$row[topic_id] ORDER BY question";
\r
51 $entries = mysql_query($entry_sql, $db);
\r
53 while ($entry_result = mysql_fetch_assoc($entries))
\r
55 $faq_topics[$row['topic_id']]['entry_rows'][] = $entry_result;
\r
61 if ($_SESSION['id'] > 0){
\r
62 $savant->assign('faq_topics', $faq_topics);
\r
65 $savant->assign('faq_topics', $faq_topics);
\r
66 $savant->display('instructor/faq/index_instructor.tmpl.php');
\r
69 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>