示例#1
0
 function widget($args, $instance)
 {
     $price_min = PropertiesManager::getPriceMin();
     $price_max = PropertiesManager::getPriceMax();
     $types = PropertiesManager::getAllTypes();
     $types_selected = array();
     $types_filtered = array();
     $features = PropertiesManager::getAllFeatures();
     $features_selected = array();
     $features_filtered = array();
     if (isset($_GET['feature'])) {
         $features_selected = explode(',', $_GET['feature']);
     }
     $features_filtered = PropertiesManager::getFeaturesFiltered($_GET);
     if (isset($_GET['type'])) {
         $types_selected = explode(',', $_GET['type']);
     }
     $types_filtered = PropertiesManager::getTypesFiltered($_GET);
     if (isset($_GET['price'])) {
         $price = explode(',', $_GET['price']);
         $price_min_value = $price[0];
         $price_max_value = $price[1];
     } else {
         if (isset($_GET['min_price'])) {
             $price_min_value = $_GET['min_price'];
         } else {
             $price_min_value = $price_min;
         }
         if (isset($_GET['max_price'])) {
             $price_max_value = $_GET['max_price'];
         } else {
             $price_max_value = $price_max;
         }
     }
     $bedrooms_min = $bedrooms_min_value = 0;
     $bedrooms_max = $bedrooms_max_value = 20;
     if (isset($_GET['bedrooms'])) {
         if (strpos($_GET['bedrooms'], ',') !== false) {
             $bedrooms = explode(',', $_GET['bedrooms']);
             $bedrooms_min_value = $bedrooms[0];
             $bedrooms_max_value = $bedrooms[1];
         } else {
             $bedrooms_min_value = $_GET['bedrooms'];
         }
     }
     $bathrooms_min = $bathrooms_min_value = 0;
     $bathrooms_max = $bathrooms_max_value = 20;
     if (isset($_GET['bathrooms'])) {
         if (strpos($_GET['bathrooms'], ',') !== false) {
             $bathrooms = explode(',', $_GET['bathrooms']);
             $bathrooms_min_value = $bathrooms[0];
             $bathrooms_max_value = $bathrooms[1];
         } else {
             $bathrooms_min_value = $_GET['bathrooms'];
         }
     }
     $sq_feet_min = $sq_feet_min_value = 0;
     $sq_feet_max = $sq_feet_max_value = PropertiesManager::getSqFeetMax();
     if (isset($_GET['sq_feet'])) {
         if (strpos($_GET['sq_feet'], ',') !== false) {
             $sq_feet = explode(',', $_GET['sq_feet']);
             $sq_feet_min_value = $sq_feet[0];
             $sq_feet_max_value = $sq_feet[1];
         } else {
             $sq_feet_min_value = $_GET['sq_feet'];
         }
     }
     $year_built_min = $year_built_min_value = PropertiesManager::getYearBuiltMin();
     $year_built_max = $year_built_max_value = date('Y');
     if (isset($_GET['year_built'])) {
         $years = explode(',', $_GET['year_built']);
         $year_built_min_value = $years[0];
         $year_built_max_value = $years[1];
     }
     $main_properties_page = estetico_get_properties_page_id();
     $reset_url = estetico_get_properties_page_url_wpml($main_properties_page);
     $args = array('price_min' => $price_min, 'price_max' => $price_max, 'price_min_value' => $price_min_value, 'price_max_value' => $price_max_value, 'bedrooms_min' => $bedrooms_min, 'bedrooms_max' => $bedrooms_max, 'bedrooms_min_value' => $bedrooms_min_value, 'bedrooms_max_value' => $bedrooms_max_value, 'bathrooms_min' => $bathrooms_min, 'bathrooms_max' => $bathrooms_max, 'bathrooms_min_value' => $bathrooms_min_value, 'bathrooms_max_value' => $bathrooms_max_value, 'year_built_min' => $year_built_min, 'year_built_max' => $year_built_max, 'year_built_min_value' => $year_built_min_value, 'year_built_max_value' => $year_built_max_value, 'sq_feet_min' => $sq_feet_min, 'sq_feet_max' => $sq_feet_max, 'sq_feet_min_value' => $sq_feet_min_value, 'sq_feet_max_value' => $sq_feet_max_value, 'types' => $types, 'types_filtered' => $types_filtered, 'types_selected' => $types_selected, 'features' => $features, 'features_selected' => $features_selected, 'features_filtered' => $features_filtered, 'distance' => isset($_GET['distance']) ? $_GET['distance'] : 0, 'city' => isset($_GET['city']) ? $_GET['city'] : '', 'beds' => isset($_GET['beds']) ? $_GET['beds'] : 0, 'location_latitude' => isset($_GET['lat']) ? $_GET['lat'] : '', 'location_longitude' => isset($_GET['lng']) ? $_GET['lng'] : '', 'location' => isset($_GET['location']) ? $_GET['location'] : '', 'distances_config' => explode(',', estetico_get_setting('distances')), 'keywords' => isset($_GET['keywords']) ? $_GET['keywords'] : '', 'for_sale_rent' => isset($_GET['for_sale_rent']) ? $_GET['for_sale_rent'] : 'both', 'property_status' => isset($_GET['property_status']) ? $_GET['property_status'] : '', 'pets_allowed' => isset($_GET['pets_allowed']) ? $_GET['pets_allowed'] : '', 'reset_url' => $reset_url);
     estetico_load_component('widgets/properties_filter', $args);
 }
