Esempio n. 1
0
/*if ($totalQnasOnPage == 0) {
	redirect_header("javascript:history.go(-1)", 2, _AM_SF_NO_TOP_PERMISSIONS);
	exit;
}*/
// Arrays that will hold the informations passed on to smarty variables
$category = array();
$qnas = array();
$last_qnaObj = $faq_handler->getLastPublishedByCat(array(_SF_STATUS_OPENED));
if (isset($last_qnaObj[$categoryid])) {
    $categoryObj->setVar('last_faqid', $last_qnaObj[$categoryid]->getVar('faqid'));
    $categoryObj->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$categoryid]->getVar('faqid') . "'>" . $last_qnaObj[$categoryid]->question(50) . "</a>");
}
// Populating the smarty variables with informations related to the selected category
$category = $categoryObj->toArray(null, true);
$totalQnas = $category_handler->faqsCount(0, array(_SF_STATUS_OPENED));
$category['categoryPath'] = $categoryObj->getCategoryPath(false, true);
// Creating the sub-categories objects that belong to the selected category
$subcatsObj = $category_handler->getCategories(0, 0, $categoryid);
$total_subcats = count($subcatsObj);
$catQnasWithSub = 0;
if ($total_subcats != 0) {
    $faq_handler =& sf_gethandler('faq');
    // Arrays that will hold the informations passed on to smarty variables
    foreach ($subcatsObj as $key => $subcat) {
        $subcat_id = $subcat->getVar('categoryid');
        if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
            if (isset($last_qnaObj[$subcat_id])) {
                $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid'));
                $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question(50) . "</a>");
            }
            $subcat->setVar('faqcount', $totalQnas[$subcat_id]);
Esempio n. 2
0
    $sort = 'weight';
    $order = 'ASC';
}
$faqsObj = $faq_handler->getAllPublished($xoopsModuleConfig['indexperpage'], $start, $categoryid, $sort, $order);
if ($faqsObj) {
    $totalQnasOnPage = count($faqsObj);
} else {
    $totalQnasOnPage = 0;
}
// Arrays that will hold the informations passed on to smarty variables
$category = array();
$qnas = array();
// Populating the smarty variables with informations related to the selected category
$category = $categoryObj->toArray(null, true);
$totalQnas = $category_handler->publishedFaqsCount();
$category['categoryPath'] = $categoryObj->getCategoryPath();
if ($xoopsModuleConfig['displaylastfaq'] == 1) {
    // Get the last smartfaq
    $last_qnaObj = $faq_handler->getLastPublishedByCat();
}
$lastfaqsize = intval($xoopsModuleConfig['lastfaqsize']);
// Creating the sub-categories objects that belong to the selected category
$subcatsObj = $category_handler->getCategories(0, 0, $categoryid);
$total_subcats = count($subcatsObj);
$total_faqs = 0;
if ($total_subcats != 0) {
    $subcat_keys = array_keys($subcatsObj);
    foreach ($subcat_keys as $i) {
        $subcat_id = $subcatsObj[$i]->getVar('categoryid');
        if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
            if (isset($last_qnaObj[$subcat_id])) {