Added manage questions functionality to FAQ for admin.
6 files modified
5 files added
| | |
| | | <?php |
| | | |
| | | // From and List definition files |
| | | $list_def_file = 'list/faq_list.php'; |
| | | $list_def_file = 'list/faq_manage_questions_list.php'; |
| | | $tform_def_file = 'form/faq.tform.php'; |
| | | |
| | | // Include the base libraries |
New file |
| | |
| | | <?php |
| | | require_once('../../lib/config.inc.php'); |
| | | require_once('../../lib/app.inc.php'); |
| | | |
| | | //* Path to the list definition file |
| | | $list_def_file = "list/faq_manage_questions_list.php"; |
| | | |
| | | //* Check permissions for module |
| | | $app->auth->check_module_permissions('help'); |
| | | |
| | | //* Loading the class |
| | | $app->uses('listform_actions'); |
| | | |
| | | //* Optional limit |
| | | #$app->listform_actions->SQLExtWhere = "recipient_id = ".$_SESSION['s']['user']['userid']; |
| | | |
| | | //* Start the form rendering and action ahndling |
| | | $app->listform_actions->onLoad(); |
| | | |
| | | ?> |
| | |
| | | $form['tab_default'] = 'message'; |
| | | |
| | | // The name of the default list file of this form |
| | | $form['list_default'] = 'faq_list.php'; |
| | | $form['list_default'] = 'faq_manage_questions_list.php'; |
| | | |
| | | // Use the internal authentication system for this table. This should |
| | | // be set to 'yes' in most cases, otherwise 'no'. |
| | |
| | | $wb['Frequently Asked Questions'] = 'Často kladené dotazy'; |
| | | $wb['FAQ Sections'] = 'Sekce FAQ'; |
| | | $wb['Manage Sections'] = 'Spravovat sekce'; |
| | | $wb['Manage Questions'] = 'Spravovat dotazy'; |
| | | $wb['Add a Question & Answer Pair'] = 'Přidat otázku a odpověď'; |
| | | ?> |
New file |
| | |
| | | <?php |
| | | $wb['faq_question_txt'] = "Otázka"; |
| | | $wb['faq_section_name_txt'] = "Název sekce"; |
| | | $wb['faq_delete_txt'] = "Smazat"; |
| | | $wb['faq_edit_txt'] = "Upravit"; |
| | | $wb['faq_sections_txt'] = "Sekce"; |
| | | $wb['faq_faq_questions_txt'] = "Často kladené dotazy"; |
| | | $wb['faq_new_question_txt'] = "Přidat nový dotaz"; |
| | | ?> |
| | | |
| | |
| | | $wb['FAQ Sections'] = 'FAQ Sections'; |
| | | $wb['Manage Sections'] = 'Manage Sections'; |
| | | $wb['Add a Question & Answer Pair'] = 'Add a Question & Answer Pair'; |
| | | |
| | | $wb['Manage Questions'] = 'Manage Questions'; |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | $wb['faq_question_txt'] = "Question"; |
| | | $wb['faq_section_name_txt'] = "Section"; |
| | | $wb['faq_delete_txt'] = "Delete"; |
| | | $wb['faq_edit_txt'] = "Edit"; |
| | | $wb['faq_sections_txt'] = "Section"; |
| | | $wb['faq_faq_questions_txt'] = "Frequently Asked Questions"; |
| | | $wb['faq_new_question_txt'] = "Add a new question & answer pair"; |
| | | ?> |
| | | |
| | |
| | | $itemsfaq = array(); |
| | | //* admin's tools |
| | | if($_SESSION['s']['user']['typ'] == 'admin') { |
| | | $itemsfaq[] = array( 'title' => 'Add a Question & Answer Pair', |
| | | $itemsfaq[] = array( 'title' => 'Manage Questions', |
| | | 'target' => 'content', |
| | | 'link' => 'help/faq_edit.php'); |
| | | 'link' => 'help/faq_manage_questions_list.php'); |
| | | $itemsfaq[] = array( 'title' => 'Manage Sections', |
| | | 'target' => 'content', |
| | | 'link' => 'help/faq_sections_list.php'); |
| | | } |
| | | $sql = "SELECT * FROM help_faq_sections"; |
| | | $res = $app->db->queryAllRecords($sql); |
| | | //* all the content sections |
| | | if(is_array($res)) { |
| | | foreach($res as $v) { |
| | | $itemsfaq[] = array( 'title' => $v['hfs_name'], |
| | | 'target' => 'content', |
| | | 'link' => 'help/faq_list.php?hfs_id='.$v['hfs_id']); |
| | | else |
| | | { //* the user |
| | | $sql = "SELECT * FROM help_faq_sections"; |
| | | $res = $app->db->queryAllRecords($sql); |
| | | //* all the content sections |
| | | if(is_array($res)) { |
| | | foreach($res as $v) { |
| | | $itemsfaq[] = array( 'title' => $v['hfs_name'], |
| | | 'target' => 'content', |
| | | 'link' => 'help/faq_list.php?hfs_id='.$v['hfs_id']); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | $liste['records_per_page']= 100; |
| | | |
| | | // Script File of the list |
| | | $liste['file'] = 'faq_list.php'; |
| | | $liste['file'] = 'faq_manage_questions_list.php'; |
| | | |
| | | // Script file of the edit form |
| | | $liste['edit_file'] = 'faq_edit.php'; |
New file |
| | |
| | | <?php |
| | | |
| | | // Name of the list |
| | | $liste['name'] = 'faq_manage_questions'; |
| | | |
| | | // Database table |
| | | $liste['table'] = 'help_faq'; |
| | | |
| | | // Index index field of the database table |
| | | $liste['table_idx'] = 'hf_id'; |
| | | |
| | | // Search Field Prefix |
| | | #$liste['search_prefix'] = 'search_'; |
| | | |
| | | // Records per page |
| | | $liste['records_per_page']= 30; |
| | | |
| | | // Script File of the list |
| | | $liste['file'] = 'faq_manage_questions_list.php'; |
| | | |
| | | // Script file of the edit form |
| | | $liste['edit_file'] = 'faq_edit.php'; |
| | | |
| | | // Script File of the delete script |
| | | $liste['delete_file'] = 'faq_delete.php'; |
| | | |
| | | // Paging Template |
| | | $liste['paging_tpl'] = 'templates/paging.tpl.htm'; |
| | | |
| | | // Enable auth |
| | | $liste['auth'] = 'yes'; |
| | | |
| | | |
| | | $liste["item"][] = array( 'field' => "hf_section", |
| | | 'datatype' => "VARCHAR", |
| | | 'formtype' => "SELECT", |
| | | 'op' => "=", |
| | | 'prefix' => "", |
| | | 'suffix' => "", |
| | | 'datasource' => array ( 'type' => 'SQL', |
| | | 'querystring' => 'SELECT a.hf_section, b.hfs_name FROM help_faq a, help_faq_sections b WHERE (a.hf_section = b.hfs_id)', |
| | | 'keyfield'=> 'hf_section', |
| | | 'valuefield'=> 'hfs_name' |
| | | ), |
| | | 'width' => "", |
| | | 'value' => ""); |
| | | ?> |
New file |
| | |
| | | <h2>{tmpl_var name="faq_faq_questions_txt"}</h2> |
| | | <div class="pnl_toolsarea"> |
| | | <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend> |
| | | <div class="buttons"> |
| | | <button class="iconstxt icoAdd" type="button" onclick="loadContent('help/faq_edit.php');"> |
| | | <span>{tmpl_var name="faq_new_question_txt"}</span> |
| | | </button> |
| | | </div> |
| | | </fieldset> |
| | | </div> |
| | | |
| | | <div class="pnl_listarea"> |
| | | <fieldset><legend><tmpl_var name="faq_sections_txt"></legend> |
| | | <table class="list"> |
| | | <thead> |
| | | <tr> |
| | | <th class="tbl_col_active" scope="col">{tmpl_var name="faq_question_txt"}</th> |
| | | <th class="tbl_col_active" scope="col">{tmpl_var name="faq_section_name_txt"}</th> |
| | | <th class="tbl_col_server_id" scope="col">{tmpl_var name="faq_delete_txt"}</th> |
| | | <th class="tbl_col_domain" scope="col">{tmpl_var name="faq_edit_txt"}</th> |
| | | </tr> |
| | | </thead> |
| | | |
| | | |
| | | <tmpl_loop name="records"> |
| | | <tr> |
| | | <td>{tmpl_var name='hf_question'}</td> |
| | | <td>{tmpl_var name='hf_section'}</td> |
| | | <td> |
| | | <div class="buttons icons16"> |
| | | <a class="icons16 icoDelete" href="javascript: del_record('help/faq_delete.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"> |
| | | <span>{tmpl_var name="faq_delete_txt"}</span></a> </div> |
| | | </td> |
| | | <td> |
| | | <a href="#" onClick="loadContent('help/faq_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="faq_edit_txt"}</a> |
| | | </td> |
| | | </tr> |
| | | </tmpl_loop> |
| | | |
| | | |
| | | </table> |
| | | </fieldset> |
| | | </div> |