From 19b932f36876f8d82b3f87fb40e1999d7b5b6051 Mon Sep 17 00:00:00 2001 From: "hello.omny" Date: Tue, 16 May 2017 00:37:20 +0300 Subject: [PATCH] Update code. --- AutoloadExample.php | 14 - composer.json | 30 +- composer.lock | 997 ++++++++++++++++++++++++++ src/Bootstrap.php | 26 + src/Module.php | 23 + src/actions/BaseAction.php | 44 ++ src/actions/ChoseCityAction.php | 34 + src/actions/ChoseRegionAction.php | 39 + src/actions/ChoseRegionAjaxAction.php | 52 ++ src/actions/CityListAction.php | 34 + src/actions/RegionListAction.php | 31 + src/components/CityComponent.php | 206 ++++++ src/components/FreeGeoApiGateway.php | 56 ++ src/controllers/DefaultController.php | 42 ++ src/entity/FreegeoipEntity.php | 82 +++ src/models/Freegeoip.php | 17 + src/query/FreegeoipQuery.php | 52 ++ src/views/_item-city.php | 16 + src/views/_item-region.php | 16 + src/views/_list.php | 34 + src/views/_search.php | 33 + src/views/list.php | 38 + src/widgets/CityModalWidget.php | 68 ++ src/widgets/views/_item-region.php | 15 + src/widgets/views/_regions.php | 21 + src/widgets/views/index.php | 48 ++ 26 files changed, 2051 insertions(+), 17 deletions(-) delete mode 100644 AutoloadExample.php create mode 100644 composer.lock create mode 100644 src/Bootstrap.php create mode 100644 src/Module.php create mode 100644 src/actions/BaseAction.php create mode 100644 src/actions/ChoseCityAction.php create mode 100644 src/actions/ChoseRegionAction.php create mode 100644 src/actions/ChoseRegionAjaxAction.php create mode 100644 src/actions/CityListAction.php create mode 100644 src/actions/RegionListAction.php create mode 100644 src/components/CityComponent.php create mode 100644 src/components/FreeGeoApiGateway.php create mode 100644 src/controllers/DefaultController.php create mode 100644 src/entity/FreegeoipEntity.php create mode 100644 src/models/Freegeoip.php create mode 100644 src/query/FreegeoipQuery.php create mode 100644 src/views/_item-city.php create mode 100644 src/views/_item-region.php create mode 100644 src/views/_list.php create mode 100644 src/views/_search.php create mode 100644 src/views/list.php create mode 100644 src/widgets/CityModalWidget.php create mode 100644 src/widgets/views/_item-region.php create mode 100644 src/widgets/views/_regions.php create mode 100644 src/widgets/views/index.php diff --git a/AutoloadExample.php b/AutoloadExample.php deleted file mode 100644 index 4b67ac0..0000000 --- a/AutoloadExample.php +++ /dev/null @@ -1,14 +0,0 @@ -=5.4.0", + + "yiisoft/yii2": ">=2.0.5", + "yiisoft/yii2-httpclient": "*", + + "yiisoft/yii2-bootstrap": "*", + "kak/select2": "dev-master" }, - "autoload": { + "require-dev": { + "yiisoft/yii2-codeception": "*", + "yiisoft/yii2-debug": "*", + "yiisoft/yii2-gii": "*", + "yiisoft/yii2-faker": "*" + }, + "autoload-dev": { "psr-4": { - "omny\\yii2-city-comonent\\": "" + "omny\\yii2\\city\\component\\": "src/" + } + }, + "extra": { + "bootstrap": "omny\\yii2\\city\\component\\Bootstrap" + }, + "config": { + "process-timeout": 1800, + "fxp-asset":{ + "installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } } } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..d01c82d --- /dev/null +++ b/composer.lock @@ -0,0 +1,997 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "f91f1ce9fe3a20690b4a45d685abb3e8", + "packages": [ + { + "name": "bower-asset/bootstrap", + "version": "v3.3.7", + "source": { + "type": "git", + "url": "https://github.com/twbs/bootstrap.git", + "reference": "0b9c4a4007c44201dce9a6cc1a38407005c26c86" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/0b9c4a4007c44201dce9a6cc1a38407005c26c86", + "reference": "0b9c4a4007c44201dce9a6cc1a38407005c26c86", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.9.1,<4.0" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "less/bootstrap.less", + "dist/js/bootstrap.js" + ], + "bower-asset-ignore": [ + "/.*", + "_config.yml", + "CNAME", + "composer.json", + "CONTRIBUTING.md", + "docs", + "js/tests", + "test-infra" + ] + }, + "license": [ + "MIT" + ], + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", + "keywords": [ + "css", + "framework", + "front-end", + "js", + "less", + "mobile-first", + "responsive", + "web" + ] + }, + { + "name": "bower-asset/jquery", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/jquery/jquery-dist.git", + "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/c0185ab7c75aab88762c5aae780b9d83b80eda72", + "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/jquery.js", + "bower-asset-ignore": [ + "package.json" + ] + }, + "license": [ + "MIT" + ], + "keywords": [ + "browser", + "javascript", + "jquery", + "library" + ] + }, + { + "name": "bower-asset/jquery.inputmask", + "version": "3.3.6", + "source": { + "type": "git", + "url": "https://github.com/RobinHerbots/Inputmask.git", + "reference": "e42852f4afa01a80815394a5b2f9ce504c1a8d0b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/e42852f4afa01a80815394a5b2f9ce504c1a8d0b", + "reference": "e42852f4afa01a80815394a5b2f9ce504c1a8d0b", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "./dist/inputmask/inputmask.js", + "./dist/inputmask/inputmask.extensions.js", + "./dist/inputmask/inputmask.date.extensions.js", + "./dist/inputmask/inputmask.numeric.extensions.js", + "./dist/inputmask/inputmask.phone.extensions.js", + "./dist/inputmask/jquery.inputmask.js", + "./dist/inputmask/global/document.js", + "./dist/inputmask/global/window.js", + "./dist/inputmask/phone-codes/phone.js", + "./dist/inputmask/phone-codes/phone-be.js", + "./dist/inputmask/phone-codes/phone-nl.js", + "./dist/inputmask/phone-codes/phone-ru.js", + "./dist/inputmask/phone-codes/phone-uk.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.js", + "./dist/inputmask/bindings/inputmask.binding.js" + ], + "bower-asset-ignore": [ + "**/*", + "!dist/*", + "!dist/inputmask/*", + "!dist/min/*", + "!dist/min/inputmask/*" + ] + }, + "license": [ + "http://opensource.org/licenses/mit-license.php" + ], + "description": "Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.", + "keywords": [ + "form", + "input", + "inputmask", + "jquery", + "mask", + "plugins" + ] + }, + { + "name": "bower-asset/punycode", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/bestiejs/punycode.js.git", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "punycode.js", + "bower-asset-ignore": [ + "coverage", + "tests", + ".*", + "component.json", + "Gruntfile.js", + "node_modules", + "package.json" + ] + } + }, + { + "name": "bower-asset/select2", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/select2/select2.git", + "reference": "80eb44bec78568b152dc5547269c164cb7b5363c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/select2/select2/zipball/80eb44bec78568b152dc5547269c164cb7b5363c", + "reference": "80eb44bec78568b152dc5547269c164cb7b5363c", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "dist/js/select2.js", + "dist/css/select2.css" + ] + }, + "description": "Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results." + }, + { + "name": "bower-asset/slimscroll", + "version": "v1.3.8", + "source": { + "type": "git", + "url": "https://github.com/rochal/jQuery-slimScroll.git", + "reference": "cf39d364e777ef95574c30c42d3b85cb2bf325d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rochal/jQuery-slimScroll/zipball/cf39d364e777ef95574c30c42d3b85cb2bf325d3", + "reference": "cf39d364e777ef95574c30c42d3b85cb2bf325d3", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "jquery.slimscroll.js", + "jquery.slimscroll.min.js" + ], + "bower-asset-ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] + }, + "description": "slimScroll is a small jQuery plugin that transforms any div into a scrollable area. slimScroll doesn't occupy any visual space as it only appears on a user initiated mouse-over.", + "keywords": [ + "ecosystem:jquery", + "jquery-plugin", + "scroll", + "scrollable", + "scrollbar", + "scroller", + "scrolling", + "slimscroll", + "ui" + ] + }, + { + "name": "bower-asset/yii2-pjax", + "version": "v2.0.6", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/jquery-pjax.git", + "reference": "60728da6ade5879e807a49ce59ef9a72039b8978" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/60728da6ade5879e807a49ce59ef9a72039b8978", + "reference": "60728da6ade5879e807a49ce59ef9a72039b8978", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.8" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "./jquery.pjax.js", + "bower-asset-ignore": [ + ".travis.yml", + "Gemfile", + "Gemfile.lock", + "CONTRIBUTING.md", + "vendor/", + "script/", + "test/" + ] + }, + "license": [ + "MIT" + ] + }, + { + "name": "cebe/markdown", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/cebe/markdown.git", + "reference": "c30eb5e01fe021cc5bba2f9ee0eeef96d4931166" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cebe/markdown/zipball/c30eb5e01fe021cc5bba2f9ee0eeef96d4931166", + "reference": "c30eb5e01fe021cc5bba2f9ee0eeef96d4931166", + "shasum": "" + }, + "require": { + "lib-pcre": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "cebe/indent": "*", + "facebook/xhprof": "*@dev", + "phpunit/phpunit": "4.1.*" + }, + "bin": [ + "bin/markdown" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "cebe\\markdown\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Creator" + } + ], + "description": "A super fast, highly extensible markdown parser for PHP", + "homepage": "https://github.com/cebe/markdown#readme", + "keywords": [ + "extensible", + "fast", + "gfm", + "markdown", + "markdown-extra" + ], + "time": "2016-09-14T20:40:20+00:00" + }, + { + "name": "ezyang/htmlpurifier", + "version": "v4.9.2", + "source": { + "type": "git", + "url": "https://github.com/ezyang/htmlpurifier.git", + "reference": "6d50e5282afdfdfc3e0ff6d192aff56c5629b3d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/6d50e5282afdfdfc3e0ff6d192aff56c5629b3d4", + "reference": "6d50e5282afdfdfc3e0ff6d192aff56c5629b3d4", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "simpletest/simpletest": "^1.1" + }, + "type": "library", + "autoload": { + "psr-0": { + "HTMLPurifier": "library/" + }, + "files": [ + "library/HTMLPurifier.composer.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Edward Z. Yang", + "email": "admin@htmlpurifier.org", + "homepage": "http://ezyang.com" + } + ], + "description": "Standards compliant HTML filter written in PHP", + "homepage": "http://htmlpurifier.org/", + "keywords": [ + "html" + ], + "time": "2017-03-13T06:30:53+00:00" + }, + { + "name": "kak/select2", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sanchezzzhak/kak-select2.git", + "reference": "f297c4a06d8ad863259ac80a3419041edb073bbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sanchezzzhak/kak-select2/zipball/f297c4a06d8ad863259ac80a3419041edb073bbe", + "reference": "f297c4a06d8ad863259ac80a3419041edb073bbe", + "shasum": "" + }, + "require": { + "bower-asset/select2": "4.0.0", + "bower-asset/slimscroll": ">=1.3.3", + "yiisoft/yii2": "*" + }, + "type": "library", + "extra": { + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "autoload": { + "psr-4": { + "kak\\widgets\\select2\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tutik Alexsandr", + "email": "sanchezzzhak@ya.ru" + } + ], + "description": "select2 widgets for Yii2", + "keywords": [ + "kak select2", + "select2 yii2", + "yii2" + ], + "time": "2017-01-20 09:14:36" + }, + { + "name": "yiisoft/yii2", + "version": "2.0.11.2", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-framework.git", + "reference": "ee996adec1dfd7babb67bd0c604f5bd6425fe5ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/ee996adec1dfd7babb67bd0c604f5bd6425fe5ab", + "reference": "ee996adec1dfd7babb67bd0c604f5bd6425fe5ab", + "shasum": "" + }, + "require": { + "bower-asset/jquery": "2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", + "bower-asset/jquery.inputmask": "~3.2.2 | ~3.3.3", + "bower-asset/punycode": "1.3.*", + "bower-asset/yii2-pjax": "~2.0.1", + "cebe/markdown": "~1.0.0 | ~1.1.0", + "ext-ctype": "*", + "ext-mbstring": "*", + "ezyang/htmlpurifier": "~4.6", + "lib-pcre": "*", + "php": ">=5.4.0", + "yiisoft/yii2-composer": "~2.0.4" + }, + "bin": [ + "yii" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com", + "homepage": "http://www.yiiframework.com/", + "role": "Founder and project lead" + }, + { + "name": "Alexander Makarov", + "email": "sam@rmcreative.ru", + "homepage": "http://rmcreative.ru/", + "role": "Core framework development" + }, + { + "name": "Maurizio Domba", + "homepage": "http://mdomba.info/", + "role": "Core framework development" + }, + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Core framework development" + }, + { + "name": "Timur Ruziev", + "email": "resurtm@gmail.com", + "homepage": "http://resurtm.com/", + "role": "Core framework development" + }, + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com", + "role": "Core framework development" + }, + { + "name": "Dmitry Naumenko", + "email": "d.naumenko.a@gmail.com", + "role": "Core framework development" + }, + { + "name": "Boudewijn Vahrmeijer", + "email": "info@dynasource.eu", + "homepage": "http://dynasource.eu", + "role": "Core framework development" + } + ], + "description": "Yii PHP Framework Version 2", + "homepage": "http://www.yiiframework.com/", + "keywords": [ + "framework", + "yii2" + ], + "time": "2017-02-08T09:04:32+00:00" + }, + { + "name": "yiisoft/yii2-bootstrap", + "version": "2.0.6", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-bootstrap.git", + "reference": "3fd2b8c950cce79d60e9702d6bcb24eb3c80f6c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/3fd2b8c950cce79d60e9702d6bcb24eb3c80f6c5", + "reference": "3fd2b8c950cce79d60e9702d6bcb24eb3c80f6c5", + "shasum": "" + }, + "require": { + "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*", + "yiisoft/yii2": ">=2.0.6" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + }, + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "autoload": { + "psr-4": { + "yii\\bootstrap\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Twitter Bootstrap extension for the Yii framework", + "keywords": [ + "bootstrap", + "yii2" + ], + "time": "2016-03-17T03:29:28+00:00" + }, + { + "name": "yiisoft/yii2-composer", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-composer.git", + "reference": "3f4923c2bde6caf3f5b88cc22fdd5770f52f8df2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/3f4923c2bde6caf3f5b88cc22fdd5770f52f8df2", + "reference": "3f4923c2bde6caf3f5b88cc22fdd5770f52f8df2", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "require-dev": { + "composer/composer": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "yii\\composer\\Plugin", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\composer\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The composer plugin for Yii extension installer", + "keywords": [ + "composer", + "extension installer", + "yii2" + ], + "time": "2016-12-20T13:26:02+00:00" + }, + { + "name": "yiisoft/yii2-httpclient", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-httpclient.git", + "reference": "113e4e361730f62c1bf50fbd6f09898776d404b1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-httpclient/zipball/113e4e361730f62c1bf50fbd6f09898776d404b1", + "reference": "113e4e361730f62c1bf50fbd6f09898776d404b1", + "shasum": "" + }, + "require": { + "yiisoft/yii2": "~2.0.0" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\httpclient\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com" + } + ], + "description": "HTTP client extension for the Yii framework", + "keywords": [ + "curl", + "http", + "httpclient", + "yii2" + ], + "time": "2017-02-15T14:28:10+00:00" + } + ], + "packages-dev": [ + { + "name": "bower-asset/typeahead.js", + "version": "v0.11.1", + "source": { + "type": "git", + "url": "https://github.com/twitter/typeahead.js.git", + "reference": "588440f66559714280628a4f9799f0c4eb880a4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twitter/typeahead.js/zipball/588440f66559714280628a4f9799f0c4eb880a4a", + "reference": "588440f66559714280628a4f9799f0c4eb880a4a", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "require-dev": { + "bower-asset/jasmine-ajax": "~1.3.1", + "bower-asset/jasmine-jquery": "~1.5.2", + "bower-asset/jquery": "~1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/typeahead.bundle.js" + } + }, + { + "name": "fzaninotto/faker", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/44f9a286a04b80c76a4e5fb7aad8bb539b920123", + "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123", + "shasum": "" + }, + "require": { + "php": "^5.3.3|^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "type": "library", + "extra": { + "branch-alias": [] + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2016-04-29T12:21:54+00:00" + }, + { + "name": "phpspec/php-diff", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/php-diff.git", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a", + "reference": "0464787bfa7cd13576c5a1e318709768798bec6a", + "shasum": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Diff": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Chris Boulton", + "homepage": "http://github.com/chrisboulton" + } + ], + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", + "time": "2016-04-07T12:29:16+00:00" + }, + { + "name": "yiisoft/yii2-codeception", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-codeception.git", + "reference": "c916a36d09fc128b05a374e7922bc56854334d56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/c916a36d09fc128b05a374e7922bc56854334d56", + "reference": "c916a36d09fc128b05a374e7922bc56854334d56", + "shasum": "" + }, + "require": { + "yiisoft/yii2": ">=2.0.4" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\codeception\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Mark Jebri", + "email": "mark.github@yandex.ru" + } + ], + "description": "The Codeception integration for the Yii framework", + "keywords": [ + "codeception", + "yii2" + ], + "abandoned": "codeception/codeception", + "time": "2016-03-17T03:41:26+00:00" + }, + { + "name": "yiisoft/yii2-debug", + "version": "2.0.9", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-debug.git", + "reference": "647be6c9d48dc2f3c2e2f33b9eba0a4ca78abde9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/647be6c9d48dc2f3c2e2f33b9eba0a4ca78abde9", + "reference": "647be6c9d48dc2f3c2e2f33b9eba0a4ca78abde9", + "shasum": "" + }, + "require": { + "yiisoft/yii2": "~2.0.11", + "yiisoft/yii2-bootstrap": "~2.0.0" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\debug\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The debugger extension for the Yii framework", + "keywords": [ + "debug", + "debugger", + "yii2" + ], + "time": "2017-02-21T10:30:50+00:00" + }, + { + "name": "yiisoft/yii2-faker", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-faker.git", + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/b88ca69ee226a3610b2c26c026c3203d7ac50f6c", + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c", + "shasum": "" + }, + "require": { + "fzaninotto/faker": "*", + "yiisoft/yii2": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\faker\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Mark Jebri", + "email": "mark.github@yandex.ru" + } + ], + "description": "Fixture generator. The Faker integration for the Yii framework.", + "keywords": [ + "Fixture", + "faker", + "yii2" + ], + "time": "2015-03-01T06:22:44+00:00" + }, + { + "name": "yiisoft/yii2-gii", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-gii.git", + "reference": "1bd6df6804ca077ec022587905a0d43eb286f507" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/1bd6df6804ca077ec022587905a0d43eb286f507", + "reference": "1bd6df6804ca077ec022587905a0d43eb286f507", + "shasum": "" + }, + "require": { + "bower-asset/typeahead.js": "0.10.* | ~0.11.0", + "phpspec/php-diff": ">=1.0.2", + "yiisoft/yii2": ">=2.0.4", + "yiisoft/yii2-bootstrap": "~2.0" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + }, + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "autoload": { + "psr-4": { + "yii\\gii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Gii extension for the Yii framework", + "keywords": [ + "code generator", + "gii", + "yii2" + ], + "time": "2016-03-18T14:09:46+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "kak/select2": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4.0" + }, + "platform-dev": [] +} diff --git a/src/Bootstrap.php b/src/Bootstrap.php new file mode 100644 index 0000000..7fec35b --- /dev/null +++ b/src/Bootstrap.php @@ -0,0 +1,26 @@ + '/city/default/' . CityComponent::ACTION_REGION_LIST, + ]; + + public function bootstrap($app) + { + $app->setComponents([ + 'city' => CityComponent::className() + ]); + + $app->setModules([ + 'city' => Module::className(), + ]); + + $app->getUrlManager()->addRules($this->routes, true); + } +} \ No newline at end of file diff --git a/src/Module.php b/src/Module.php new file mode 100644 index 0000000..06f6379 --- /dev/null +++ b/src/Module.php @@ -0,0 +1,23 @@ +validateSettings(); + + $controller = $this->controller; + $view = $controller->view; + + $controller->viewPath = $this->viewPath; + $view->title = $this->viewTitle; + + parent::init(); + } + + /** + * @throws InvalidConfigException + */ + private function validateSettings() + { + if (empty($this->viewTitle)) { + throw new InvalidConfigException('ViewTitle must be set.'); + } + + if (empty($this->itemViewFile)) { + throw new InvalidConfigException('ItemViewFile must be set.'); + } + } +} \ No newline at end of file diff --git a/src/actions/ChoseCityAction.php b/src/actions/ChoseCityAction.php new file mode 100644 index 0000000..cadb33d --- /dev/null +++ b/src/actions/ChoseCityAction.php @@ -0,0 +1,34 @@ +response; + + /** @var CityComponent $city */ + $city = \Yii::$app->city; + $city->setCity($id); + + $cityCookie = new Cookie([ + 'name' => Freegeoip::COOKIE_CITY_ID, + 'value' => $city->getCity()->id, + 'expire' => strtotime("+1 month", time()), + ]); + $response->cookies->add($cityCookie); + + return $response->redirect(CityComponent::$returnUrl); + } + +} diff --git a/src/actions/ChoseRegionAction.php b/src/actions/ChoseRegionAction.php new file mode 100644 index 0000000..4170e1d --- /dev/null +++ b/src/actions/ChoseRegionAction.php @@ -0,0 +1,39 @@ +response; + /** @var CookieCollection $cookieCollection */ + $cookieCollection = $response->cookies; + + /** @var CityComponent $cityComponent */ + $cityComponent = \Yii::$app->city; + $cityComponent->setRegion($id); + + $cookie = new Cookie([ + 'name' => Freegeoip::COOKIE_REGION_ID, + 'value' => $cityComponent->getRegion()->id, + 'expire' => strtotime("+1 month", time()), + ]); + $cookieCollection->add($cookie); + + return $response->redirect(['/city/default/' . CityComponent::ACTION_CHOSE_REGION]); + } + +} diff --git a/src/actions/ChoseRegionAjaxAction.php b/src/actions/ChoseRegionAjaxAction.php new file mode 100644 index 0000000..7b3f51e --- /dev/null +++ b/src/actions/ChoseRegionAjaxAction.php @@ -0,0 +1,52 @@ +response; + /** @var CookieCollection $cookieCollection */ + $cookieCollection = $response->cookies; + + /** @var CityComponent $cityComponent */ + $cityComponent = \Yii::$app->city; + $cityComponent->setRegion($id); + + $cookie = new Cookie([ + 'name' => Freegeoip::COOKIE_REGION_ID, + 'value' => $cityComponent->getRegion()->id, + 'expire' => strtotime("+1 month", time()), + ]); + $cookieCollection->add($cookie); + + $cityModels = Freegeoip::find() + ->byCountryIcoCode($cityComponent->getRegion()->country_iso_code) + ->byRegionIsoCode($cityComponent->getRegion()->subdivision_1_iso_code) + ->all(); + + $this->controller->viewPath = '@omny/yii2/city/component/widgets/views'; + + \Yii::$app->response->format = Response::FORMAT_HTML; + + return $this->controller->renderAjax('_regions',[ + 'regionModels' => $cityModels, + 'mapTitle' => 'city_name', + 'listView' => '@omny/yii2/city/component/views/_list', + 'itemView' => '@omny/yii2/city/component/views/_item-city', + 'searchTitle' => 'Города', + 'searchSelectedVal' => \Yii::$app->city->getCity()->id, + ]); + } +} \ No newline at end of file diff --git a/src/actions/CityListAction.php b/src/actions/CityListAction.php new file mode 100644 index 0000000..41e1d85 --- /dev/null +++ b/src/actions/CityListAction.php @@ -0,0 +1,34 @@ +city->getRegion(); + + $models = Freegeoip::find() + ->byCountryIcoCode($regionModel->country_iso_code) + ->byRegionIsoCode($regionModel->subdivision_1_iso_code) + ->all(); + + return $this->controller->render('list', + [ + 'models' => $models, + 'itemViewPath' => $this->itemViewFile, + 'mapTitle' => 'city_name', + 'searchTitle' => 'Города', + 'searchSelectedVal' => \Yii::$app->city->getCity()->id, + ]); + } +} \ No newline at end of file diff --git a/src/actions/RegionListAction.php b/src/actions/RegionListAction.php new file mode 100644 index 0000000..773e16f --- /dev/null +++ b/src/actions/RegionListAction.php @@ -0,0 +1,31 @@ +onlyRegions('RU') + ->all(); + + return $this->controller->render('list', + [ + 'models' => $models, + 'itemViewPath' => $this->itemViewFile, + 'mapTitle' => 'subdivision_1_name', + 'searchTitle' => 'Регионы', + 'searchSelectedVal' => \Yii::$app->city->getRegion()->id, + ]); + } +} \ No newline at end of file diff --git a/src/components/CityComponent.php b/src/components/CityComponent.php new file mode 100644 index 0000000..851b988 --- /dev/null +++ b/src/components/CityComponent.php @@ -0,0 +1,206 @@ +defaultCity + = $this->city + = $this->findGeoIpModelById($this->defaultCityId); + + $this->defaultRegion + = $this->region + = $this->findGeoIpModelById($this->defaultRegionId); + + $this->setup([ + Freegeoip::COOKIE_REGION_ID => 'region', + Freegeoip::COOKIE_CITY_ID => 'city', + ]); + + $this->setupCountyIsoCode(); + + parent::init(); + } + + /** + * @param $id + */ + public function setCity($id) + { + $this->city = $this->findGeoIpModelById($id); + } + + /** + * @param $id + */ + public function setRegion($id) + { + $this->region = $this->findGeoIpModelById($id); + } + + /** + * @return Freegeoip + */ + public function getCity() + { + return $this->city; + } + + /** + * @return Freegeoip + */ + public function getRegion() + { + return $this->region; + } + + /** + * @param $options + */ + private function setup($options) + { + $cookies = \Yii::$app->request->cookies; + + foreach ($options as $key => $property) { + if ($cookies->has($key)) { + $regionIdValue = $cookies->getValue($key); + $this->$property = $this->findGeoIpModelById($regionIdValue); + } else { + $userValue = $this->getModelFromUserIp(); + if (!is_null($userValue)) { + $this->$property = $userValue; + } + } + } + } + + /** + * + */ + private function setupCountyIsoCode() + { + $countryIsoCode = $this->city->country_iso_code; + $cookieCollection = \Yii::$app->response->cookies; + $cookie = new Cookie([ + 'name' => Freegeoip::COOKIE_COUNTRY_ISO, + 'value' => $countryIsoCode, + 'expire' => strtotime("+1 month", time()), + ]); + $cookieCollection->add($cookie); + } + + /** + * @return Freegeoip|array|null + */ + private function getModelFromUserIp() + { + $geoIpModel = $this->getGeoIpModelByUserIP(); + + if (!is_null($geoIpModel)) { + return $geoIpModel; + } + + return null; + } + + /** + * @param $id + * @return Freegeoip|array|null + */ + private function findGeoIpModelById($id) + { + $model = Freegeoip::find() + ->where(['id' => $id]) + ->one(); + + if (is_null($model)) { + return $this->defaultRegion; + } + + return $model; + } + + /** + * @return Freegeoip|array|null + */ + private function getGeoIpModelByUserIP() + { + $request = \Yii::$app->request; + + $ip = $request->userIP; + + if (in_array($ip, $this->testingIpList)) { + $ip = $this->testIp; + } + + $freeGeoClient = new FreeGeoApiGateway([ + 'ip' => $ip, + ]); + + $response = $freeGeoClient->getData(); + + if (!is_null($response)) { + return $this->findGeoIpModel($response); + } + + return null; + } + + /** + * @param $response + * @return Freegeoip|array|null + */ + private function findGeoIpModel($response) + { + return Freegeoip::find() + ->where(['country_iso_code' => $response['country_code']]) + ->andWhere(['subdivision_1_name_en' => $response['region_name']]) + ->andWhere(['city_name_en' => $response['city']]) + ->one(); + } + +} diff --git a/src/components/FreeGeoApiGateway.php b/src/components/FreeGeoApiGateway.php new file mode 100644 index 0000000..633424f --- /dev/null +++ b/src/components/FreeGeoApiGateway.php @@ -0,0 +1,56 @@ +setRequestUrl(); + } + + public function getData() + { + if (isset($this->ip)) { + return $this->getResponse(); + } + + return null; + } + + private function setRequestUrl() + { + $this->requestUrl = $this->apiRequest . "/" . $this->format . "/" . $this->ip; + } + + private function getResponse() + { + $client = new Client(); + + $response = $client->createRequest() + ->setMethod('get') + ->setUrl($this->requestUrl) + ->send(); + + if ($response->isOk) { + return $response->data; + } + + return null; + } +} \ No newline at end of file diff --git a/src/controllers/DefaultController.php b/src/controllers/DefaultController.php new file mode 100644 index 0000000..82ad665 --- /dev/null +++ b/src/controllers/DefaultController.php @@ -0,0 +1,42 @@ + [ + 'class' => RegionListAction::className(), + ], + CityComponent::ACTION_CITY_LIST => [ + 'class' => CityListAction::className(), + ], + CityComponent::ACTION_CHOSE_CITY => [ + 'class' => ChoseCityAction::className(), + ], + CityComponent::ACTION_CHOSE_REGION => [ + 'class' => ChoseRegionAction::className(), + ], + CityComponent::ACTION_CHOSE_REGION_AJAX => [ + 'class' => ChoseRegionAjaxAction::className(), + ] + ], + parent::actions() + ); + } +} diff --git a/src/entity/FreegeoipEntity.php b/src/entity/FreegeoipEntity.php new file mode 100644 index 0000000..595f41a --- /dev/null +++ b/src/entity/FreegeoipEntity.php @@ -0,0 +1,82 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'continent_code' => 'Continent Code', + 'continent_name' => 'Continent Name', + 'continent_name_en' => 'Continent Name En', + 'country_iso_code' => 'Country Iso Code', + 'country_name' => 'Country Name', + 'country_name_en' => 'Country Name En', + 'subdivision_1_iso_code' => 'Subdivision 1 Iso Code', + 'subdivision_1_name' => 'Subdivision 1 Name', + 'subdivision_1_name_en' => 'Subdivision 1 Name En', + 'subdivision_2_iso_code' => 'Subdivision 2 Iso Code', + 'subdivision_2_name' => 'Subdivision 2 Name', + 'subdivision_2_name_en' => 'Subdivision 2 Name En', + 'city_name' => 'City Name', + 'city_name_en' => 'City Name En', + 'metro_code' => 'Metro Code', + 'time_zone' => 'Time Zone', + ]; + } + + /** + * @inheritdoc + * @return FreegeoipQuery the active query used by this AR class. + */ + public static function find() + { + return new FreegeoipQuery(get_called_class()); + } +} diff --git a/src/models/Freegeoip.php b/src/models/Freegeoip.php new file mode 100644 index 0000000..44f011c --- /dev/null +++ b/src/models/Freegeoip.php @@ -0,0 +1,17 @@ +andWhere(['country_iso_code' => $code]); + } + + public function onlyRegions($countryIso = null) + { + if (is_null($countryIso)) { + return $this->groupBy('subdivision_1_name') + ->orderBy('subdivision_1_name'); + } + + return $this->andWhere(['country_iso_code' => $countryIso]) + ->groupBy('subdivision_1_name') + ->orderBy('subdivision_1_name'); + } + + public function byRegionIsoCode($code) + { + return $this->andWhere(['subdivision_1_iso_code' => $code]) + ->orderBy('city_name'); + } +} diff --git a/src/views/_item-city.php b/src/views/_item-city.php new file mode 100644 index 0000000..5aba31e --- /dev/null +++ b/src/views/_item-city.php @@ -0,0 +1,16 @@ +city_name, + [ + '/city/default/' . CityComponent::ACTION_CHOSE_CITY, + 'id' => $model->id + ] +); +echo Html::tag('li', $link); \ No newline at end of file diff --git a/src/views/_item-region.php b/src/views/_item-region.php new file mode 100644 index 0000000..7f4343b --- /dev/null +++ b/src/views/_item-region.php @@ -0,0 +1,16 @@ +subdivision_1_name, + [ + '/city/default/' . CityComponent::ACTION_CITY_LIST, + 'id' => $model->id + ] +); +echo Html::tag('li', $link); \ No newline at end of file diff --git a/src/views/_list.php b/src/views/_list.php new file mode 100644 index 0000000..2c9a072 --- /dev/null +++ b/src/views/_list.php @@ -0,0 +1,34 @@ + +
+
+
    + render($viewFile, compact('model')); + $flag++; + + if ($flag > $cellItemCount) : + $flag = 1; + + echo "
"; + echo '
'; + echo '
    '; + endif; + endforeach; ?> +
+
+
diff --git a/src/views/_search.php b/src/views/_search.php new file mode 100644 index 0000000..f90514a --- /dev/null +++ b/src/views/_search.php @@ -0,0 +1,33 @@ + +
+
+
+ + 'select all', + 'unselectLabel' => 'unselect all', + 'options' => [ + 'data-scroll-height' => 150, // auto scroll + 'data-item-width' => 100, // 100|auto + ], + 'multiple' => false, + 'value' => $selectedValue, + 'name' => 'types', + 'items' => ArrayHelper::map($models, 'id', $mapTitle), + ]); + ?> +
+
+
diff --git a/src/views/list.php b/src/views/list.php new file mode 100644 index 0000000..56547d5 --- /dev/null +++ b/src/views/list.php @@ -0,0 +1,38 @@ + +
+
+
+
+

title); ?>

+
+
+
+
+
+render('_search', + [ + 'mapTitle' => $mapTitle, + 'models' => $models, + 'title' => $searchTitle, + 'selectedValue' => $searchSelectedVal, + ]) ?> + +
+ render( + '_list', + [ + 'models' => $models, + 'viewFile' => $itemViewPath, + ]) ?> +
diff --git a/src/widgets/CityModalWidget.php b/src/widgets/CityModalWidget.php new file mode 100644 index 0000000..eca636c --- /dev/null +++ b/src/widgets/CityModalWidget.php @@ -0,0 +1,68 @@ +city; + $this->city = $cityComponent->getCity(); + $this->regionModels = $this->getRegionModels(); + + parent::init(); + } + + public function run() + { + return $this->render('index', [ + 'current' => $this->city, + 'regionModels' => $this->regionModels, + 'btnClass' => $this->btnClass, + 'searchTitle' => 'Регионы', + 'searchSelectedVal' => \Yii::$app->city->getRegion()->id, + ]); + } + + /** + * @return Freegeoip[]|null + */ + private function getRegionModels() + { + return Freegeoip::find() + ->onlyRegions($this->getCountryCode()) + ->all(); + } + + /** + * @return mixed|string + */ + private function getCountryCode() + { + $countryIsoCode = \Yii::$app->request->cookies->getValue(Freegeoip::COOKIE_COUNTRY_ISO); + + if (empty($countryIsoCode)) { + return 'RU'; + } + + return $countryIsoCode; + } +} \ No newline at end of file diff --git a/src/widgets/views/_item-region.php b/src/widgets/views/_item-region.php new file mode 100644 index 0000000..e8347ab --- /dev/null +++ b/src/widgets/views/_item-region.php @@ -0,0 +1,15 @@ +subdivision_1_name, + [ + '/city/default/chose-region-ajax', + 'id' => $model->id + ] +); +echo Html::tag('li', $link); \ No newline at end of file diff --git a/src/widgets/views/_regions.php b/src/widgets/views/_regions.php new file mode 100644 index 0000000..f560ac9 --- /dev/null +++ b/src/widgets/views/_regions.php @@ -0,0 +1,21 @@ +render('@omny/yii2/city/component/views/_search', [ + 'mapTitle' => $mapTitle, + 'models' => $regionModels, + 'title' => $searchTitle, + 'selectedValue' => $searchSelectedVal, +]); + +echo $this->render($listView, [ + 'models' => $regionModels, + 'viewFile' => $itemView +]); \ No newline at end of file diff --git a/src/widgets/views/index.php b/src/widgets/views/index.php new file mode 100644 index 0000000..0e0c3ae --- /dev/null +++ b/src/widgets/views/index.php @@ -0,0 +1,48 @@ +city_name, '#', [ + 'data' => ['toggle' => 'modal', 'target' => '#city-modal'], + 'class' => $btnClass, +]); + +Modal::begin([ + 'size' => Modal::SIZE_LARGE, + 'header' => '

Выбор города

', + 'id' => 'city-modal', + 'toggleButton' => false, +]); + +Pjax::begin([ + 'id' => 'cityComponentPjax', + 'enablePushState' => false +]); + +echo $this->render('@omny/yii2/city/component/views/_search', [ + 'models' => $regionModels, + 'mapTitle' => 'subdivision_1_name', + 'title' => $searchTitle, + 'selectedValue' => $searchSelectedVal, +]); + +echo $this->render('@omny/yii2/city/component/views/_list', [ + 'models' => $regionModels, + 'viewFile' => '@omny/yii2/city/component/widgets/views/_item-region', + 'mapTitle' => 'subdivision_1_name', + 'searchTitle' => 'Регионы', + 'searchSelectedVal' => Yii::$app->city->getRegion()->id, +]); + +Pjax::end(); + +Modal::end();