mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
FAQ fixes/enhancements
This commit is contained in:
@@ -222,6 +222,8 @@ class faq_main_ui extends e_admin_ui
|
|||||||
'add_faq' => array('title'=> LANA_FAQ_PREF_1, 'type'=>'userclass' ),
|
'add_faq' => array('title'=> LANA_FAQ_PREF_1, 'type'=>'userclass' ),
|
||||||
'submit_question' => array('title'=> LANA_FAQ_PREF_2, 'type'=>'userclass' ),
|
'submit_question' => array('title'=> LANA_FAQ_PREF_2, 'type'=>'userclass' ),
|
||||||
'submit_question_limit' => array('title'=> "'Ask a Question' limit per user", 'type'=>'number', 'data'=>'int', 'help'=>'0 = no limit'),
|
'submit_question_limit' => array('title'=> "'Ask a Question' limit per user", 'type'=>'number', 'data'=>'int', 'help'=>'0 = no limit'),
|
||||||
|
'submit_question_acknowledgement' => array('title'=> "Submitted Questions Acknowledgement", 'type'=>'textarea', 'help'=>'Leave blank to use default' ),
|
||||||
|
|
||||||
'classic_look' => array('title'=> LANA_FAQ_PREF_3, 'type'=>'boolean' ),
|
'classic_look' => array('title'=> LANA_FAQ_PREF_3, 'type'=>'boolean' ),
|
||||||
'list_type' => array('title'=> "List Type", 'type'=>'dropdown', 'writeParms'=>array('ul'=>'Unordered List', 'ol'=>'Ordered List') ),
|
'list_type' => array('title'=> "List Type", 'type'=>'dropdown', 'writeParms'=>array('ul'=>'Unordered List', 'ol'=>'Ordered List') ),
|
||||||
'page_title' => array('title'=> "Page Title", 'type'=>'text', 'help'=>'Leave blank to use default' ),
|
'page_title' => array('title'=> "Page Title", 'type'=>'text', 'help'=>'Leave blank to use default' ),
|
||||||
|
@@ -229,7 +229,8 @@ class faq
|
|||||||
|
|
||||||
if($sql->insert('faqs',$insert))
|
if($sql->insert('faqs',$insert))
|
||||||
{
|
{
|
||||||
e107::getMessage()->addSuccess('Thank you. Your question has been saved and will be answered as soon as possible.');
|
$message = !empty($this->pref['submit_question_acknowledgement']) ? e107::getParser()->toHtml($this->pref['submit_question_acknowledgement'],true, 'BODY') : 'Thank you. Your question has been saved and will be answered as soon as possible.'; //TODO LAN
|
||||||
|
e107::getMessage()->addSuccess($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -264,8 +265,15 @@ class faq
|
|||||||
|
|
||||||
$ret['title'] = FAQLAN_FAQ;
|
$ret['title'] = FAQLAN_FAQ;
|
||||||
$ret['text'] = $text;
|
$ret['text'] = $text;
|
||||||
$ret['caption'] = varset($template['caption']) ? $tp->parseTemplate($template['caption'], true, $this->sc) : LAN_PLUGIN_FAQS_FRONT_NAME;
|
|
||||||
|
if (!empty($this->pref['page_title']))
|
||||||
|
{
|
||||||
|
$ret['caption'] = e107::getParser()->toHtml($this->pref['page_title'], true, 'TITLE');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ret['caption'] = varset($template['caption']) ? $tp->parseTemplate($template['caption'], true, $this->sc) : LAN_PLUGIN_FAQS_FRONT_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@@ -45,7 +45,7 @@ class faqs_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
$faqNew = ($this->var['faq_datestamp'] > $newDate) ? " faq-new" : "";
|
$faqNew = ($this->var['faq_datestamp'] > $newDate) ? " faq-new" : "";
|
||||||
|
|
||||||
if($param == 'expand')
|
if($param == 'expand' && !empty($this->var['faq_answer']))
|
||||||
{
|
{
|
||||||
$tags = '';
|
$tags = '';
|
||||||
if(vartrue($params['tags']) && $this->var['faq_tags'])
|
if(vartrue($params['tags']) && $this->var['faq_tags'])
|
||||||
@@ -53,14 +53,17 @@ class faqs_shortcodes extends e_shortcode
|
|||||||
$tags = "<div class='faq-tags'>".LAN_FAQS_TAGS.": ".$this->sc_faq_tags()."</div>";
|
$tags = "<div class='faq-tags'>".LAN_FAQS_TAGS.": ".$this->sc_faq_tags()."</div>";
|
||||||
}
|
}
|
||||||
$id = "faq_".$this->var['faq_id'];
|
$id = "faq_".$this->var['faq_id'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$text = "<a class='e-expandit faq-question{$faqNew}' href='#{$id}'>".$tp->toHTML($this->var['faq_question'],true,'TITLE')."</a>
|
$text = "<a class='e-expandit faq-question{$faqNew}' href='#{$id}'>".$tp->toHTML($this->var['faq_question'],true,'TITLE')."</a>
|
||||||
<div id='{$id}' class='e-hideme faq-answer faq_answer clearfix {$faqNew}'>".$tp->toHTML($this->var['faq_answer'],true,'BODY').$tags."</div>
|
<div id='{$id}' class='e-hideme faq-answer faq_answer clearfix {$faqNew}'>".$tp->toHTML($this->var['faq_answer'],true,'BODY').$tags."</div>
|
||||||
";
|
";
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$text = $tp->toHTML($this->var['faq_question'],true, 'TITLE');
|
$text = $tp->toHTML($this->var['faq_question'],true, 'BODY');
|
||||||
}
|
}
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
@@ -169,6 +172,13 @@ class faqs_shortcodes extends e_shortcode
|
|||||||
return e107::getUrl()->create('faqs/list/all', array('category' => $this->var['faq_info_id']));
|
return e107::getUrl()->create('faqs/list/all', array('category' => $this->var['faq_info_id']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function sc_faq_datestamp($parm)
|
||||||
|
{
|
||||||
|
$type = vartrue($parm, 'relative');
|
||||||
|
return e107::getParser()->toDate($this->var['faq_datestamp'], $type);
|
||||||
|
}
|
||||||
|
|
||||||
function sc_faq_caption()
|
function sc_faq_caption()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -206,17 +216,29 @@ class faqs_shortcodes extends e_shortcode
|
|||||||
return "<img src='".e_PLUGIN_ABS."faq/images/faq.png' alt='' />";
|
return "<img src='".e_PLUGIN_ABS."faq/images/faq.png' alt='' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_faq_submit_question()
|
function sc_faq_submit_question($parms)
|
||||||
{
|
{
|
||||||
|
|
||||||
$faqpref = e107::pref('faqs');
|
$faqpref = e107::pref('faqs');
|
||||||
|
|
||||||
|
if(!empty($parms['expand']))
|
||||||
|
{
|
||||||
|
$hide = 'e-hideme';
|
||||||
|
$button = "<a class='btn btn-primary e-expandit faq-submit-question' href='#form-ask-a-question'>Ask a Question</a>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$hide = "";
|
||||||
|
$button = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (check_class($faqpref['submit_question']))
|
if (check_class($faqpref['submit_question']))
|
||||||
{
|
{
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
|
|
||||||
$text = "<a class='btn btn-primary e-expandit faq-submit-question' href='#ask-a-question'>Ask a Question</a>
|
$text = $button;
|
||||||
<div id='ask-a-question' class='alert alert-info alert-block e-hideme form-group faq-submit-question-form'>";
|
|
||||||
|
$text .= "<div id='form-ask-a-question' class='alert alert-info alert-block ".$hide." form-group faq-submit-question-form'>";
|
||||||
|
|
||||||
$text .= $frm->open('faq-ask-question','post');
|
$text .= $frm->open('faq-ask-question','post');
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$FAQS_TEMPLATE['start'] = "
|
$FAQS_TEMPLATE['start'] = "
|
||||||
<div class='faq-start'>{FAQ_SUBMIT_QUESTION}
|
<div class='faq-start'>{FAQ_SUBMIT_QUESTION: expand=1}
|
||||||
{FAQ_SUBMIT_QUESTION_LIST}
|
{FAQ_SUBMIT_QUESTION_LIST}
|
||||||
";
|
";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user