diff --git a/e107_handlers/application.php b/e107_handlers/application.php index 2999d4956..64a07f0a6 100644 --- a/e107_handlers/application.php +++ b/e107_handlers/application.php @@ -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()) { diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index cfbe92a21..03d76cf58 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -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; } diff --git a/e107_plugins/faqs/controllers/list.php b/e107_plugins/faqs/controllers/list.php new file mode 100644 index 000000000..4fb64f927 --- /dev/null +++ b/e107_plugins/faqs/controllers/list.php @@ -0,0 +1,77 @@ +_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\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); + } +} diff --git a/e107_plugins/faqs/languages/English/admin.php b/e107_plugins/faqs/languages/English/admin.php new file mode 100644 index 000000000..b644db21f --- /dev/null +++ b/e107_plugins/faqs/languages/English/admin.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/e107_plugins/faqs/languages/English/front.php b/e107_plugins/faqs/languages/English/front.php new file mode 100644 index 000000000..6b4fd1d61 --- /dev/null +++ b/e107_plugins/faqs/languages/English/front.php @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/e107_plugins/faqs/templates/faqs_template.php b/e107_plugins/faqs/templates/faqs_template.php new file mode 100644 index 000000000..1898c102a --- /dev/null +++ b/e107_plugins/faqs/templates/faqs_template.php @@ -0,0 +1,115 @@ + +"; + +$FAQS_TEMPLATE['end'] = " +
{FAQ_SUBMIT_QUESTION}
+ + +"; + +$FAQS_TEMPLATE['all']['start'] = " +
+

{FAQ_CATEGORY}

+ +
+"; + + +// FAQ - CLASSIC LOOK BELOW ##################################################### + +// FAQ - PARENT LIST --------------------------------------------------------- + + $FAQS_TEMPLATE['cat']['start'] = " + + + + + "; + + $FAQS_TEMPLATE['cat']['parent'] = " + + + "; + + $FAQS_TEMPLATE['cat']['child'] = " + + + + + "; + + $FAQS_TEMPLATE['cat']['end'] = "
".FAQLAN_41."".FAQLAN_42."
+ {FAQ_CATEGORY} +    {FAQ_CAT_DIZ} +
{FAQ_ICON}{FAQ_CATLINK} +
{FAQ_CAT_DIZ}
+ {FAQ_COUNT} +
"; + + +// FAQ - LIST --------------------------------------------------------- + + $FAQS_TEMPLATE['list']['start'] = " + "; + + $FAQS_TEMPLATE['list']['item'] .= " + + + + "; + + $FAQS_TEMPLATE['list']['end'] = "
{FAQ_ICON} {FAQ_QUESTION_LINK}
"; + + +// FAQ - VIEW ---------------------------------------------------------------- +// FAQ - VIEW + + $FAQS_TEMPLATE['view']['start'] = " + + + + + + + + + + +
+ + + {FAQ_QUESTION} +
+ + +
{FAQ_ANSWER}
+
+
+ {FAQ_EDIT} +
+";