<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* Map/page.html.twig */
class __TwigTemplate_a28a045d3be3f3299f645cdfe29370c8 extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->blocks = [
'mainContainer' => [$this, 'block_mainContainer'],
'javascripts' => [$this, 'block_javascripts'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "grid.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
$__internal_b91a4435ea3baf1e2b6bfda56133dace = $this->extensions["Sentry\\SentryBundle\\Tracing\\Twig\\TwigTracingExtension"];
$__internal_b91a4435ea3baf1e2b6bfda56133dace->enter($__internal_b91a4435ea3baf1e2b6bfda56133dace_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "Map/page.html.twig"));
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "Map/page.html.twig"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "Map/page.html.twig"));
$this->parent = $this->loadTemplate("grid.html.twig", "Map/page.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
$__internal_b91a4435ea3baf1e2b6bfda56133dace->leave($__internal_b91a4435ea3baf1e2b6bfda56133dace_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
}
// line 3
public function block_mainContainer($context, array $blocks = [])
{
$macros = $this->macros;
$__internal_b91a4435ea3baf1e2b6bfda56133dace = $this->extensions["Sentry\\SentryBundle\\Tracing\\Twig\\TwigTracingExtension"];
$__internal_b91a4435ea3baf1e2b6bfda56133dace->enter($__internal_b91a4435ea3baf1e2b6bfda56133dace_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "mainContainer"));
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "mainContainer"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "mainContainer"));
// line 4
echo " ";
// line 5
echo " <div id=\"map_form\"></div>
<img src=\"";
// line 6
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("/static/preloader.gif"), "html", null, true);
echo "\" id=\"preloader\" style=\"display: none;\" />
<div id=\"map\"
data-city-uri-idenity=\"";
// line 8
echo twig_escape_filter($this->env, (isset($context["cityUriIdentity"]) || array_key_exists("cityUriIdentity", $context) ? $context["cityUriIdentity"] : (function () { throw new RuntimeError('Variable "cityUriIdentity" does not exist.', 8, $this->source); })()), "html", null, true);
echo "\"
data-city-latitude=\"";
// line 9
echo twig_escape_filter($this->env, (isset($context["cityLatitude"]) || array_key_exists("cityLatitude", $context) ? $context["cityLatitude"] : (function () { throw new RuntimeError('Variable "cityLatitude" does not exist.', 9, $this->source); })()), "html", null, true);
echo "\"
data-city-longitude=\"";
// line 10
echo twig_escape_filter($this->env, (isset($context["cityLongitude"]) || array_key_exists("cityLongitude", $context) ? $context["cityLongitude"] : (function () { throw new RuntimeError('Variable "cityLongitude" does not exist.', 10, $this->source); })()), "html", null, true);
echo "\"
style=\"width:100%; height:500px;\"></div>
";
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_b91a4435ea3baf1e2b6bfda56133dace->leave($__internal_b91a4435ea3baf1e2b6bfda56133dace_prof);
}
// line 14
public function block_javascripts($context, array $blocks = [])
{
$macros = $this->macros;
$__internal_b91a4435ea3baf1e2b6bfda56133dace = $this->extensions["Sentry\\SentryBundle\\Tracing\\Twig\\TwigTracingExtension"];
$__internal_b91a4435ea3baf1e2b6bfda56133dace->enter($__internal_b91a4435ea3baf1e2b6bfda56133dace_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "javascripts"));
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "javascripts"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "javascripts"));
// line 15
echo " <script src=\"";
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("bundles/fosjsrouting/js/router.min.js"), "html", null, true);
echo "\"></script>
<script src=\"";
// line 16
echo $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("fos_js_routing_js", ["callback" => "fos.Router.setData"]);
echo "\"></script>
<script src=\"https://code.jquery.com/jquery-3.4.1.min.js\"></script>
<script src=\"https://api-maps.yandex.ru/2.1/?lang=ru_RU\" type=\"text/javascript\"></script>
<script type=\"text/javascript\">
;var RoutingDecorator = {
generate: function (name, params) {
const orig_name = name;
try {
Routing.getRoute(name)
} catch(error) {
name = name + '.' + '";
// line 27
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, (isset($context["app"]) || array_key_exists("app", $context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.', 27, $this->source); })()), "request", [], "any", false, false, false, 27), "locale", [], "any", false, false, false, 27), "html", null, true);
echo "';
try {
Routing.getRoute(name)
} catch(error) {
name = orig_name;
}
}
return Routing.generate(name, params);
}
};
;(function () {
document.addEventListener('DOMContentLoaded', _ => {
var avatarPath = '";
// line 42
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("", "profile_media_avatar"), "html", null, true);
echo "';
var photoPath = '";
// line 43
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("", "profile_media"), "html", null, true);
echo "';
var thumbPath = '";
// line 44
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("", "saloon_media_thumb"), "html", null, true);
echo "';
var mapContainer = document.querySelector('#map');
var preloader = document.querySelector('#preloader');
var cityUriIdentity = mapContainer.getAttribute('data-city-uri-idenity');
var cityLatitude = mapContainer.getAttribute('data-city-latitude');
var cityLongitude = mapContainer.getAttribute('data-city-longitude');
var formName = 'filter_map_form';
var multipleCities = ";
// line 51
echo twig_escape_filter($this->env, (isset($context["multipleCities"]) || array_key_exists("multipleCities", $context) ? $context["multipleCities"] : (function () { throw new RuntimeError('Variable "multipleCities" does not exist.', 51, $this->source); })()), "html", null, true);
echo ";
var routesUrl = '/js/fos_js_routes";
// line 52
echo (((isset($context["multipleCities"]) || array_key_exists("multipleCities", $context) ? $context["multipleCities"] : (function () { throw new RuntimeError('Variable "multipleCities" does not exist.', 52, $this->source); })())) ? ("_city_prefixed") : (""));
echo ".json';
loadRoutes();
var myMap, clusterer;
ymaps.ready(function () {
myMap = new ymaps.Map('map', {
center: [cityLatitude, cityLongitude],
zoom: 9,
behaviors: ['default', 'scrollZoom']
}, {
searchControlProvider: 'yandex#search'
});
clusterer = new ymaps.Clusterer({
preset: 'islands#invertedVioletClusterIcons',//Через кластеризатор можно указать только стили кластеров,стили для меток нужно назначать каждой метке отдельно.
groupByCoordinates: false,//Ставим true, если хотим кластеризовать только точки с одинаковыми координатами.
//Опции кластеров указываем в кластеризаторе с префиксом \"cluster\".
clusterDisableClickZoom: true,
clusterHideIconOnBalloonOpen: false,
geoObjectHideIconOnBalloonOpen: false
});
// Можно менять опции кластеризатора после создания.
clusterer.options.set({
gridSize: 80,
clusterDisableClickZoom: true
});
loadForm();
});
function loadRoutes() {
\$.ajax({
url:routesUrl,
dataType: \"json\",
async: false,
success: function (routes) {
Routing.setRoutingData(routes);
},
error: function (xhr, ajaxOptions, thrownError) {}
});
}
function setFormSubmitListener() {
document.querySelector(\"form[name=\"+formName+\"]\").addEventListener('submit', function(e){
e.preventDefault();
if(!clusterer)
return;
filterData();
return false;
});
}
function loadForm() {
fetch('";
// line 108
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("map.form", ["city" => (isset($context["cityUriIdentity"]) || array_key_exists("cityUriIdentity", $context) ? $context["cityUriIdentity"] : (function () { throw new RuntimeError('Variable "cityUriIdentity" does not exist.', 108, $this->source); })())]), "html", null, true);
echo "', {
mode: \"cors\",
importance: \"low\",
method: \"POST\",
headers: {
\"Content-Type\": \"application/x-www-form-urlencoded\",
\"X-Requested-With\": \"XMLHttpRequest\"
},
}).then(response => {
if (response.status < 300) {
return response.text();
} else {
console.warn(\"🤔\");
return null;
}
}).then(response => {
document.querySelector('#map_form').innerHTML = response;
filterData();
setFormSubmitListener();
});
}
function filterData() {
preloader.style.display = 'block';
var data = {};
\$(\"form[name=\"+formName+\"]\").serializeArray().forEach((object)=>{
//\"подгоняем\" данные под формат, ожидаемый формой при сабмите
var fieldName = object.name.toString().replace(formName + '[', '').replace(']', '');
var clearFieldName = fieldName.substr(0, fieldName.indexOf('['));
if(~fieldName.indexOf('[]')) {
checkArrayIsInFormObject(clearFieldName, data);
data[clearFieldName].push(object.value);
} else if(~fieldName.indexOf('[m')) {
if(!object.value)
return;
checkObjectIsInFormObject(clearFieldName, data);
if(~fieldName.indexOf('[min]'))
data[clearFieldName]['min'] = object.value;
if(~fieldName.indexOf('[max]'))
data[clearFieldName]['max'] = object.value;
} else {
data[fieldName] = object.value;
}
});
\$.ajax({
url:'";
// line 158
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("map.filter", ["city" => (isset($context["cityUriIdentity"]) || array_key_exists("cityUriIdentity", $context) ? $context["cityUriIdentity"] : (function () { throw new RuntimeError('Variable "cityUriIdentity" does not exist.', 158, $this->source); })())]), "html", null, true);
echo "',
type: \"POST\",
dataType: \"json\",
data: {
\"form\": JSON.stringify(data),
},
async: true,
success: function (return_data) {
// console.log(return_data);
updateMap(return_data);
preloader.style.display = 'none';
},
error: function (xhr, ajaxOptions, thrownError) {}
});
}
function checkArrayIsInFormObject(name, formObject) {
if(false == formObject.hasOwnProperty(name))
formObject[name] = [];
}
function checkObjectIsInFormObject(name, formObject) {
if(false == formObject.hasOwnProperty(name))
formObject[name] = {};
}
function updateMap(points) {
clusterer.removeAll();
if(!points || !points.length)
return;
var getImgUrl = function(path, imgType) {
if(path[0] == '/')
return path;
var assetPackagePath = '';
if(imgType == 'avatar')
assetPackagePath = avatarPath;
else if(imgType == 'photo')
assetPackagePath = photoPath;
if(imgType == 'thumb')
assetPackagePath = thumbPath;
return assetPackagePath + path;
};
var getPointData = function (index) {
const data = points[index];
const isProfile = data[0] == 1;
const isSaloon = data[0] == 2;
let url = '';
const uri = data[3];
if(isProfile) {
url = RoutingDecorator.generate(
'profile_preview.page',
multipleCities ? {city: cityUriIdentity, profile: uri} : {profile: uri}
);
} else if(isSaloon) {
url = RoutingDecorator.generate(
'saloon_preview.page',
multipleCities ? {city: cityUriIdentity, saloon: uri} : {saloon: uri}
);
}
var processProfileShowsUrl = '";
// line 224
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("map.increment_profile_shows", (((isset($context["multipleCities"]) || array_key_exists("multipleCities", $context) ? $context["multipleCities"] : (function () { throw new RuntimeError('Variable "multipleCities" does not exist.', 224, $this->source); })())) ? (["city" => (isset($context["cityUriIdentity"]) || array_key_exists("cityUriIdentity", $context) ? $context["cityUriIdentity"] : (function () { throw new RuntimeError('Variable "cityUriIdentity" does not exist.', 224, $this->source); })())]) : ([]))), "html", null, true);
echo "';
return {
balloonContentHeader: '',
balloonContentBody: '<p><img src=\"' + getImgUrl(data[5], isProfile ? 'avatar' : 'thumb') + '\" width=\"100\" /></p>' + '<font size=3><b><a target=\"_blank\" href=\"' + url + '\">Профиль</a></b></font>'
+ '<img style=\"display:none;\" width=\"0\" height=\"0\" src=\"' + processProfileShowsUrl + '?id=' + (isProfile ? data[9] : null)+'\" />', //не убирать, функционально важно
balloonContentFooter: '<font size=1>' + data[8] + ',' + data[9] + ',' + data[10] + '</strong>',
clusterCaption: '<strong>' + (isSaloon ? 'Салон ' : '') + data[4] + '</strong>'
};
};
var getPointOptions = function (index, type) {
return {
preset: type == 'profile' ? 'islands#violetIcon' : 'islands#redIcon'
};
};
var geoObjects = [];
for(var i = 0, len = points.length; i < len; i++)
geoObjects[i] = new ymaps.Placemark([points[i][1], points[i][2]], getPointData(i), getPointOptions(i, points[i][0] == 1));
//В кластеризатор можно добавить javascript-массив меток (не геоколлекцию) или одну метку.
clusterer.add(geoObjects);
myMap.geoObjects.add(clusterer);
// Спозиционируем карту так, чтобы на ней были видны все объекты.
myMap.setBounds(clusterer.getBounds(), {
checkZoomRange: true
});
}
});
})();
</script>
";
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_b91a4435ea3baf1e2b6bfda56133dace->leave($__internal_b91a4435ea3baf1e2b6bfda56133dace_prof);
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName()
{
return "Map/page.html.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable()
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo()
{
return array ( 365 => 224, 296 => 158, 243 => 108, 184 => 52, 180 => 51, 170 => 44, 166 => 43, 162 => 42, 144 => 27, 130 => 16, 125 => 15, 112 => 14, 96 => 10, 92 => 9, 88 => 8, 83 => 6, 80 => 5, 78 => 4, 65 => 3, 36 => 1,);
}
public function getSourceContext()
{
return new Source("{% extends 'grid.html.twig' %}
{% block mainContainer %}
{# {{ form(form) }}#}
<div id=\"map_form\"></div>
<img src=\"{{ asset('/static/preloader.gif') }}\" id=\"preloader\" style=\"display: none;\" />
<div id=\"map\"
data-city-uri-idenity=\"{{ cityUriIdentity }}\"
data-city-latitude=\"{{ cityLatitude }}\"
data-city-longitude=\"{{ cityLongitude }}\"
style=\"width:100%; height:500px;\"></div>
{% endblock %}
{% block javascripts %}
<script src=\"{{ asset('bundles/fosjsrouting/js/router.min.js') }}\"></script>
<script src=\"{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}\"></script>
<script src=\"https://code.jquery.com/jquery-3.4.1.min.js\"></script>
<script src=\"https://api-maps.yandex.ru/2.1/?lang=ru_RU\" type=\"text/javascript\"></script>
<script type=\"text/javascript\">
;var RoutingDecorator = {
generate: function (name, params) {
const orig_name = name;
try {
Routing.getRoute(name)
} catch(error) {
name = name + '.' + '{{ app.request.locale }}';
try {
Routing.getRoute(name)
} catch(error) {
name = orig_name;
}
}
return Routing.generate(name, params);
}
};
;(function () {
document.addEventListener('DOMContentLoaded', _ => {
var avatarPath = '{{ asset('', 'profile_media_avatar') }}';
var photoPath = '{{ asset('', 'profile_media') }}';
var thumbPath = '{{ asset('', 'saloon_media_thumb') }}';
var mapContainer = document.querySelector('#map');
var preloader = document.querySelector('#preloader');
var cityUriIdentity = mapContainer.getAttribute('data-city-uri-idenity');
var cityLatitude = mapContainer.getAttribute('data-city-latitude');
var cityLongitude = mapContainer.getAttribute('data-city-longitude');
var formName = 'filter_map_form';
var multipleCities = {{ multipleCities }};
var routesUrl = '/js/fos_js_routes{{ multipleCities ? '_city_prefixed' }}.json';
loadRoutes();
var myMap, clusterer;
ymaps.ready(function () {
myMap = new ymaps.Map('map', {
center: [cityLatitude, cityLongitude],
zoom: 9,
behaviors: ['default', 'scrollZoom']
}, {
searchControlProvider: 'yandex#search'
});
clusterer = new ymaps.Clusterer({
preset: 'islands#invertedVioletClusterIcons',//Через кластеризатор можно указать только стили кластеров,стили для меток нужно назначать каждой метке отдельно.
groupByCoordinates: false,//Ставим true, если хотим кластеризовать только точки с одинаковыми координатами.
//Опции кластеров указываем в кластеризаторе с префиксом \"cluster\".
clusterDisableClickZoom: true,
clusterHideIconOnBalloonOpen: false,
geoObjectHideIconOnBalloonOpen: false
});
// Можно менять опции кластеризатора после создания.
clusterer.options.set({
gridSize: 80,
clusterDisableClickZoom: true
});
loadForm();
});
function loadRoutes() {
\$.ajax({
url:routesUrl,
dataType: \"json\",
async: false,
success: function (routes) {
Routing.setRoutingData(routes);
},
error: function (xhr, ajaxOptions, thrownError) {}
});
}
function setFormSubmitListener() {
document.querySelector(\"form[name=\"+formName+\"]\").addEventListener('submit', function(e){
e.preventDefault();
if(!clusterer)
return;
filterData();
return false;
});
}
function loadForm() {
fetch('{{ path('map.form', {city: cityUriIdentity}) }}', {
mode: \"cors\",
importance: \"low\",
method: \"POST\",
headers: {
\"Content-Type\": \"application/x-www-form-urlencoded\",
\"X-Requested-With\": \"XMLHttpRequest\"
},
}).then(response => {
if (response.status < 300) {
return response.text();
} else {
console.warn(\"🤔\");
return null;
}
}).then(response => {
document.querySelector('#map_form').innerHTML = response;
filterData();
setFormSubmitListener();
});
}
function filterData() {
preloader.style.display = 'block';
var data = {};
\$(\"form[name=\"+formName+\"]\").serializeArray().forEach((object)=>{
//\"подгоняем\" данные под формат, ожидаемый формой при сабмите
var fieldName = object.name.toString().replace(formName + '[', '').replace(']', '');
var clearFieldName = fieldName.substr(0, fieldName.indexOf('['));
if(~fieldName.indexOf('[]')) {
checkArrayIsInFormObject(clearFieldName, data);
data[clearFieldName].push(object.value);
} else if(~fieldName.indexOf('[m')) {
if(!object.value)
return;
checkObjectIsInFormObject(clearFieldName, data);
if(~fieldName.indexOf('[min]'))
data[clearFieldName]['min'] = object.value;
if(~fieldName.indexOf('[max]'))
data[clearFieldName]['max'] = object.value;
} else {
data[fieldName] = object.value;
}
});
\$.ajax({
url:'{{ path('map.filter', {city:cityUriIdentity}) }}',
type: \"POST\",
dataType: \"json\",
data: {
\"form\": JSON.stringify(data),
},
async: true,
success: function (return_data) {
// console.log(return_data);
updateMap(return_data);
preloader.style.display = 'none';
},
error: function (xhr, ajaxOptions, thrownError) {}
});
}
function checkArrayIsInFormObject(name, formObject) {
if(false == formObject.hasOwnProperty(name))
formObject[name] = [];
}
function checkObjectIsInFormObject(name, formObject) {
if(false == formObject.hasOwnProperty(name))
formObject[name] = {};
}
function updateMap(points) {
clusterer.removeAll();
if(!points || !points.length)
return;
var getImgUrl = function(path, imgType) {
if(path[0] == '/')
return path;
var assetPackagePath = '';
if(imgType == 'avatar')
assetPackagePath = avatarPath;
else if(imgType == 'photo')
assetPackagePath = photoPath;
if(imgType == 'thumb')
assetPackagePath = thumbPath;
return assetPackagePath + path;
};
var getPointData = function (index) {
const data = points[index];
const isProfile = data[0] == 1;
const isSaloon = data[0] == 2;
let url = '';
const uri = data[3];
if(isProfile) {
url = RoutingDecorator.generate(
'profile_preview.page',
multipleCities ? {city: cityUriIdentity, profile: uri} : {profile: uri}
);
} else if(isSaloon) {
url = RoutingDecorator.generate(
'saloon_preview.page',
multipleCities ? {city: cityUriIdentity, saloon: uri} : {saloon: uri}
);
}
var processProfileShowsUrl = '{{ path('map.increment_profile_shows', multipleCities ? {city:cityUriIdentity} : {}) }}';
return {
balloonContentHeader: '',
balloonContentBody: '<p><img src=\"' + getImgUrl(data[5], isProfile ? 'avatar' : 'thumb') + '\" width=\"100\" /></p>' + '<font size=3><b><a target=\"_blank\" href=\"' + url + '\">Профиль</a></b></font>'
+ '<img style=\"display:none;\" width=\"0\" height=\"0\" src=\"' + processProfileShowsUrl + '?id=' + (isProfile ? data[9] : null)+'\" />', //не убирать, функционально важно
balloonContentFooter: '<font size=1>' + data[8] + ',' + data[9] + ',' + data[10] + '</strong>',
clusterCaption: '<strong>' + (isSaloon ? 'Салон ' : '') + data[4] + '</strong>'
};
};
var getPointOptions = function (index, type) {
return {
preset: type == 'profile' ? 'islands#violetIcon' : 'islands#redIcon'
};
};
var geoObjects = [];
for(var i = 0, len = points.length; i < len; i++)
geoObjects[i] = new ymaps.Placemark([points[i][1], points[i][2]], getPointData(i), getPointOptions(i, points[i][0] == 1));
//В кластеризатор можно добавить javascript-массив меток (не геоколлекцию) или одну метку.
clusterer.add(geoObjects);
myMap.geoObjects.add(clusterer);
// Спозиционируем карту так, чтобы на ней были видны все объекты.
myMap.setBounds(clusterer.getBounds(), {
checkZoomRange: true
});
}
});
})();
</script>
{% endblock %}", "Map/page.html.twig", "/app/templates/Map/page.html.twig");
}
}