";
$qry = "SELECT dc.*,
COUNT(d.faq_id) AS f_count,
COUNT(d2.faq_id) AS f_subcount
FROM #faqs_info AS dc
LEFT JOIN #faqs AS d ON dc.faq_info_id = d.faq_parent
LEFT JOIN #faqs_info as dc2 ON dc2.faq_info_parent = dc.faq_info_id
LEFT JOIN #faqs AS d2 ON dc2.faq_info_id = d2.faq_parent
WHERE dc.faq_info_class IN (".USERCLASS_LIST.")
GROUP by dc.faq_info_id ORDER by dc.faq_info_order,dc.faq_info_parent "; //
$text .= $FAQ_CAT_START;
$sql->db_Select_gen($qry);
while ($row = $sql->db_Fetch())
{
$sc->setVars($row);
if ($row['faq_info_parent'] == '0') //
{
$text .= $tp->parseTemplate($FAQ_CAT_PARENT, true);
}
else
{
if (!$row['f_count'] && !$row['f_subcount'])
{
$text .= $tp->parseTemplate($FAQ_CAT_CHILD, true);
}
else
{
$text .= $tp->parseTemplate($FAQ_CAT_CHILD, true);
}
}
}
$text .= $FAQ_CAT_END;
$ret['text'] = $text.$this->faq_footer();
return $ret;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function view_faq($idx)
{
global $ns,$row,$sql,$aj,$pref,$cobj,$id,$tp,$FAQ_VIEW_TEMPLATE;
//require_once (e_PLUGIN."faqs/faqs_shortcodes.php");
$sc = e107::getScBatch('faqs',TRUE);
$sql->db_Select("faqs", "*", "faq_id='$idx' LIMIT 1");
$row = $sql->db_Fetch();
$sc->setVars($row);
$caption = " FAQ #".$row['faq_id'];
$text = $tp->parseTemplate($FAQ_VIEW_TEMPLATE, true);
// $text = $tp->toHTML($text, TRUE);
$ret['text'] = $text;
$ret['caption'] = $caption;
$ret['title'] = $row['faq_question'];
$ret['comments'] = $text;
return $ret;
$subject = (!$subject ? $aj->formtpa($faq_question) : $subject);
if (check_class($row['faq_comment']))
{
$action = "comment";
$table = "faq";
$query = ($pref['nested_comments'] ? "comment_item_id='$idx' AND (comment_type='$table' OR comment_type='3') AND comment_pid='0' ORDER BY comment_datestamp" : "comment_item_id='$idx' AND (comment_type='$table' OR comment_type='3') ORDER BY comment_datestamp");
unset($text);
if (!is_object($sql2))
{
$sql2 = new db;
}
if ($comment_total = $sql2->db_Select("comments", "*", $query))
{
$width = 0;
while ($row = $sql2->db_Fetch())
{
if ($pref['nested_comments'])
{
$text = $cobj->render_comment($row, $table, $action, $idx.".".$id, $width, $subject);
$ns->tablerender(FAQLAN_38, $text);
}
else
{
$text .= $cobj->render_comment($row, $table, $action, $idx.".".$id, $width, $subject);
}
}
if (!$pref['nested_comments'])
{
$ns->tablerender("Comments", $text);
}
if (ADMIN && getperms("B"))
{
// bkwon 05-Jun-2004 fix URL to moderate comment
echo "
";
}
}
$cobj->form_comment($action, $table, $idx.".".$id, $subject, $content_type);
} // end of check_class
}
function faq_footer($id='')
{
global $faqpref,$timing_start,$tp,$cust_footer, $CUSTOMPAGES, $CUSTOMHEADER, $CUSTOMHEADER;
$text_menu .= "
";
$text_menu .= "
".$tp->parseTemplate("{SEARCH=faqs}")."
";
return $text_menu;
// require_once (FOOTERF);
}
function add_faq($action, $id, $idx)
{
global $rs;
$tp = e107::getParser();
$sql = e107::getDb();
$ns = e107::getRender();
$userid = USERID;
$text .= "
";
if(varset($faq))
{
$sql->db_Select("faqs_info", "*", "faq_info_id='$faq'");
$row = $sql->db_Fetch();
extract($row);
}
$ns->tablerender("Frequently asked Questions".$faq_info_title, "
".$text."
".$this->faq_footer());
}
}
?>