mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 22:57:14 +02:00
FAQ plugin front-end rewrite started
This commit is contained in:
@@ -2739,6 +2739,7 @@ class eController
|
||||
public function dispatch($actionMethodName)
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$content = '';
|
||||
|
||||
// init() could modify the dispatch status
|
||||
if($request->isDispatched())
|
||||
@@ -2750,7 +2751,10 @@ class eController
|
||||
if($request->isDispatched())
|
||||
{
|
||||
$request->populateRequestParams();
|
||||
$this->$actionMethodName();
|
||||
|
||||
// allow return output
|
||||
$content = $this->$actionMethodName();
|
||||
if(!empty($content)) $this->addBody($content);
|
||||
|
||||
if($request->isDispatched())
|
||||
{
|
||||
|
@@ -1930,7 +1930,7 @@ class e107
|
||||
{
|
||||
return self::getCoreTemplate($id, $key, $override, $merge, $info);
|
||||
}
|
||||
if(null == $id) // loads {$plug_name}/templates/{$plug_name}_template.php and an array ${PLUG_NAME}_TEMPLATE
|
||||
if(null == $id || true === $id) // loads {$plug_name}/templates/{$plug_name}_template.php and an array ${PLUG_NAME}_TEMPLATE
|
||||
{
|
||||
$id = $plug_name;
|
||||
}
|
||||
|
77
e107_plugins/faqs/controllers/list.php
Normal file
77
e107_plugins/faqs/controllers/list.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2012 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package e107
|
||||
* @subpackage faqs
|
||||
* @version $Id$
|
||||
* @author e107inc
|
||||
*
|
||||
* FAQ plugin list controller
|
||||
*/
|
||||
|
||||
class plugin_faqs_list_controller extends eController
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
e107::lan('faqs', 'front');
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$this->_forward('all');
|
||||
}
|
||||
|
||||
public function actionAll()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$tp = e107::getParser();
|
||||
|
||||
//global $FAQ_START, $FAQ_END, $FAQ_LISTALL_START,$FAQ_LISTALL_LOOP,$FAQ_LISTALL_END;
|
||||
|
||||
$FAQ_START = e107::getTemplate('faqs', true, 'start');
|
||||
$FAQ_END = e107::getTemplate('faqs', true, 'end');
|
||||
$FAQ_LISTALL = e107::getTemplate('faqs', true, 'all');
|
||||
|
||||
$query = "SELECT f.*,cat.* FROM #faqs AS f LEFT JOIN #faqs_info AS cat ON f.faq_parent = cat.faq_info_id WHERE cat.faq_info_class IN (".USERCLASS_LIST.") ORDER BY cat.faq_info_order,f.faq_order ";
|
||||
$sql->gen($query);
|
||||
|
||||
$prevcat = "";
|
||||
$sc = e107::getScBatch('faqs', true);
|
||||
|
||||
$text = $tp->parseTemplate($FAQ_START, true);
|
||||
while ($rw = $sql->db_Fetch())
|
||||
{
|
||||
$sc->setVars($rw);
|
||||
|
||||
if($rw['faq_info_order'] != $prevcat)
|
||||
{
|
||||
if($prevcat !='')
|
||||
{
|
||||
$text .= $tp->parseTemplate($FAQ_LISTALL['end'], true);
|
||||
}
|
||||
$text .= "\n\n<!-- FAQ Start ".$rw['faq_info_order']."-->\n\n";
|
||||
$text .= $tp->parseTemplate($FAQ_LISTALL['start'], true);
|
||||
$start = TRUE;
|
||||
}
|
||||
|
||||
$text .= $tp->parseTemplate($FAQ_LISTALL['item'], true);
|
||||
$prevcat = $rw['faq_info_order'];
|
||||
|
||||
}
|
||||
$text .= $tp->parseTemplate($FAQ_LISTALL['end'], true);
|
||||
$text .= $tp->parseTemplate($FAQ_END, true);
|
||||
|
||||
$this->addTitle(FAQLAN_FAQ);
|
||||
|
||||
$this->addBody($text);
|
||||
}
|
||||
}
|
12
e107_plugins/faqs/languages/English/admin.php
Normal file
12
e107_plugins/faqs/languages/English/admin.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) e107 Inc 2008-2013 - e107.org,
|
||||
* Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* 'FAQ plugin' admin-area language definitions
|
||||
*/
|
||||
//TODO
|
||||
|
||||
|
||||
|
||||
?>
|
27
e107_plugins/faqs/languages/English/front.php
Normal file
27
e107_plugins/faqs/languages/English/front.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
// FAQs front-end language file.
|
||||
//TODO Rework names.
|
||||
|
||||
define(FAQLAN_23, "FAQ (Frequently Asked Questions) :: ");
|
||||
define(FAQLAN_38, "Comment"); //TODO Generic Front-end
|
||||
define(FAQLAN_FAQ, "FAQ");
|
||||
define(FAQLAN_41, "FAQ Categories");
|
||||
define(FAQLAN_42, "Total");
|
||||
|
||||
define(FAQ_ADLAN_29, "FAQ entry updated");
|
||||
define(FAQ_ADLAN_30, "You left a required field blank.");
|
||||
define(FAQ_ADLAN_32, "New FAQ item created and entered into database.");
|
||||
|
||||
define(FAQ_ADLAN_45, "Edit"); //TODO Generic Front-end
|
||||
define(FAQ_ADLAN_49, "Previous FAQ entries: ");
|
||||
define(FAQ_ADLAN_50, "Delete"); //TODO Generic Front-end
|
||||
define(FAQ_ADLAN_51, "FAQ Question: ");
|
||||
define(FAQ_ADLAN_52, "Allow Comments?: ");
|
||||
define(FAQ_ADLAN_53, "Update FAQ Item ");
|
||||
define(FAQ_ADLAN_54, "Submit FAQ Item");
|
||||
define(FAQ_ADLAN_60, "FAQ Answer:");
|
||||
|
||||
define(FAQ_ADLAN_78, "Category"); //TODO Generic Front-end
|
||||
|
||||
|
||||
?>
|
115
e107_plugins/faqs/templates/faqs_template.php
Normal file
115
e107_plugins/faqs/templates/faqs_template.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/faqs_template.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// FAQ - NEW LOOK (all you need is here) -------------------------------------------------------------
|
||||
|
||||
$FAQS_TEMPLATE['start'] = "
|
||||
<div class='faq-start'>
|
||||
";
|
||||
|
||||
$FAQS_TEMPLATE['end'] = "
|
||||
<div class='faq-submit-question'>{FAQ_SUBMIT_QUESTION}</div>
|
||||
<div class='faq-search'>{FAQ_SEARCH}</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
$FAQS_TEMPLATE['all']['start'] = "
|
||||
<div>
|
||||
<h2 class='faq-listall'>{FAQ_CATEGORY}</h2>
|
||||
<ul class='faq-listall'>
|
||||
";
|
||||
$FAQS_TEMPLATE['all']['item'] = "
|
||||
<li class='faq-listall'>{FAQ_QUESTION=expand}</li>
|
||||
";
|
||||
$FAQS_TEMPLATE['all']['end'] = "
|
||||
</ul>
|
||||
</div>
|
||||
";
|
||||
|
||||
|
||||
// FAQ - CLASSIC LOOK BELOW #####################################################
|
||||
|
||||
// FAQ - PARENT LIST ---------------------------------------------------------
|
||||
|
||||
$FAQS_TEMPLATE['cat']['start'] = "
|
||||
<table class='table fborder' style='".USER_WIDTH."'>
|
||||
<tr>
|
||||
<td colspan='2' style='text-align:center; width:55%' class='fcaption'>".FAQLAN_41."</td>
|
||||
<td class='fcaption' style='width:20%;text-align:center'>".FAQLAN_42."</td>
|
||||
</tr>";
|
||||
|
||||
$FAQS_TEMPLATE['cat']['parent'] = "
|
||||
<tr>
|
||||
<td colspan='3' style='width:55%' class='forumheader'>
|
||||
{FAQ_CATEGORY}
|
||||
<span class='smalltext'> {FAQ_CAT_DIZ}</span>
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$FAQS_TEMPLATE['cat']['child'] = "
|
||||
<tr>
|
||||
<td class='forumheader3' style='width:30px'>{FAQ_ICON}</td>
|
||||
<td class='forumheader2' style='width:95%'>{FAQ_CATLINK}
|
||||
<br /><span class='smalltext'>{FAQ_CAT_DIZ}</span></td>
|
||||
<td style='width:100px; text-align:center' class='forumheader2'>
|
||||
{FAQ_COUNT}
|
||||
</td>
|
||||
</tr>";
|
||||
|
||||
$FAQS_TEMPLATE['cat']['end'] = "</table></div></div>";
|
||||
|
||||
|
||||
// FAQ - LIST ---------------------------------------------------------
|
||||
|
||||
$FAQS_TEMPLATE['list']['start'] = "
|
||||
<table class='table fborder' style='".USER_WIDTH."'> ";
|
||||
|
||||
$FAQS_TEMPLATE['list']['item'] .= "
|
||||
<tr>
|
||||
<td class='forumheader3' style='width:30px;vertical-align:top'>{FAQ_ICON}</td>
|
||||
<td class='forumheader3'> {FAQ_QUESTION_LINK}</td>
|
||||
</tr>";
|
||||
|
||||
$FAQS_TEMPLATE['list']['end'] = "</table>";
|
||||
|
||||
|
||||
// FAQ - VIEW ----------------------------------------------------------------
|
||||
// FAQ - VIEW
|
||||
|
||||
$FAQS_TEMPLATE['view']['start'] = "
|
||||
<table class='table fborder' style='margin-left:auto;margin-right:auto;padding:0px;".USER_WIDTH.";' >
|
||||
<tr>
|
||||
<td class='forumheader3' style='vertical-align:top;width:30px'>
|
||||
<img src='".e_PLUGIN_ABS."faqs/images/q.png' alt='' />
|
||||
</td>
|
||||
<td class='forumheader3' style='vertical-align:top'>
|
||||
{FAQ_QUESTION}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='forumheader3' style='width:30px;vertical-align:top'>
|
||||
<img src='".e_PLUGIN_ABS."faqs/images/a.png' alt='' />
|
||||
</td>
|
||||
<td class='forumheader3'>
|
||||
<div class='faq_answer'>{FAQ_ANSWER}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style='text-align:right; width:100%'>
|
||||
{FAQ_EDIT}
|
||||
</div>
|
||||
";
|
Reference in New Issue
Block a user