Exemple #1
0
function sb_search_page_func($atts)
{
    global $sb_config, $post, $size_low, $size_high, $price_low, $price_high;
    if (is_array($atts) and array_key_exists('server_override', $atts)) {
        $sb_config['server_address'] = $atts['server_override'];
        unset($atts['server_override']);
    }
    //add search box
    $a = "<div class='sb_wrapper'>\r\n\t\t\t<div class='smartbroker_section smartbroker_group'>\r\n\t\t\t<div class='smartbroker_col smartbroker_span_1_of_3'>";
    $a .= sb_search_box_func($atts, get_the_ID());
    $a .= '</div>';
    $a .= "<div class='smartbroker_col smartbroker_span_2_of_3'>";
    if (is_array($atts) and array_key_exists('parent_type', $atts)) {
        $sb_config['data']['pt'] = (int) $atts['parent_type'];
    }
    //print_r($sb_config['data']);
    $xml = load_results_xml($sb_config['data']);
    if ($xml !== FALSE) {
        $total_rows = $xml['count'];
        $returned_rows = count($xml);
        $requested_rows = $xml['requested_rows'];
        $start_row = $xml['start'];
        $end_row = $start_row + $returned_rows - 1;
        if ($total_rows > 0) {
            $results_string = sprintf(__('%s results found - showing&nbsp;results&nbsp;%s&nbsp;to&nbsp;%s.', 'smartbroker'), $total_rows, $start_row, $end_row);
            $a .= "&nbsp;{$results_string}<div id='results'>";
            foreach ($xml->boat as $boat) {
                $a .= search_result_item($boat);
            }
            $a .= pagination_links($total_rows, $start_row, $requested_rows);
        } else {
            $a .= "<div id='results'>";
            $a .= blank_slate_row();
        }
        //data required by javascript
        $a .= "<div style='display: none;' id='sb_server_address'>" . $sb_config['server_address'] . "</div>\r\n";
        $a .= "<div style='display: none;' id='sb_listing_page'>" . $sb_config['listing_page'] . "</div>\r\n";
        $a .= "<div style='display: none;' id='sb_currency_1'>" . $sb_config['currency_1'] . "</div>\r\n";
        $a .= "<div style='display: none;' id='sb_currency_1_symbol'>" . $sb_config['currencies'][$sb_config['currency_1']]['symbol'] . "</div>\r\n";
        $a .= "<div style='display: none;' id='sb_currency_2'>" . $sb_config['currency_2'] . "</div>\r\n";
        $a .= "<div style='display: none;' id='sb_currency_2_symbol'>" . $sb_config['currencies'][$sb_config['currency_2']]['symbol'] . "</div>\r\n";
        $a .= "<div style='display: none;' id='sb_curr_2_rate'>" . $sb_config['currencies'][$sb_config['currency_2']]['rate'] / $sb_config['currencies'][$sb_config['currency_1']]['rate'] . "</div>\r\n";
    }
    $a .= "</div>";
    //end span 2_of_3
    $a .= "</div>";
    //end row
    $a .= "<!-- end sb_wrapper -->";
    //end sb_wrapper
    return $a;
}
Exemple #2
0
function widget_smartbroker_search($args)
{
    echo $before_widget;
    echo $before_title;
    //load options
    $data['size_low'] = get_option('sb_widget_size_low');
    $data['size_high'] = get_option('sb_widget_size_high');
    $data['price_low'] = get_option('sb_widget_price_low');
    $data['price_high'] = get_option('sb_widget_price_high');
    echo "<style> .sb_widget p {margin: 1em 0;} </style>";
    echo "<div class='sb_widget'>" . sb_search_box_func($data) . '</div>';
    echo $after_title;
    echo $after_widget;
}