window.events_page = 1;
function show_else_ann(page) {
if (page == undefined) {
page = window.events_page + 1;
}
window.events_page = page;
jQuery.ajax({
url: '<?= SITE_TEMPLATE_PATH; ?>/ajax/announces.php',
data: {
page: page,
code: '<?= $IBLOCK_CODE; ?>',
tab: jQuery('[data-tabs="ANNOUNCE"] .current').data('tab'),
per: <?= $PER; ?>,
date: 2,
<?php
if (isset($QUESTION) and $QUESTION) { ?>
question: 1,
<?php } ?>
href: '/announces/' <?= (isset($_REQUEST['ID']) ? ', id: ' . (int)$_REQUEST['ID'] : ''); ?>},
method: 'POST',
dataType: 'JSON',
success: function(data) {
if (data.items) {
var i = 0;
for (i in data.items) {
var tabidfix = jQuery('[data-tabs="ANNOUNCE"] .current').data('tab');
jQuery('#cann' +tabidfix+ ' .event_container_a').append(data.items[i]);
}
if (data.items.length != <?= $PER; ?>) {
jQuery('.show_else_a').hide();
}
}
if (data.items.length == 0) {
jQuery('.show_else_a').hide();
}
}
});
}
if (data.items.length == 0) {
jQuery('.show_else_a').hide();
}
ymaps.ready(init);
var myMap, myPlacemark;
function init(){
var myMap = new ymaps.Map('map', {
<?php
if (isset($maxCOORD1) and (abs($maxCOORD1) != 0)) { ?>
center: [<?= $maxCOORD1 + ($maxCOORD1 - $minCOORD1) / 2; ?>, <?= $minCOORD2 + ($minCOORD2 - $minCOORD2) / 2; ?>],
zoom: 12,
<?php } else { ?>
center: [35, 25],
zoom: 2,
<?php } ?>
controls: ['zoomControl'],
});
clusterer = new ymaps.Clusterer({
preset: 'islands#invertedVioletClusterIcons',
groupByCoordinates: false,
clusterDisableClickZoom: true,
clusterHideIconOnBalloonOpen: false,
geoObjectHideIconOnBalloonOpen: false
}),
getPointOptions = function () {
return {
preset: 'islands#violetIcon'
};
var items = <?= json_encode($items); ?>;
for (i in items) {
var item = items[i];
if (item.coord != false) {
var layout = ymaps.templateLayoutFactory.createClass('<div class="placemark_layout_container"><div title="' + item.hint + '" class="circle_layout hint' + item.id + '"></div>');
myPlacemark = new ymaps.Placemark(
item.coord, {
hintContent: item.hint,
balloonContent: item.content
}, {
iconLayout: layout,
iconShape: {
type: 'Circle',
coordinates: [0,0],
radius: 22
}
});
geoObjects[i] = new ymaps.myPlacemark(points[i], getPointData(i), getPointOptions());
}
}
clusterer.options.set({
gridSize: 80,
clusterDisableClickZoom: true
});
clusterer.add(geoObjects);
myMap.geoObjects.add(clusterer);
myMap.setBounds(clusterer.getBounds(), {
checkZoomRange: true
});
}
}