mirror of
https://github.com/e107inc/e107.git
synced 2025-06-02 00:45:03 +02:00
FAQ improvements.
This commit is contained in:
parent
53565870ba
commit
51c7c67947
@ -40,7 +40,7 @@ class faq_admin extends e_admin_dispatcher
|
||||
protected $adminMenu = array(
|
||||
'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'),
|
||||
'main/create' => array('caption'=> LAN_CREATE_ITEM, 'perm' => 'P'),
|
||||
'main/pending' => array('caption'=> "Unanswered", 'perm' => 'P', 'uri'=>"admin_config.php?searchquery=&filter_options=faq_author__0&mode=main&action=list&filter=pending"),
|
||||
'main/pending' => array('caption'=> "Unanswered", 'perm' => 'P', 'uri'=>"admin_config.php?mode=main&action=list&filter=pending"),
|
||||
|
||||
'cat/list' => array('caption'=> LAN_CATEGORIES, 'perm' => 'P'),
|
||||
'cat/create' => array('caption'=> LAN_CREATE_CATEGORY, 'perm' => 'P'),
|
||||
@ -203,7 +203,7 @@ class faq_main_ui extends e_admin_ui
|
||||
'faq_tags' => array('title'=> LANA_FAQ_TAGS, 'tab' => 1, 'type' => 'tags', 'data' => 'str', 'width' => 'auto', 'inline'=> true, 'help' => LANA_FAQ_TAGS_HELP), // User id
|
||||
'faq_comment' => array('title'=> LANA_FAQ_COMMENT, 'tab' => 1, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto', 'inline'=> true), // User id
|
||||
|
||||
'faq_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=> 'int','width' => 'auto', 'noedit' => false,'writeParms'=>'auto=1'),
|
||||
'faq_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=> 'int','width' => 'auto', 'noedit' => false,'writeParms'=>'type=datetime&auto=1'),
|
||||
'faq_author' => array('title'=> LAN_USER, 'tab' => 1, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ), // Photo
|
||||
'faq_author_ip' => array('title'=> LAN_IP, 'tab' => 1, 'type' => 'ip', 'readonly'=>2, 'data'=> 'str', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ), // Photo
|
||||
|
||||
@ -227,6 +227,7 @@ class faq_main_ui extends e_admin_ui
|
||||
'page_title' => array('title'=> "Page Title", 'type'=>'text', 'help'=>'Leave blank to use default' ),
|
||||
'new' => array('title'=> "'New' FAQs are no more than", 'type'=>'number', 'writeParms'=>'size=mini&default=0&post=days old', 'help'=>'Leave blank to use default' ),
|
||||
'display_total' => array('title'=> "Display FAQ total", 'type'=>'boolean' ),
|
||||
'orderby' => array('title'=> LAN_ORDER, 'type'=>'dropdown', 'writeParms'=>array('faq_order-ASC'=>"Specified Order", 'faq_id-ASC'=>'ID ASC', 'faq_id-DESC'=>'ID DESC', 'faq_datestamp-ASC'=>'Date ASC', 'faq_datestamp-DESC'=>'Date DESC'))
|
||||
);
|
||||
|
||||
protected $categories = array();
|
||||
@ -251,10 +252,15 @@ class faq_main_ui extends e_admin_ui
|
||||
|
||||
if(!empty($_GET['filter'])) // hide re-ordering when looking at 'unanswered' list and sort by datestamp.
|
||||
{
|
||||
$this->listQry .= " WHERE f.faq_parent = 0 ";
|
||||
$this->listOrder = "faq_datestamp ASC";
|
||||
$this->fields['options']['readParms'] = '';
|
||||
$this->sortField = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->listQry .= " WHERE f.faq_parent != 0 ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
$email = e107::pref('core','siteadminemail');
|
||||
$name = e107::pref('core','siteadmin');
|
||||
|
||||
$link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?searchquery=&filter_options=faq_author__0&mode=main&action=list", 'full');
|
||||
$link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?mode=main&action=list&filter=pending", 'full');
|
||||
|
||||
$eml = array(
|
||||
'subject' => count($existing)." Unuanswered Question as of ".date('d-M-Y')." ",
|
||||
|
@ -195,7 +195,7 @@ class faq
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$sc = e107::getScBatch('faqs',TRUE);
|
||||
$sc = e107::getScBatch('faqs', true);
|
||||
$this->pref = e107::pref('faqs'); // Short version of e107::getPlugConfig('faqs')->getPref(); ;
|
||||
$sc->pref = $this->pref;
|
||||
|
||||
@ -215,13 +215,13 @@ class faq
|
||||
$question = filter_input(INPUT_POST, 'ask_a_question', FILTER_SANITIZE_STRING);
|
||||
|
||||
$insert = array(
|
||||
'faq_id' =>0,
|
||||
'faq_parent' =>0,
|
||||
'faq_id' => 0,
|
||||
'faq_parent' => 0, // meaning 'unassigned/unanswered'.
|
||||
'faq_question' => $question,
|
||||
'faq_answer' => '',
|
||||
'faq_comment' => 0,
|
||||
'faq_datestamp' => time(),
|
||||
'faq_author' => 0,
|
||||
'faq_author' => USERID,
|
||||
'faq_author_ip' => USERIP,
|
||||
'faq_tags' => '',
|
||||
'faq_order' => 99999
|
||||
@ -308,7 +308,10 @@ class faq
|
||||
$text = e107::getMessage()->render();
|
||||
}
|
||||
|
||||
$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.") ".$insert." ORDER BY cat.faq_info_order,f.faq_order ";
|
||||
|
||||
list($orderBy, $ascdesc) = explode('-', vartrue($this->pref['orderby'],'faq_order-ASC'));
|
||||
|
||||
$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.") ".$insert." ORDER BY cat.faq_info_order, f.".$orderBy." ".$ascdesc." ";
|
||||
|
||||
if(!$sql->gen($query))
|
||||
{
|
||||
@ -329,6 +332,18 @@ class faq
|
||||
|
||||
// $text = "";
|
||||
|
||||
|
||||
|
||||
if($this->pref['list_type'] == 'ol')
|
||||
{
|
||||
$reversed = ($ascdesc == 'DESC') ? 'reversed ' : '';
|
||||
$tsrch = array('<ul ','/ul>');
|
||||
$trepl = array('<ol '.$reversed,'/ol>');
|
||||
$FAQ_LISTALL['start'] = str_replace($tsrch,$trepl, $FAQ_LISTALL['start']);
|
||||
$FAQ_LISTALL['end'] = str_replace($tsrch,$trepl, $FAQ_LISTALL['end']);
|
||||
}
|
||||
|
||||
|
||||
while ($rw = $sql->fetch())
|
||||
{
|
||||
$sc->setVars($rw);
|
||||
|
Loading…
x
Reference in New Issue
Block a user