Esempio n. 1
0
}
// If there is no Q&As to display, exit
/*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>");