Ejemplo n.º 1
0
 public function widget($args, $instance)
 {
     extract($args);
     echo $before_widget;
     // do not show empty titles
     $title = apply_filters('widget_title', $instance['title']);
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     $params = array('show_empty_categories' => $instance['hide-empty'] ? false : true, 'show_children_categories' => $instance['show-parents-only'] ? false : true, 'show_listings_count' => $instance['show-ad-count']);
     echo awpcp_categories_list_renderer()->render($params);
     echo $after_widget;
 }
Ejemplo n.º 2
0
 private function render_shortcode_content($attrs)
 {
     extract($attrs);
     $category = $id > 0 ? AWPCP_Category::find_by_id($id) : null;
     $children = awpcp_parse_bool($children);
     if (is_null($category)) {
         return __('Category ID must be valid for Ads to display.', 'category shortcode', 'AWPCP');
     }
     if ($children) {
         $categories_list = awpcp_categories_list_renderer()->render(array('parent_category_id' => $category->id, 'show_listings_count' => true));
         $options = array('before_pagination' => array(10 => array('categories-list' => $categories_list)));
     } else {
         $options = array();
     }
     $query = array('context' => 'public-listings', 'category_id' => $category->id, 'include_listings_in_children_categories' => $children, 'limit' => absint($this->request->param('results', $items_per_page)), 'offset' => absint($this->request->param('offset', 0)), 'orderby' => get_awpcp_option('groupbrowseadsby'));
     // required so awpcp_display_ads shows the name of the current category
     $_REQUEST['category_id'] = $category->id;
     return awpcp_display_listings_in_page($query, 'category-shortcode', $options);
 }
Ejemplo n.º 3
0
function awpcp_display_the_classifieds_page_body($awpcppagename)
{
    global $hasregionsmodule;
    $output = '';
    if (!isset($awpcppagename) || empty($awpcppagename)) {
        $awpcppage = get_currentpagename();
        $awpcppagename = sanitize_title($awpcppage, $post_ID = '');
    }
    $output .= "<div id=\"classiwrapper\">";
    $uiwelcome = strip_slashes_recursive(get_awpcp_option('uiwelcome'));
    $output .= "<div class=\"uiwelcome\">{$uiwelcome}</div>";
    // Place the menu items
    $output .= awpcp_menu_items();
    if ($hasregionsmodule == 1) {
        $output .= awpcp_region_control_selector();
    }
    $output .= "<div class=\"classifiedcats\">";
    //Display the categories
    $params = array('show_in_columns' => get_awpcp_option('view-categories-columns'), 'show_empty_categories' => !get_awpcp_option('hide-empty-categories'), 'show_children_categories' => true, 'show_listings_count' => get_awpcp_option('showadcount'), 'show_sidebar' => true);
    $output .= awpcp_categories_list_renderer()->render($params);
    $output .= "</div>";
    $output .= "</div>";
    return $output;
}