示例#2
0
function add_shortcodes_post_init()
{
    $features = PropertiesManager::getAllFeatures();
    $features_array = array();
    foreach ($features as $feature) {
        $features_array[$feature->name] = $feature->slug;
    }
    $types = PropertiesManager::getAllTypes();
    $types_array = array();
    foreach ($types as $type) {
        $types_array[$type->name] = $type->slug;
    }
    $cities = array('-' => '');
    $_cities = estetico_get_all_cities();
    foreach ($_cities as $_city) {
        $cities[$_city] = $_city;
    }
    unset($_cities, $_city);
    if (function_exists('vc_map')) {
        vc_map(array("name" => __('Properties', THEME_NAME), "base" => 'properties', 'category' => __('Estetico'), 'params' => array(array("type" => 'dropdown', 'param_name' => 'list_style', 'heading' => __('Style', THEME_NAME), "value" => array(__('Grid', THEME_NAME) => 'grid', __('List', THEME_NAME) => 'list', __('Carousel', THEME_NAME) => 'carousel', __('Map', THEME_NAME) => 'map', __('List + Map', THEME_NAME) => 'list_map', __('Grid + Map', THEME_NAME) => 'grid_map'), "description" => __('Choose the style your properties will be visualized to the visitors', THEME_NAME)), array("type" => 'dropdown', 'param_name' => 'sort_by', 'heading' => __('Sort by', THEME_NAME), "value" => array(__('None', THEME_NAME) => 'none', __('Price (low to high)', THEME_NAME) => 'price_low_to_high', __('Price (high to low)', THEME_NAME) => 'price_high_to_low', __('View count (low to high)', THEME_NAME) => 'view_count_low_to_high', __('View count (high to low)', THEME_NAME) => 'view_count_high_to_low', __('Date (low to high)', THEME_NAME) => 'date_low_to_high', __('Date (high to low)', THEME_NAME) => 'date_low_to_high'), "description" => __('Choose how to sort properties', THEME_NAME)), array("type" => 'textfield', 'param_name' => 'min_price', 'heading' => __('Price minimum', THEME_NAME)), array("type" => 'textfield', 'param_name' => 'max_price', 'heading' => __('Price maximum', THEME_NAME)), array("type" => 'textfield', 'param_name' => 'bedrooms_min', 'heading' => __('Bedrooms minimum', THEME_NAME)), array("type" => 'textfield', 'param_name' => 'bedrooms_max', 'heading' => __('Bedrooms maximum', THEME_NAME)), array("type" => 'textfield', 'param_name' => 'bathrooms_min', 'heading' => __('Bathrooms minimum', THEME_NAME)), array("type" => 'textfield', 'param_name' => 'bathrooms_max', 'heading' => __('Bathrooms maximum', THEME_NAME)), array("type" => 'textfield', 'param_name' => 'sq_feet', 'heading' => __('Sq. feet', THEME_NAME), 'description' => __('Will display properties will area equal or larger than this value', THEME_NAME)), array("type" => 'checkbox', 'param_name' => 'pets_allowed', 'heading' => __('Pets allowed', THEME_NAME), 'value' => array(__('Yes') => 'yes'), 'description' => __('Will show properties that have either pets allowed or not.', THEME_NAME)), array("type" => 'checkbox', 'param_name' => 'type', 'heading' => __('Type', THEME_NAME), 'value' => $types_array), array("type" => 'checkbox', 'param_name' => 'feature', 'heading' => __('Feature', THEME_NAME), 'value' => $features_array), array("type" => 'dropdown', 'param_name' => 'city', 'heading' => __('City', THEME_NAME), 'value' => $cities), array("type" => 'dropdown', 'param_name' => 'for_sale_rent', 'heading' => __('For sale or rent', THEME_NAME), 'value' => array('-' => '', __('Sale', THEME_NAME) => 'sale', __('Rent', THEME_NAME) => 'rent'), 'description' => __('If you don\'t choose an option both will be shown', THEME_NAME)), array("type" => 'dropdown', 'param_name' => 'property_status', 'heading' => __('Property status', THEME_NAME), 'value' => array('' => '', __('Sold', THEME_NAME) => 'sold', __('Rented', THEME_NAME) => 'rented', __('Let agreed', THEME_NAME) => 'let_agreed', __('Sale agreed', THEME_NAME) => 'sale_agreed')), array("type" => 'textfield', 'param_name' => 'lat', 'heading' => __('Latitude', THEME_NAME)), array("type" => 'textfield', 'param_name' => 'lng', 'heading' => __('Longitude', THEME_NAME)), array("type" => 'textfield', 'param_name' => 'distance', 'heading' => __('Distance', THEME_NAME)), array("type" => 'checkbox', 'param_name' => 'auto_slide', 'heading' => __('Auto slide', THEME_NAME), 'value' => array(__('Yes') => 'yes'), 'description' => __('Automatically slide properties in the carousel. It applies only for carousel style.', THEME_NAME)), array("type" => 'checkbox', 'param_name' => 'infinite_loop', 'heading' => __('Infinite slide', THEME_NAME), 'value' => array(__('Yes') => 'yes'), 'description' => __('Infinitely slide properties in the carousel. It applies only for carousel style.', THEME_NAME)))));
    }
}