Plugin Directory

Changeset 2747456


Ignore:
Timestamp:
06/24/2022 08:54:51 AM (4 years ago)
Author:
zebrasoft
Message:

Update for 1.2.24

Location:
immotoolbox-connect/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • immotoolbox-connect/trunk/admin/js/block.js

    r2746279 r2747456  
    725725            type: 'boolean'
    726726        },
     727        hide_district: {
     728            type: 'boolean'
     729        },
    727730
    728731        type: {
     
    794797                                        label: i18n.__("City", "immotoolbox-connect"),
    795798                                        onChange: function (newValue) { props.setAttributes( { hide_city: newValue } ) },
     799                                    }
     800                                ),
     801                                el(
     802                                    ToggleControl,
     803                                    {
     804                                        checked: props.attributes.hide_district,
     805                                        label: i18n.__("District", "immotoolbox-connect"),
     806                                        onChange: function (newValue) { props.setAttributes( { hide_district: newValue } ) },
    796807                                    }
    797808                                ),
     
    975986                                        props.attributes.hide_country?el("span", {className: "itbconnect_label"}, i18n.__("Country", "immotoolbox-connect")):null,
    976987                                        props.attributes.hide_city?el("span", {className: "itbconnect_label"}, i18n.__("City", "immotoolbox-connect")):null,
     988                                        props.attributes.hide_district?el("span", {className: "itbconnect_label"}, i18n.__("District", "immotoolbox-connect")):null,
    977989                                        props.attributes.search_price_max?el("span", {className: "itbconnect_label"}, i18n.__("Max. price", "immotoolbox-connect")):null,
    978990                                        props.attributes.hide_rooms?el("span", {className: "itbconnect_label"}, i18n.__("Nb. rooms", "immotoolbox-connect")):null,
     
    10421054        code+=' hide_city="1"';
    10431055    }
     1056    if (props.attributes.hide_district) {
     1057        code+=' hide_district="1"';
     1058    }
    10441059    if (props.attributes.hide_type) code+=' hide_type="1"';
    10451060    if (props.attributes.hide_price_max) code+=' hide_price_max="1"';
  • immotoolbox-connect/trunk/immotoolbox-connect.php

    r2746279 r2747456  
    44Plugin URI: https://www.immotoolbox.com/
    55Description: Displays ImmoToolBox real estate listings in your website
    6 Version: 1.2.23
     6Version: 1.2.24
    77Author: ZebraSoft Monaco
    88Author URI: https://www.zebrasoft.mc
     
    2424along with ImmoToolBox Connect. If not, see https://www.gnu.org/licenses/gpl.html.
    2525*/
    26 define('ITBCONNECT_VERSION', '1.2.23');
     26define('ITBCONNECT_VERSION', '1.2.24');
    2727
    2828/**
  • immotoolbox-connect/trunk/public/ITBConnectPublic.php

    r2746279 r2747456  
    577577        $data_view['countries'] = $this->getCountries();
    578578        $data_view['cities'] = $this->getCities();
     579        $data_view['districts'] = $this->getDistricts();
    579580
    580581        $twig = self::getTwig();
     
    752753        return null;
    753754    }
     755    static $districts = [];
     756    public function getDistricts ()
     757    {
     758        if (!empty(self::$districts)) return self::$districts;
     759        $option = get_option(ITBCONNECT_OPTION_NAME, array());
     760
     761        $url = ITBCONNECT_API_BASEURL.'/districts';
     762        $headers = [
     763            'X-AUTH-TOKEN: '.$option['private_key']
     764            , 'accept: application/ld+json'
     765        ];
     766        $get['locale'] = current(explode('_', get_locale()));
     767        $get['country'] = 'MC';
     768        $get['all'] = 1;
     769        $get['nbpp'] = 1000;
     770        $response = ITBConnect::getRemoteUrl($url, $get, [], $headers, 60*60, isset($option['nocheck_ssl'])&&$option['nocheck_ssl']);
     771
     772        if ($response) {
     773            $data = json_decode( $response, true );
     774            if (isset($data['hydra:member'])) return self::$districts = $data['hydra:member'];
     775        }
     776        return null;
     777    }
    754778
    755779    public function format_property($property, $locale)
  • immotoolbox-connect/trunk/public/partials/base/search.html.twig

    r2453844 r2747456  
    4848                </div>
    4949            {% endblock %}
    50 
     50            {% block search_district %}
     51                <div class="form-group {{ col_class }}">
     52                    {% if not atts.hide_district|default(true) %}
     53                        {% block search_district_label %}
     54                            <label for="district">{{ __("district", "immotoolbox-connect") }} {{ locale }}</label>
     55                        {% endblock %}
     56                        {% block search_district_select %}
     57                            <select name="nsearch[district][]" multiple id="district" class="form-control selectpicker"
     58                                    title="{{ __("district", "immotoolbox-connect") }}..." data-live-search="true">
     59                                {% block search_district_options %}
     60                                    {% for district in districts %}
     61                                        <option value="{{ district.id }}" {{ district.id in search.district?"selected" }}>{{ district.name }}</option>
     62                                    {% endfor %}
     63                                {% endblock %}
     64                            </select>
     65                        {% endblock %}
     66                    {% endif %}
     67                </div>
     68            {% endblock %}
    5169            {% block search_type %}
    5270                {% if not hide_type|default %}
  • immotoolbox-connect/trunk/readme.md

    r2746279 r2747456  
    66Tested up to: 5.9
    77Requires PHP: 5.9
    8 Stable tag: 1.2.23
     8Stable tag: 1.2.24
    99License: GPL3
    1010License URI: https://www.gnu.org/licenses/gpl.html
     
    4747* Option to disable SSL verification
    4848* Add function `do_shortcode($content, $ignore_html = false)` in Twig to render shortcode from template
     49* Add search by district
    4950
    5051
  • immotoolbox-connect/trunk/readme.txt

    r2746279 r2747456  
    66Tested up to: 5.9
    77Requires PHP: 5.9
    8 Stable tag: 1.2.23
     8Stable tag: 1.2.24
    99License: GPL3
    1010License URI: https://www.gnu.org/licenses/gpl.html
     
    4747* Option to disable SSL verification
    4848* Add function `do_shortcode($content, $ignore_html = false)` in Twig to render shortcode from template
     49* Add search by district
    4950
    5051
Note: See TracChangeset for help on using the changeset viewer.