示例#1
0
    $count = intval($count);
    if (!in_array($count, $count_expected)) {
        $count = 10;
    }
    $keyword = $db->escape(htmlspecialchars(trim($keyword)));
    if (!empty($keyword)) {
        $orWhere = ' and (a.`title` like \'%' . $keyword . '%\' or a.author like \'%' . $keyword . '%\' or s.section_name like \'%' . $keyword . '%\')';
    } else {
        $orWhere = '';
    }
    $total = $db->fetchOne($get_total . $orWhere);
    $total_page = ceil($total / $count);
    $page = $page > $total_page ? $total_page : $page;
    $page = $page <= 0 ? 1 : $page;
    $offset = ($page - 1) * $count;
    create_pager($page, $total_page, $total);
    assign('count', $count);
    assign('keyword', $keyword);
    $get_content_list = 'select a.*, s.section_name from ' . $db->table('content') . ' as a';
    $get_content_list .= ' left join ' . $db->table('section') . ' as s on s.id = a.section_id';
    $get_content_list .= ' where a.status = 0' . $orWhere;
    $get_content_list .= ' order by a.order_view asc, a.add_time desc';
    $get_content_list .= ' limit ' . $offset . ',' . $count;
    $content_list = $db->fetchAll($get_content_list);
    if ($content_list) {
        foreach ($content_list as $key => $content) {
            $content_list[$key]['add_time'] = date('Y-m-d H:i:s', $content['add_time']);
        }
    }
    assign('contentList', $content_list);
}
$veryLastPage += $count % $pageSize == 0 ? 0 : 1;
$veryLastPage = min((int) ($hardLimit / $pageSize), $veryLastPage);
$endPage = min($veryLastPage, $startPage + 10);
//Iterates to create several page links
for ($pageNumber = $startPage; $pageNumber < $endPage; ++$pageNumber) {
    $pagerString .= create_pager($pageNumber, $page, $pageSize, $count, "pagerCatClicked");
}
$beforePageString = "";
$afterPageString = "";
$prevPage = $page - 1;
if ($page > 1) {
    $beforePageString .= "<a title='{$prevPage}' href='javascript:pagerCatClicked ({$prevPage}, \"{$search}\")'>Previous</a> ";
}
// add page 0 if not in list
if ($startPage == 1 && $count > 0) {
    $beforePageString .= create_pager(0, $page, $pageSize, $count, "pagerCatClicked");
}
$nextPage = $page + 1;
if ($page < $veryLastPage) {
    $afterPageString .= "<a title='{$nextPage}' href='javascript:pagerCatClicked ({$nextPage}, \"{$search}\")'>Next</a> ";
}
$pagerString = "<span style=\"color:#ccc;\">Total (" . $count . ") </span>" . $beforePageString . $pagerString . $afterPageString;
echo '<div class="pagerDiv">' . $pagerString . '</div>';
//Uses a counter to keep track of each entry on the page
//Many elements such as id's and name's rely on this counter
$count = 0;
//Loops through every entry on your current page
foreach ($results->objects as $result) {
    $fullName = $result->fullName;
    $entriesCount = $result->entriesCount;
    $description = str_replace("'", '', $result->description);
示例#3
0
/**
 * @deprecated 3.4
 */
function awpcp_display_ads($where, $byl, $hidepager, $grouporderby, $adorcat, $before_content = '')
{
    _deprecated_function(__FUNCTION__, '3.4', 'awpcp_display_listings');
    global $wpdb;
    global $awpcp_plugin_path;
    global $hasregionsmodule;
    $output = '';
    $awpcp_browsecats_pageid = awpcp_get_page_id_by_ref('browse-categories-page-name');
    $browseadspageid = awpcp_get_page_id_by_ref('browse-ads-page-name');
    $searchadspageid = awpcp_get_page_id_by_ref('search-ads-page-name');
    // filters to provide alternative method of storing custom layouts (e.g. can be outside of this plugin's directory)
    if (has_action('awpcp_browse_ads_template_action') || has_filter('awpcp_browse_ads_template_filter')) {
        do_action('awpcp_browse_ads_template_action');
        $output = apply_filters('awpcp_browse_ads_template_filter');
        return;
    } else {
        if (file_exists("{$awpcp_plugin_path}/awpcp_display_ads_my_layout.php") && get_awpcp_option('activatemylayoutdisplayads')) {
            include "{$awpcp_plugin_path}/awpcp_display_ads_my_layout.php";
        } else {
            $output .= "<div id=\"classiwrapper\">";
            $uiwelcome = stripslashes_deep(get_awpcp_option('uiwelcome'));
            $output .= apply_filters('awpcp-content-before-listings-page', '');
            $output .= "<div class=\"uiwelcome\">{$uiwelcome}</div>";
            $output .= awpcp_menu_items();
            if ($hasregionsmodule == 1) {
                // Do not show Region Control form when showing Search Ads page
                // search result. Changing the current location will redirect the user
                // to the form instead of a filterd version of the form and that's confusing
                if (is_page(awpcp_get_page_id_by_ref('search-ads-page-name')) && isset($_POST['a']) && $_POST['a'] == 'dosearch') {
                    // do nothing
                } else {
                    $output .= awpcp_region_control_selector();
                }
            }
            $output .= $before_content;
            $tbl_ads = $wpdb->prefix . "awpcp_ads";
            $from = "{$tbl_ads}";
            $ads_exist = ads_exist();
            if (!$ads_exist) {
                $showcategories = "<p style=\"padding:10px\">";
                $showcategories .= __("There are currently no ads in the system", "AWPCP");
                $showcategories .= "</p>";
                $pager1 = '';
                $pager2 = '';
            } else {
                $awpcp_image_display_list = array();
                if ($adorcat == 'cat') {
                    $tpname = get_permalink($awpcp_browsecats_pageid);
                } elseif ($adorcat == 'search') {
                    $tpname = get_permalink($searchadspageid);
                } elseif (preg_match('/^custom:/', $adorcat)) {
                    $tpname = str_replace('custom:', '', $adorcat);
                } else {
                    $tpname = get_permalink($browseadspageid);
                }
                $results = get_awpcp_option('adresultsperpage', 10);
                $results = absint(awpcp_request_param('results', $results));
                $offset = absint(awpcp_request_param('offset', 0));
                if ($results === 0) {
                    $results = 10;
                }
                $args = array('order' => AWPCP_Ad::get_order_conditions($grouporderby), 'offset' => $offset, 'limit' => $results);
                $ads = AWPCP_Ad::get_enabled_ads($args, array($where));
                // get_where_conditions() is called from get_enabled_ads(), we need the
                // WHERE conditions here to pass them to create_pager()
                $where = AWPCP_Ad::get_where_conditions(array($where));
                if (!isset($hidepager) || empty($hidepager)) {
                    //Unset the page and action here...these do the wrong thing on display ad
                    unset($_GET['page_id']);
                    unset($_POST['page_id']);
                    //unset($params['page_id']);
                    $pager1 = create_pager($from, join(' AND ', $where), $offset, $results, $tpname);
                    $pager2 = create_pager($from, join(' AND ', $where), $offset, $results, $tpname);
                } else {
                    $pager1 = '';
                    $pager2 = '';
                }
                $items = awpcp_render_listings_items($ads, 'listings');
                $opentable = "";
                $closetable = "";
                if (empty($ads)) {
                    $showcategories = "<p style=\"padding:20px;\">";
                    $showcategories .= __("There were no ads found", "AWPCP");
                    $showcategories .= "</p>";
                    $pager1 = '';
                    $pager2 = '';
                } else {
                    $showcategories = smart_table($items, intval($results / $results), $opentable, $closetable);
                }
            }
            $show_category_id = absint(awpcp_request_param('category_id'));
            if (!isset($url_browsecatselect) || empty($url_browsecatselect)) {
                $url_browsecatselect = get_permalink($awpcp_browsecats_pageid);
            }
            if ($ads_exist) {
                $category_id = (int) awpcp_request_param('category_id', -1);
                $category_id = $category_id === -1 ? (int) get_query_var('cid') : $category_id;
                $output .= "<div class=\"changecategoryselect\"><form method=\"post\" action=\"{$url_browsecatselect}\">";
                $output .= '<div class="awpcp-category-dropdown-container">';
                $dropdown = new AWPCP_CategoriesDropdown();
                $output .= $dropdown->render(array('context' => 'search', 'name' => 'category_id', 'selected' => $category_id));
                $output .= '</div>';
                $output .= "<input type=\"hidden\" name=\"a\" value=\"browsecat\" />&nbsp;<input class=\"button\" type=\"submit\" value=\"";
                $output .= __("Change Category", "AWPCP");
                $output .= "\" /></form></div>";
                $output .= "<div class=\"pager\">{$pager1}</div><div class=\"fixfloat\"></div>";
                $output .= "<div id='awpcpcatname' class=\"fixfloat\">";
                if ($category_id > 0) {
                    $output .= "<h3>" . __("Category: ", "AWPCP") . get_adcatname($category_id) . "</h3>";
                }
                $output .= "</div>";
            }
            $output .= apply_filters('awpcp-display-ads-before-list', '');
            $output .= "{$showcategories}";
            if ($ads_exist) {
                $output .= "&nbsp;<div class=\"pager\">{$pager2}</div>";
            }
            $output .= apply_filters('awpcp-content-after-listings-page', '');
            $output .= "</div>";
        }
    }
    return $output;
}
示例#4
0
function awpcp_opsconfig_categories()
{
    global $wpdb, $message, $awpcp_imagesurl, $clearform, $hascaticonsmodule;
    $cpagename_awpcp = get_awpcp_option('main-page-name');
    $awpcppagename = sanitize_title($cpagename_awpcp);
    $action = '';
    $output = '';
    $tbl_ad_categories = $wpdb->prefix . "awpcp_categories";
    $offset = isset($_REQUEST['offset']) ? clean_field($_REQUEST['offset']) : ($offset = 0);
    $results = isset($_REQUEST['results']) && !empty($_REQUEST['results']) ? clean_field($_REQUEST['results']) : ($results = 10);
    if (isset($_REQUEST['results']) && !empty($_REQUEST['results'])) {
        $results = max(intval($_REQUEST['results']), 5);
        update_user_option(get_current_user_id(), 'awpcp-admin-categories-results', $results);
    } else {
        $results = intval(get_user_option('awpcp-admin-categories-results', get_current_user_id()));
    }
    if (empty($results)) {
        $results = 10;
    }
    $cat_ID = '';
    $category_name = '';
    $aeaction = '';
    $category_parent_id = '';
    $promptmovetocat = '';
    $aeaction = '';
    ///////////////////
    // Check for existence of a category ID and action
    if (isset($_REQUEST['editcat']) && !empty($_REQUEST['editcat'])) {
        $cat_ID = $_REQUEST['editcat'];
        $action = "edit";
    } elseif (isset($_REQUEST['delcat']) && !empty($_REQUEST['delcat'])) {
        $cat_ID = $_REQUEST['delcat'];
        $action = "delcat";
    } elseif (isset($_REQUEST['managecaticon']) && !empty($_REQUEST['managecaticon'])) {
        $cat_ID = $_REQUEST['managecaticon'];
        $action = "managecaticon";
    } elseif (isset($_REQUEST['cat_ID']) && !empty($_REQUEST['cat_ID'])) {
        $cat_ID = $_REQUEST['cat_ID'];
    }
    if (!isset($action) || empty($action)) {
        if (isset($_REQUEST['action']) && !empty($_REQUEST['action'])) {
            $action = $_REQUEST['action'];
        }
    }
    if ($action == 'edit') {
        $aeaction = 'edit';
    }
    if ($action == 'editcat') {
        $aeaction = 'edit';
    }
    if ($action == 'delcat') {
        $aeaction = 'delete';
    }
    if ($action == 'managecaticon') {
        $return = apply_filters('awpcp-custom-manage-categories-action', '', $cat_ID);
        if ($return) {
            return;
        }
    }
    if ($action == 'setcategoryicon') {
        global $awpcp_plugin_path;
        if ($hascaticonsmodule == 1) {
            if (is_installed_category_icon_module()) {
                if (isset($_REQUEST['cat_ID']) && !empty($_REQUEST['cat_ID'])) {
                    $thecategory_id = $_REQUEST['cat_ID'];
                }
                if (isset($_REQUEST['category_icon']) && !empty($_REQUEST['category_icon'])) {
                    $theiconfile = $_REQUEST['category_icon'];
                } elseif (isset($_REQUEST['clear_icon'])) {
                    $theiconfile = null;
                } else {
                    $theiconfile = '';
                }
                if (isset($_REQUEST['offset']) && !empty($_REQUEST['offset'])) {
                    $offset = $_REQUEST['offset'];
                }
                $message = set_category_icon($thecategory_id, $theiconfile, $offset, $results);
                if (isset($message) && !empty($message)) {
                    $clearform = 1;
                }
            }
        }
    }
    if (isset($clearform) && $clearform == 1) {
        $action = $aeaction = null;
    }
    try {
        $category = awpcp_categories_collection()->get($cat_ID);
        $category_name = $category->name;
        $category_order = $category->order;
        $cat_parent_ID = $category->parent;
    } catch (AWPCP_Exception $e) {
        $category_name = null;
        $category_order = null;
        $cat_parent_ID = null;
    }
    $add_label = __('Add A New Category', 'AWPCP');
    $add_url = awpcp_get_admin_categories_url();
    $addnewlink = '<a class="" title="%1$s" href="%2$s"" accesskey="s">%1$s</a>';
    $addnewlink = sprintf($addnewlink, $add_label, $add_url);
    if ($aeaction == 'edit') {
        $aeword1 = __("You are currently editing the category shown below", "AWPCP");
        $aeword2 = __("Save Category Changes", "AWPCP");
        $aeword3 = __("Parent Category", "AWPCP");
        $aeword4 = __("Category List Order", "AWPCP");
    } elseif ($aeaction == 'delete') {
        if ($cat_ID != 1) {
            $aeword1 = __("If you're sure that you want to delete this category please press the delete button", "AWPCP");
            $aeword2 = __("Delete Category", "AWPCP");
            $aeword3 = __("Parent Category", "AWPCP");
            $aeword4 = '';
            if (ads_exist_cat($cat_ID)) {
                if (category_is_child($cat_ID)) {
                    $movetocat = get_cat_parent_ID($cat_ID);
                } else {
                    $movetocat = 1;
                }
                try {
                    $move_to_category = awpcp_categories_collection()->get($movetocat);
                    $movetoname = $move_to_category->name;
                } catch (AWPCP_Exception $e) {
                    $movetoname = __('Untitled', 'AWPCP');
                }
                $promptmovetocat = "<p>";
                $promptmovetocat .= __("The category contains ads. If you do not select a category to move them to the ads will be moved to:", "AWPCP");
                $promptmovetocat .= "<b>{$movetoname}</b></p>";
                try {
                    $move_to_category = awpcp_categories_collection()->get(1);
                    $defaultcatname = $move_to_category->name;
                } catch (AWPCP_Exception $e) {
                    $defaultcatname = __('Untitled', 'AWPCP');
                }
                if (category_has_children($cat_ID)) {
                    $promptmovetocat .= "<p>";
                    $promptmovetocat .= __("The category also has children. If you do not specify a move-to category the children will be adopted by", "AWPCP");
                    $promptmovetocat .= "<b>{$defaultcatname}</b><p><b>";
                    $promptmovetocat .= __("Note", "AWPCP");
                    $promptmovetocat .= ":</b>";
                    $promptmovetocat .= __("The move-to category specified applies to both ads and categories", "AWPCP");
                    $promptmovetocat .= "</p>";
                }
                $promptmovetocat .= "<p align=\"center\"><select name=\"movetocat\"><option value=\"0\">";
                $promptmovetocat .= __("Please select a Move-To category", "AWPCP");
                $promptmovetocat .= "</option>";
                $categories = get_categorynameid($cat_ID, $cat_parent_ID, $exclude = $cat_ID);
                $promptmovetocat .= "{$categories}</select>";
            }
            $thecategoryparentname = get_adparentcatname($cat_parent_ID);
        } else {
            $aeword1 = __('Sorry but you cannot delete %s. It is the default category and the default category cannot be deleted.', 'AWPCP');
            $aeword1 = sprintf($aeword1, '<strong>' . $category_name . '</strong>');
            $aeword2 = '';
            $aeword3 = '';
            $aeword4 = '';
        }
    } else {
        if (empty($aeaction)) {
            $aeaction = "newcategory";
        }
        $aeword1 = __('Add a New Category', 'AWPCP');
        $aeword2 = __("Add New Category", "AWPCP");
        $aeword3 = __("List Category Under", "AWPCP");
        $aeword4 = __("Category List Order", "AWPCP");
        $addnewlink = '';
    }
    if ($aeaction == 'delete') {
        $orderinput = '';
        if ($cat_ID == 1) {
            $categorynameinput = '';
            $selectinput = '';
        } else {
            $categorynameinput = "<span style=\"background:transparent url({$awpcp_imagesurl}/delete_ico.png) left center no-repeat;padding-left:20px;\">";
            $categorynameinput .= __("Category to Delete", "AWPCP");
            $categorynameinput .= ": {$category_name}</span>";
            $selectinput = "<p style=\"background:#D54E21;padding:3px;color:#ffffff;\">{$thecategoryparentname}</p>";
            $submitbuttoncode = "<input type=\"submit\" class=\"button-primary button\" name=\"createeditadcategory\" value=\"{$aeword2}\" />";
        }
    } elseif ($aeaction == 'edit') {
        $section_icon_style = "background:transparent url({$awpcp_imagesurl}/edit_ico.png) left center no-repeat;padding-left:20px;";
        $categorynameinput = __("Category to Edit", "AWPCP");
        $categorynameinput .= ": {$category_name} ";
        $categorynamefield = "<input name=\"category_name\" id=\"cat_name\" type=\"text\" class=\"inputbox\" value=\"{$category_name}\" size=\"40\" style=\"width: 90%\"/>";
        $selectinput = "<select name=\"category_parent_id\"><option value=\"0\">";
        $selectinput .= __("Make This a Top Level Category", "AWPCP");
        $selectinput .= "</option>";
        $orderinput = "<input name=\"category_order\" id=\"category_order\" type=\"text\" class=\"inputbox\" value=\"{$category_order}\" size=\"3\"/>";
        $categories = get_categorynameid($cat_ID, $cat_parent_ID, $exclude = '');
        $selectinput .= "{$categories}\n\t\t\t\t\t\t</select>";
        $submitbuttoncode = "<input type=\"submit\" class=\"button-primary button\" name=\"createeditadcategory\" value=\"{$aeword2}\" />";
    } else {
        $section_icon_style = "background:transparent url({$awpcp_imagesurl}/post_ico.png) left center no-repeat;padding-left:20px;";
        $categorynameinput = __('Enter the category name', 'AWPCP');
        $categorynamefield = "<input name=\"category_name\" id=\"cat_name\" type=\"text\" class=\"inputbox\" value=\"{$category_name}\" size=\"40\" style=\"width: 90%\"/>";
        $selectinput = "<select name=\"category_parent_id\"><option value=\"0\">";
        $selectinput .= __("Make This a Top Level Category", "AWPCP");
        $selectinput .= "</option>";
        $orderinput = "<input name=\"category_order\" id=\"category_order\" type=\"text\" class=\"inputbox\" value=\"{$category_order}\" size=\"3\"/>";
        $categories = get_categorynameid($cat_ID, $cat_parent_ID, $exclude = '');
        $selectinput .= "{$categories}\n\t\t\t\t\t</select>";
        $submitbuttoncode = "<input type=\"submit\" class=\"button-primary button\" name=\"createeditadcategory\" value=\"{$aeword2}\" />";
    }
    // Start the page display
    $output .= "<div class=\"wrap\"><h2>";
    $output .= awpcp_admin_page_title(__('Manage Categories', 'AWPCP'));
    $output .= "</h2>";
    if (isset($message) && !empty($message)) {
        $output .= $message;
    }
    $sidebar = awpcp_admin_sidebar();
    $output .= $sidebar;
    if (empty($sidebar)) {
        $output .= "<div style=\"padding:10px;\">";
    } else {
        $output .= "<div style=\"padding:10px; width: 75%\">";
    }
    $output .= "<b>";
    $output .= __("Icon Meanings", "AWPCP");
    $output .= ":</b> &nbsp;&nbsp;&nbsp;<img src=\"{$awpcp_imagesurl}/edit_ico.png\" alt=\"";
    $output .= __("Edit Category", "AWPCP");
    $output .= "\" border=\"0\"/>";
    $output .= __("Edit Category", "AWPCP");
    $output .= " &nbsp;&nbsp;&nbsp;<img src=\"{$awpcp_imagesurl}/delete_ico.png\" alt=\"";
    $output .= __("Delete Category", "AWPCP");
    $output .= "\" border=\"0\"/>";
    $output .= __("Delete Category", "AWPCP");
    if ($hascaticonsmodule == 1 && is_installed_category_icon_module()) {
        $label = __("Manage Category Icon", "AWPCP");
        $output .= " &nbsp;&nbsp;&nbsp;<img src=\"{$awpcp_imagesurl}/icon_manage_ico.png\" alt=\"";
        $output .= $label;
        $output .= "\" border=\"0\"/>";
        $output .= $label;
    }
    $output .= "\n\t\t\t </div>";
    if (empty($sidebar)) {
        $output .= "<div class=\"postbox\" style=\"padding:10px;\"><p>";
    } else {
        $output .= "<div class=\"postbox\" style=\"width:75%;float:left;padding:10px;\">";
    }
    $output .= "<form method=\"post\" id=\"awpcp_launch\">\n\t\t\t <input type=\"hidden\" name=\"category_id\" value=\"{$cat_ID}\" />\n\t\t\t  <input type=\"hidden\" name=\"aeaction\" value=\"{$aeaction}\" />\n\t\t\t  <input type=\"hidden\" name=\"offset\" value=\"{$offset}\" />\n\t\t\t  <input type=\"hidden\" name=\"results\" value=\"{$results}\" />\n\n\t\t\t<span style=\"line-height: 1.3em; {$section_icon_style}\"> {$aeword1}</span>\n\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"margin: 15px 0 12px\">\n\t\t\t\t<tr>\n\t\t\t\t\t<th style=\"text-align: left; padding-bottom: 4px; width: 40%\">{$categorynameinput}</th>\n\t\t\t\t\t<th style=\"text-align: left; padding-bottom: 4px; width: 25%\">{$aeword3}</th>\n\t\t\t\t\t<th style=\"text-align: left; padding-bottom: 4px; width: 20%\">{$aeword4}</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$categorynamefield}</td>\n\t\t\t\t\t<td>{$selectinput}</td>\n\t\t\t\t\t<td>{$orderinput}</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\n\t\t\t{$promptmovetocat}\n\n\t\t\t<div style=\"margin-top:5px;\">{$submitbuttoncode} {$addnewlink}</div>\n\t\t\t </form>\n\t\t\t </div>";
    if (empty($sidebar)) {
        $output .= "<div style=\"margin:0;padding:0px 0px 10px 0;\"><p>";
    } else {
        $output .= "<div style=\"margin:0;padding:0px 0px 10px 0;float:left;width:75%\">";
    }
    ///////////////////////////
    // Show the paginated categories list for management
    //////////////////////////
    $where = "category_name <> ''";
    $pager1 = create_pager(AWPCP_TABLE_CATEGORIES, $where, $offset, $results, $tpname = '');
    $pager2 = create_pager(AWPCP_TABLE_CATEGORIES, $where, $offset, $results, $tpname = '');
    $output .= "{$pager1} <form name=\"mycats\" id=\"mycats\" method=\"post\">\n\t\t <p><input type=\"submit\" name=\"deletemultiplecategories\" class=\"button\" value=\"";
    $output .= __("Delete Selected Categories", "AWPCP");
    $output .= "\" />\n\t\t <input type=\"submit\" name=\"movemultiplecategories\" class=\"button\" value=\"";
    $output .= __("Move Selected Categories", "AWPCP");
    $output .= "\" />\n\t\t <select name=\"moveadstocategory\"><option value=\"0\">";
    $output .= __("Select Move-To category", "AWPCP");
    $output .= "</option>";
    $movetocategories = get_categorynameid($cat_id = 0, $cat_parent_id = 0, $exclude);
    $output .= "{$movetocategories}</select></p>\n\t\t<p>";
    $output .= __('Delete categories should do this with existing Ads', 'AWPCP');
    $output .= ": <label><input type=\"radio\" name=\"movedeleteads\" value=\"1\" checked='checked' > " . __('Move Ads to new category', 'AWPCP') . "</label>";
    $output .= " <label><input type=\"radio\" name=\"movedeleteads\" value=\"2\" > " . __('Delete Ads too', 'AWPCP') . "</label></p>";
    $children = awpcp_get_categories_hierarchy();
    $categories = AWPCP_Category::query(array('orderby' => 'category_order, category_name', 'order' => 'ASC'));
    $count = 0;
    $items = awpcp_admin_categories_render_category_items($categories, $children, $offset, $results, $count);
    $opentable = '<table class="listcatsh"><tr>';
    $opentable .= '<td style="width:10%; text-align: center;">' . __('Category ID', 'AWPCP') . '</td>';
    $opentable .= "<td style=\"width:30%;padding:5px;\"><label><input type=\"checkbox\" onclick=\"CheckAll()\" />&nbsp;";
    $opentable .= __("Category Name (Total Ads)", "AWPCP");
    $opentable .= "</label></td><td style=\"width:35%;padding:5px;\">";
    $opentable .= __("Parent", "AWPCP");
    $opentable .= "</td><td style=\"width:5%;padding:5px;\">";
    $opentable .= __("Order", "AWPCP");
    $opentable .= "</td><td style=\"width:20%;padding:5px;;\">";
    $opentable .= __("Action", "AWPCP");
    $opentable .= "</td></tr>";
    $closetable = '<tr>';
    $closetable .= '<td>' . __('Category ID', 'AWPCP') . '</td>';
    $closetable .= '<td style="padding:5px;">';
    $closetable .= __("Category Name (Total Ads)", "AWPCP");
    $closetable .= "</td><td style=\"padding:5px;\">";
    $closetable .= __("Parent", "AWPCP");
    $closetable .= "</td><td style=\"padding:5px;\">";
    $closetable .= __("Order", "AWPCP");
    $closetable .= "</td><td style=\"padding:5px;\">";
    $closetable .= __("Action", "AWPCP");
    $closetable .= "</td></tr></table>";
    $theitems = smart_table2($items, intval($results / $results), $opentable, $closetable, false);
    $showcategories = "{$theitems}";
    $output .= "\n\t\t<style>\n\t\ttable.listcatsh { width: 100%; padding: 0px; border: none; border: 1px solid #dddddd;}\n\t\ttable.listcatsh td { font-size: 12px; border: none; background-color: #F4F4F4;\n\t\tvertical-align: middle; font-weight: bold; }\n\t\ttable.listcatsh tr.special td { border-bottom: 1px solid #ff0000;  }\n\t\ttable.listcatsc { width: 100%; padding: 0px; border: none; border: 1px solid #dddddd;}\n\t\ttable.listcatsc td { width:33%;border: none;\n\t\tvertical-align: middle; padding: 5px; font-weight: normal; }\n\t\ttable.listcatsc tr.special td { border-bottom: 1px solid #ff0000;  }\n\t\t</style>\n\t\t{$showcategories}\n\t\t</form>{$pager2}</div>";
    echo $output;
}