예제 #1
0
 function zen_show_faq_category($counter, $ii)
 {
     global $fcPath_array;
     $this->faq_categories_string = "";
     for ($i = 0; $i < $this->tree[$counter]['level']; $i++) {
         if ($this->tree[$counter]['parent'] != 0) {
             $this->faq_categories_string .= FAQ_CATEGORIES_SUBFAQ_CATEGORIES_INDENT;
         }
     }
     if ($this->tree[$counter]['parent'] == 0) {
         $fcPath_new = 'fcPath=' . $counter;
         $this->box_faq_categories_array[$ii]['top'] = 'true';
     } else {
         $this->box_faq_categories_array[$ii]['top'] = 'false';
         $fcPath_new = 'fcPath=' . $this->tree[$counter]['path'];
         $this->faq_categories_string .= FAQ_CATEGORIES_SEPARATOR_SUBS;
     }
     $this->box_faq_categories_array[$ii]['path'] = $fcPath_new;
     if (isset($fcPath_array) && in_array($counter, $fcPath_array)) {
         $this->box_faq_categories_array[$ii]['current'] = true;
     }
     // display faq_category name
     $this->box_faq_categories_array[$ii]['name'] = $this->faq_categories_string . $this->tree[$counter]['name'];
     if (zen_has_faq_category_subfaq_categories($counter)) {
         $this->box_faq_categories_array[$ii]['has_sub_cat'] = true;
     }
     if (SHOW_COUNTS == 'true') {
         $faqs_in_faq_category = zen_count_faqs_in_faq_category($counter);
         if ($faqs_in_faq_category > 0) {
             $this->box_faq_categories_array[$ii]['count'] = $faqs_in_faq_category;
         }
     }
     if ($this->tree[$counter]['next_id'] != false) {
         $ii++;
         $this->zen_show_faq_category($this->tree[$counter]['next_id'], $ii);
     }
     return $this->box_faq_categories_array;
 }
예제 #2
0
function zen_count_faqs_in_faq_category($faq_category_id, $include_inactive = false)
{
    global $db;
    $faqs_count = 0;
    if ($include_inactive == true) {
        $faqs_query = "select count(*) as total\n                         from " . TABLE_FAQS . " p, " . TABLE_FAQS_TO_FAQ_CATEGORIES . " p2c\n                         where p.faqs_id = p2c.faqs_id\n                         and p2c.faq_categories_id = '" . (int) $faq_category_id . "'";
    } else {
        $faqs_query = "select count(*) as total\n                         from " . TABLE_FAQS . " p, " . TABLE_FAQS_TO_FAQ_CATEGORIES . " p2c\n                         where p.faqs_id = p2c.faqs_id\n                         and p.faqs_status = '1'\n                         and p2c.faq_categories_id = '" . (int) $faq_category_id . "'";
    }
    $faqs = $db->Execute($faqs_query);
    $faqs_count += $faqs->fields['total'];
    $child_faq_categories_query = "select faq_categories_id\n                               from " . TABLE_FAQ_CATEGORIES . "\n                               where parent_id = '" . (int) $faq_category_id . "'";
    $child_faq_categories = $db->Execute($child_faq_categories_query);
    if ($child_faq_categories->RecordCount() > 0) {
        while (!$child_faq_categories->EOF) {
            $faqs_count += zen_count_faqs_in_faq_category($child_faq_categories->fields['faq_categories_id'], $include_inactive);
            $child_faq_categories->MoveNext();
        }
    }
    return $faqs_count;
}