0add85338d90c6c38b63af7d7725fddef37d991f
[atutor.git] / docs / mods / _standard / faq / index.php
1 <?php\r
2 /****************************************************************/\r
3 /* ATutor                                                                                                               */\r
4 /****************************************************************/\r
5 /* Copyright (c) 2002-2010                                      */\r
6 /* Inclusive Design Institute                                   */\r
7 /* http://atutor.ca                                                                                             */\r
8 /*                                                              */\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
13 // $Id$\r
14 define('AT_INCLUDE_PATH', '../../../include/');\r
15 require (AT_INCLUDE_PATH.'vitals.inc.php');\r
16 require (AT_INCLUDE_PATH.'header.inc.php');\r
17 \r
18 $counter = 1;\r
19 $sql     = "SELECT name, topic_id FROM ".TABLE_PREFIX."faq_topics WHERE course_id=$_SESSION[course_id] ORDER BY name";\r
20 $result  = mysql_query($sql, $db);\r
21 ?>\r
22 \r
23 <?php if ($row = mysql_fetch_assoc($result)) : ?>\r
24         <ul style="list-style: none;">\r
25                 <?php do { ?>\r
26                         <li style="font-weight: bold; margin-bottom: 10px;">\r
27                                 <?php echo AT_print($row['name'], 'faqs.topic'); ?>\r
28                                 <?php \r
29                                         $entry_sql = "SELECT * FROM ".TABLE_PREFIX."faq_entries WHERE topic_id=$row[topic_id] ORDER BY question";\r
30                                         $entry_result = mysql_query($entry_sql, $db);\r
31                                 if ($entry_row = mysql_fetch_assoc($entry_result)) {?>\r
32                                 <ol start="<?php echo $counter; ?>">\r
33 \r
34                                         <?php do { ?>\r
35                                                 <li style="font-weight: normal">\r
36                                                         <h3><?php echo AT_print($entry_row['question'], 'faqs.question'); ?></h3>\r
37                                                         <p><?php echo AT_print($entry_row['answer'], 'faqs.answer');?></p>\r
38                                                 </li>\r
39                                                 <?php $counter++; ?>\r
40                                         <?php } while ($entry_row = mysql_fetch_assoc($entry_result)) ?>\r
41                                 </ol>\r
42                                 <?php } else { ?>\r
43                                         <p style="padding-left: 20px; padding-top:3px; font-weight:normal;"><?php echo _AT('no_questions');  ?></p>\r
44                                 <?php } ?>\r
45                         </li>\r
46                 <?php } while($row = mysql_fetch_assoc($result)); ?>\r
47         </ul>\r
48 <?php else: ?>\r
49         <?php echo _AT('none_found'); ?>\r
50 <?php endif; ?>\r
51 \r
52 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>