<td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?> </td> </tr> <tr> <td class="main" align="right"><?php echo zen_draw_hidden_field('faqs_date_added', zen_not_null($pInfo->faqs_date_added) ? $pInfo->faqs_date_added : date('Y-m-d')) . zen_image_submit('button_preview.gif', IMAGE_PREVIEW) . ' <a href="' . zen_href_link(FILENAME_FAQ_CATEGORIES, 'fcPath=' . $fcPath . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?> </td> </tr> <tr> <td><table border="0" cellspacing="0" cellpadding="2"> <?php // show when faq is linked if (zen_get_faq_is_linked($_GET['pID']) == 'true') { ?> <tr> <td class="main"><?php echo TEXT_MASTER_FAQ_CATEGORIES_ID; ?> </td> <td class="main"> <?php // echo zen_draw_pull_down_menu('faqs_tax_class_id', $tax_class_array, $pInfo->faqs_tax_class_id); echo zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . ' '; echo zen_draw_pull_down_menu('master_faq_category', zen_get_master_faq_categories_pulldown($_GET['pID']), $pInfo->master_faq_categories_id); ?> </td> </tr> <tr>
function zen_get_faqs_to_faq_categories($faq_category_id, $include_inactive = false, $counts_what = 'faqs') { global $db; $faqs_count = 0; if ($include_inactive == true) { switch ($counts_what) { case 'faqs': $cat_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 . "'"; break; case 'faqs_active': $cat_faqs_query = "select p.faqs_id\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 . "'"; break; } } else { switch ($counts_what) { case 'faqs': $cat_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 . "'"; break; case 'faqs_active': $cat_faqs_query = "select p.faqs_id\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 . "'"; break; } } $cat_faqs = $db->Execute($cat_faqs_query); switch ($counts_what) { case 'faqs': $cat_faqs_count += $cat_faqs->fields['total']; break; case 'faqs_active': while (!$cat_faqs->EOF) { if (zen_get_faq_is_linked($cat_faqs->fields['faqs_id']) == 'true') { return $faqs_linked = 'true'; } $cat_faqs->MoveNext(); } break; } $cat_child_faq_categories_query = "select faq_categories_id\n from " . TABLE_FAQ_CATEGORIES . "\n where parent_id = '" . (int) $faq_category_id . "'"; $cat_child_faq_categories = $db->Execute($cat_child_faq_categories_query); if ($cat_child_faq_categories->RecordCount() > 0) { while (!$cat_child_faq_categories->EOF) { switch ($counts_what) { case 'faqs': $cat_faqs_count += zen_get_faqs_to_faq_categories($cat_child_faq_categories->fields['faq_categories_id'], $include_inactive); break; case 'faqs_active': if (zen_get_faqs_to_faq_categories($cat_child_faq_categories->fields['faq_categories_id'], true, 'faqs_active') == 'true') { return $faqs_linked = 'true'; } break; } $cat_child_faq_categories->MoveNext(); } } switch ($counts_what) { case 'faqs': return $cat_faqs_count; break; case 'faqs_active': return $faqs_linked; break; } }
<td class="dataTableContent" align="right"><?php echo $faqs->fields['faqs_nohelpful']; ?> </td> <td class="dataTableContent" align="right"><?php echo $faqs->fields['faqs_helpful']; ?> </td> <td class="dataTableContent" width="50" align="center"> <?php if ($faqs->fields['faqs_status'] == '1') { echo '<a href="' . zen_href_link(FILENAME_FAQ_CATEGORIES, 'action=setflag&flag=0&pID=' . $faqs->fields['faqs_id'] . '&fcPath=' . $fcPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '</a>'; } else { echo '<a href="' . zen_href_link(FILENAME_FAQ_CATEGORIES, 'action=setflag&flag=1&pID=' . $faqs->fields['faqs_id'] . '&fcPath=' . $fcPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>'; } if (zen_get_faq_is_linked($faqs->fields['faqs_id']) == 'true') { echo ' ' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '<br>'; } ?> </td> <?php if ($action == '') { ?> <td class="dataTableContent" align="center"><?php echo $faqs->fields['faqs_sort_order']; ?> </td> <td class="dataTableContent" align="right"> <?php echo '<a href="' . zen_href_link($type_handler, 'fcPath=' . $fcPath . '&faq_type=' . $faqs->fields['faqs_type'] . '&pID=' . $faqs->fields['faqs_id'] . '&action=new_faq' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?>