Skip to content

Commit 1b9dcca

Browse files
author
filip
committed
Added manage questions functionality to FAQ for admin.
1 parent 9b0a821 commit 1b9dcca

File tree

11 files changed

+148
-14
lines changed

11 files changed

+148
-14
lines changed

interface/web/help/faq_delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
// From and List definition files
4-
$list_def_file = 'list/faq_list.php';
4+
$list_def_file = 'list/faq_manage_questions_list.php';
55
$tform_def_file = 'form/faq.tform.php';
66

77
// Include the base libraries
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
require_once('../../lib/config.inc.php');
3+
require_once('../../lib/app.inc.php');
4+
5+
//* Path to the list definition file
6+
$list_def_file = "list/faq_manage_questions_list.php";
7+
8+
//* Check permissions for module
9+
$app->auth->check_module_permissions('help');
10+
11+
//* Loading the class
12+
$app->uses('listform_actions');
13+
14+
//* Optional limit
15+
#$app->listform_actions->SQLExtWhere = "recipient_id = ".$_SESSION['s']['user']['userid'];
16+
17+
//* Start the form rendering and action ahndling
18+
$app->listform_actions->onLoad();
19+
20+
?>

interface/web/help/form/faq.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
$form['tab_default'] = 'message';
2828

2929
// The name of the default list file of this form
30-
$form['list_default'] = 'faq_list.php';
30+
$form['list_default'] = 'faq_manage_questions_list.php';
3131

3232
// Use the internal authentication system for this table. This should
3333
// be set to 'yes' in most cases, otherwise 'no'.

interface/web/help/lib/lang/cz.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ $wb['Version'] = 'Verze';
99
$wb['Frequently Asked Questions'] = 'Často kladené dotazy';
1010
$wb['FAQ Sections'] = 'Sekce FAQ';
1111
$wb['Manage Sections'] = 'Spravovat sekce';
12+
$wb['Manage Questions'] = 'Spravovat dotazy';
1213
$wb['Add a Question & Answer Pair'] = 'Přidat otázku a odpověď';
1314
?>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
$wb['faq_question_txt'] = "Otázka";
3+
$wb['faq_section_name_txt'] = "Název sekce";
4+
$wb['faq_delete_txt'] = "Smazat";
5+
$wb['faq_edit_txt'] = "Upravit";
6+
$wb['faq_sections_txt'] = "Sekce";
7+
$wb['faq_faq_questions_txt'] = "Často kladené dotazy";
8+
$wb['faq_new_question_txt'] = "Přidat nový dotaz";
9+
?>
10+

interface/web/help/lib/lang/en.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ $wb['Frequently Asked Questions'] = 'Frequently Asked Questions';
1010
$wb['FAQ Sections'] = 'FAQ Sections';
1111
$wb['Manage Sections'] = 'Manage Sections';
1212
$wb['Add a Question & Answer Pair'] = 'Add a Question & Answer Pair';
13-
13+
$wb['Manage Questions'] = 'Manage Questions';
1414

1515
?>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
$wb['faq_question_txt'] = "Question";
3+
$wb['faq_section_name_txt'] = "Section";
4+
$wb['faq_delete_txt'] = "Delete";
5+
$wb['faq_edit_txt'] = "Edit";
6+
$wb['faq_sections_txt'] = "Section";
7+
$wb['faq_faq_questions_txt'] = "Frequently Asked Questions";
8+
$wb['faq_new_question_txt'] = "Add a new question & answer pair";
9+
?>
10+

interface/web/help/lib/module.conf.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,24 @@
4646
$itemsfaq = array();
4747
//* admin's tools
4848
if($_SESSION['s']['user']['typ'] == 'admin') {
49-
$itemsfaq[] = array( 'title' => 'Add a Question & Answer Pair',
49+
$itemsfaq[] = array( 'title' => 'Manage Questions',
5050
'target' => 'content',
51-
'link' => 'help/faq_edit.php');
51+
'link' => 'help/faq_manage_questions_list.php');
5252
$itemsfaq[] = array( 'title' => 'Manage Sections',
5353
'target' => 'content',
5454
'link' => 'help/faq_sections_list.php');
5555
}
56-
$sql = "SELECT * FROM help_faq_sections";
57-
$res = $app->db->queryAllRecords($sql);
58-
//* all the content sections
59-
if(is_array($res)) {
60-
foreach($res as $v) {
61-
$itemsfaq[] = array( 'title' => $v['hfs_name'],
62-
'target' => 'content',
63-
'link' => 'help/faq_list.php?hfs_id='.$v['hfs_id']);
56+
else
57+
{ //* the user
58+
$sql = "SELECT * FROM help_faq_sections";
59+
$res = $app->db->queryAllRecords($sql);
60+
//* all the content sections
61+
if(is_array($res)) {
62+
foreach($res as $v) {
63+
$itemsfaq[] = array( 'title' => $v['hfs_name'],
64+
'target' => 'content',
65+
'link' => 'help/faq_list.php?hfs_id='.$v['hfs_id']);
66+
}
6467
}
6568
}
6669

interface/web/help/list/faq_list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
$liste['records_per_page']= 100;
1717

1818
// Script File of the list
19-
$liste['file'] = 'faq_list.php';
19+
$liste['file'] = 'faq_manage_questions_list.php';
2020

2121
// Script file of the edit form
2222
$liste['edit_file'] = 'faq_edit.php';
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
// Name of the list
4+
$liste['name'] = 'faq_manage_questions';
5+
6+
// Database table
7+
$liste['table'] = 'help_faq';
8+
9+
// Index index field of the database table
10+
$liste['table_idx'] = 'hf_id';
11+
12+
// Search Field Prefix
13+
#$liste['search_prefix'] = 'search_';
14+
15+
// Records per page
16+
$liste['records_per_page']= 30;
17+
18+
// Script File of the list
19+
$liste['file'] = 'faq_manage_questions_list.php';
20+
21+
// Script file of the edit form
22+
$liste['edit_file'] = 'faq_edit.php';
23+
24+
// Script File of the delete script
25+
$liste['delete_file'] = 'faq_delete.php';
26+
27+
// Paging Template
28+
$liste['paging_tpl'] = 'templates/paging.tpl.htm';
29+
30+
// Enable auth
31+
$liste['auth'] = 'yes';
32+
33+
34+
$liste["item"][] = array( 'field' => "hf_section",
35+
'datatype' => "VARCHAR",
36+
'formtype' => "SELECT",
37+
'op' => "=",
38+
'prefix' => "",
39+
'suffix' => "",
40+
'datasource' => array ( 'type' => 'SQL',
41+
'querystring' => 'SELECT a.hf_section, b.hfs_name FROM help_faq a, help_faq_sections b WHERE (a.hf_section = b.hfs_id)',
42+
'keyfield'=> 'hf_section',
43+
'valuefield'=> 'hfs_name'
44+
),
45+
'width' => "",
46+
'value' => "");
47+
?>

0 commit comments

Comments
 (0)