|
9 | 9 | //* The template file of the module. This is always module.tpl.htm if you do not have any special requirements like a 3 column layout. |
10 | 10 | $module['template'] = 'module.tpl.htm'; |
11 | 11 |
|
| 12 | +// read web config |
| 13 | +$app->uses('getconf'); |
| 14 | +$global_config = $app->getconf->get_global_config('misc'); |
| 15 | + |
| 16 | +// Get the FAQ sections |
| 17 | +$sql = "SELECT * FROM help_faq_sections"; |
| 18 | +$faq_sections = $app->db->queryAllRecords($sql); |
| 19 | + |
12 | 20 | //* The page that is displayed when the module is loaded. the path must is relative to the web directory |
13 | 21 | if(isset($_GET['go2_faq_sections_list'])){ |
14 | 22 | $module['startpage'] = 'help/faq_sections_list.php'; |
15 | 23 | } else { |
16 | 24 | if($_SESSION['s']['user']['typ'] == 'admin') { |
17 | 25 | $module['startpage'] = 'help/version.php'; |
18 | | - } else { |
| 26 | + } elseif ($global_config['show_support_messages'] == 'y') { |
19 | 27 | $module['startpage'] = 'help/support_message_list.php'; |
20 | | - } |
| 28 | + } elseif (!empty($faq_sections) && is_array($faq_sections) && count($faq_sections) > 0) { |
| 29 | + $module['startpage'] = 'help/faq_list.php?hfs_id='.$faq_sections[0]['hfs_id']; |
| 30 | + } else { |
| 31 | + $module['startpage'] = 'help/index.php'; |
| 32 | + } |
21 | 33 | } |
22 | 34 |
|
23 | 35 | //* The width of the tab. Normally you should leave this empty and let the browser define the width automatically. |
24 | 36 | $module['tab_width'] = ''; |
25 | 37 |
|
26 | 38 |
|
27 | 39 | //*** Menu Definition ***************************************** |
28 | | -// read web config |
29 | | -$app->uses('getconf'); |
30 | | -$global_config = $app->getconf->get_global_config('misc'); |
31 | 40 | if($global_config['show_support_messages'] == 'y') { |
32 | 41 | //* make sure that the items array is empty |
33 | 42 | $items = array(); |
|
66 | 75 | 'items' => $itemsfaq); |
67 | 76 | } |
68 | 77 | else { //* the user |
69 | | - $sql = "SELECT * FROM help_faq_sections"; |
70 | | - $res = $app->db->queryAllRecords($sql); |
71 | 78 | //* all the content sections |
72 | | - if(is_array($res) && !empty($res)) { |
73 | | - foreach($res as $v) { |
| 79 | + if(is_array($faq_sections) && !empty($faq_sections)) { |
| 80 | + foreach($faq_sections as $v) { |
74 | 81 | $itemsfaq[] = array( 'title' => $v['hfs_name'], |
75 | 82 | 'target' => 'content', |
76 | 83 | 'link' => 'help/faq_list.php?hfs_id='.$v['hfs_id']); |
|
101 | 108 | 'open' => 1, |
102 | 109 | 'items' => $items); |
103 | 110 | } |
104 | | -?> |
| 111 | + |
0 commit comments