<?php /* Smarty version Smarty-3.1.19, created on 2018-10-13 22:46:48
         compiled from "module:clients_on_map/block.clients_on_map.tpl" */ ?>
<?php /*%%SmartyHeaderCode:13149166045bc259b8036ce6-39384987%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '7782f1c2934ebc53d2748b26f05e78c695adae5b' => 
    array (
      0 => 'module:clients_on_map/block.clients_on_map.tpl',
      1 => 1521775270,
      2 => 'module',
    ),
  ),
  'nocache_hash' => '13149166045bc259b8036ce6-39384987',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'clients_on_map' => 0,
    'core' => 0,
    'entry' => 0,
    'content' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.19',
  'unifunc' => 'content_5bc259b809aa94_26741830',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5bc259b809aa94_26741830')) {function content_5bc259b809aa94_26741830($_smarty_tpl) {?><?php if ($_smarty_tpl->tpl_vars['clients_on_map']->value) {?>
    <div id="map" style=" width: <?php echo $_smarty_tpl->tpl_vars['core']->value['config']['clients_on_map_width'];?>
; height: <?php echo $_smarty_tpl->tpl_vars['core']->value['config']['clients_on_map_height'];?>
"></div>
    <?php switch ($_smarty_tpl->tpl_vars['core']->value['config']['clients_on_map_type']){?>
<?php case 'google_maps':?>
            <script type="text/javascript" src="https://maps.google.com/maps/api/js?key=<?php echo $_smarty_tpl->tpl_vars['core']->value['config']['maps_api_key'];?>
"></script>
            <script>
                function initialize() {
                    var myOptions = {
                        <?php if (count($_smarty_tpl->tpl_vars['clients_on_map']->value)>1) {?>
                            center: new google.maps.LatLng(0, 0),
                        <?php } else { ?>
                            center: new google.maps.LatLng(<?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lat'];?>
, <?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lng'];?>
),
                        <?php }?>
                        zoom: <?php echo $_smarty_tpl->tpl_vars['core']->value['config']['clients_on_map_zoom'];?>
,
                        styles: <?php echo $_smarty_tpl->tpl_vars['core']->value['config']['clients_on_map_style'];?>
,
                        scrollwheel: false
                    };

                    var map = new google.maps.Map(document.getElementById("map"), myOptions);
                    var bounds = new google.maps.LatLngBounds();

                    <?php  $_smarty_tpl->tpl_vars['entry'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['entry']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['clients_on_map']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['entry']->key => $_smarty_tpl->tpl_vars['entry']->value) {
$_smarty_tpl->tpl_vars['entry']->_loop = true;
?>
                        <?php if (empty($_smarty_tpl->tpl_vars['entry']->value['address'])) {?>
                            <?php $_smarty_tpl->tpl_vars["content"] = new Smarty_variable("<strong>".((string)$_smarty_tpl->tpl_vars['entry']->value['fullname'])."</strong>", null, 0);?>
                        <?php } else { ?>
                            <?php $_smarty_tpl->tpl_vars["content"] = new Smarty_variable("<strong>".((string)$_smarty_tpl->tpl_vars['entry']->value['fullname'])."</strong><br>".((string)$_smarty_tpl->tpl_vars['entry']->value['address']), null, 0);?>
                        <?php }?>
                        var item<?php echo $_smarty_tpl->tpl_vars['entry']->value['id'];?>
 = new google.maps.LatLng(<?php echo $_smarty_tpl->tpl_vars['entry']->value['lat'];?>
, <?php echo $_smarty_tpl->tpl_vars['entry']->value['lng'];?>
);
                        var marker<?php echo $_smarty_tpl->tpl_vars['entry']->value['id'];?>
 = new google.maps.Marker({
                            position: item<?php echo $_smarty_tpl->tpl_vars['entry']->value['id'];?>
,
                            map: map,
                            title: '<?php echo $_smarty_tpl->tpl_vars['entry']->value['fullname'];?>
',
                            icon: '<?php echo @constant('IA_CLEAR_URL');?>
modules/clients_on_map/templates/front/img/marker.png',
                            info: new google.maps.InfoWindow({
                                content: <?php echo json_encode($_smarty_tpl->tpl_vars['content']->value);?>

                            })
                        });
                        bounds.extend(item<?php echo $_smarty_tpl->tpl_vars['entry']->value['id'];?>
);

                        google.maps.event.addListener(marker<?php echo $_smarty_tpl->tpl_vars['entry']->value['id'];?>
, 'click', function() {
                            marker<?php echo $_smarty_tpl->tpl_vars['entry']->value['id'];?>
.info.open(map, marker<?php echo $_smarty_tpl->tpl_vars['entry']->value['id'];?>
);
                        });
                    <?php } ?>

                    <?php if (count($_smarty_tpl->tpl_vars['clients_on_map']->value)>1) {?>
                        map.fitBounds(bounds);
                    <?php }?>
                }

                initialize();
            </script>
        <?php break;?>

        <?php case 'yandex_maps':?>

            <script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
            <script type="text/javascript">
                ymaps.ready(init);

                var myMap,
                    myPlacemark;

                function init(){
                    var optionsMarkerImage;
                    optionsMarkerImage =
                    {
                        iconLayout: 'default#image',
                        iconImageHref: '<?php echo @constant('IA_CLEAR_URL');?>
modules/clients_on_map/templates/front/img/marker.png',
                        iconImageSize: [30, 39],

                    };
                    <?php if (count($_smarty_tpl->tpl_vars['clients_on_map']->value)>1) {?>
                        var myCollection = new ymaps.GeoObjectCollection();
                        myMap = new ymaps.Map("map", {
                            center: [<?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lat'];?>
, <?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lng'];?>
],
                            zoom: <?php echo $_smarty_tpl->tpl_vars['core']->value['config']['clients_on_map_zoom'];?>
,
                            controls: ['zoomControl']
                            });
                        <?php  $_smarty_tpl->tpl_vars['entry'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['entry']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['clients_on_map']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['entry']->key => $_smarty_tpl->tpl_vars['entry']->value) {
$_smarty_tpl->tpl_vars['entry']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['entry']->key;
?>
                            myPlacemark = new ymaps.Placemark([<?php echo $_smarty_tpl->tpl_vars['entry']->value['lat'];?>
, <?php echo $_smarty_tpl->tpl_vars['entry']->value['lng'];?>
], {

                                hintContent: '<?php echo $_smarty_tpl->tpl_vars['entry']->value['fullname'];?>
',
                                balloonContent: '<strong><?php echo $_smarty_tpl->tpl_vars['entry']->value['fullname'];?>
</strong><?php if ($_smarty_tpl->tpl_vars['entry']->value['address']) {?><p><?php echo $_smarty_tpl->tpl_vars['entry']->value['address'];?>
</p><?php }?>'}, optionsMarkerImage
                                );
                            myCollection.add(myPlacemark);

                        <?php } ?>
                        myMap.geoObjects.add(myCollection);
                        myMap.setBounds( myCollection.getBounds() );
                    <?php } else { ?>
                        myMap = new ymaps.Map("map", {
                            center: [<?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lat'];?>
, <?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lng'];?>
],
                            zoom: <?php echo $_smarty_tpl->tpl_vars['core']->value['config']['clients_on_map_zoom'];?>
,
                        });
                        myPlacemark = new ymaps.Placemark([<?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lat'];?>
, <?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lng'];?>
], {
                            hintContent: '<?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['fullname'];?>
',
                            balloonContent: '<strong><?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['fullname'];?>
</strong><?php if ($_smarty_tpl->tpl_vars['clients_on_map']->value[0]['address']) {?><p><?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['address'];?>
</p><?php }?>'},	optionsMarkerImage
                        );
                        myMap.geoObjects.add(myPlacemark);
                    <?php }?>
                }
            </script>
        <?php break;?>

        <?php case '2gis':?>
            <script src="http://maps.api.2gis.ru/2.0/loader.js?pkg=full"></script>
            <script type="text/javascript">
                var map,
                    optionsMarker;

                optionsMarker =
                {
                    iconUrl: '<?php echo @constant('IA_CLEAR_URL');?>
modules/clients_on_map/templates/front/img/marker.png',
                    iconSize: [30, 39],
                }

                <?php if (count($_smarty_tpl->tpl_vars['clients_on_map']->value)>1) {?>
                    DG.then(function(){
                        var markers = DG.featureGroup(),
                            coordinates = [];
                        map = DG.map('map', {
                            center: [<?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lat'];?>
, <?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lng'];?>
],
                            zoom: <?php echo $_smarty_tpl->tpl_vars['core']->value['config']['clients_on_map_zoom'];?>
,
                        });
                        <?php  $_smarty_tpl->tpl_vars['entry'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['entry']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['clients_on_map']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['entry']->key => $_smarty_tpl->tpl_vars['entry']->value) {
$_smarty_tpl->tpl_vars['entry']->_loop = true;
?>

                            var myIcon = DG.icon(optionsMarker);
                            coordinates[0] = <?php echo $_smarty_tpl->tpl_vars['entry']->value['lat'];?>
;
                            coordinates[1] = <?php echo $_smarty_tpl->tpl_vars['entry']->value['lng'];?>
;
                            DG.marker(coordinates, {icon: myIcon}).addTo(markers).bindPopup('<strong><?php echo $_smarty_tpl->tpl_vars['entry']->value['fullname'];?>
</strong><?php if ($_smarty_tpl->tpl_vars['entry']->value['address']) {?><p><?php echo $_smarty_tpl->tpl_vars['entry']->value['address'];?>
</p><?php }?>');;

                        <?php } ?>

                        markers.addTo(map);
                        map.fitBounds(markers.getBounds());
                    });
                <?php } else { ?>
                    DG.then(function () {
                        var myIcon = DG.icon(optionsMarker);

                        map = DG.map('map', {
                            center: [<?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lat'];?>
, <?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lng'];?>
],
                            zoom: <?php echo $_smarty_tpl->tpl_vars['core']->value['config']['clients_on_map_zoom'];?>

                        });

                        DG.marker([<?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lat'];?>
, <?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['lng'];?>
], {icon: myIcon}).addTo(map).bindPopup('<strong><?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['fullname'];?>
</strong><?php if ($_smarty_tpl->tpl_vars['clients_on_map']->value[0]['address']) {?><p><?php echo $_smarty_tpl->tpl_vars['clients_on_map']->value[0]['address'];?>
</p><?php }?>');
                    });
                <?php }?>
            </script>
        <?php break;?>
    <?php }?>
<?php }?>
<?php }} ?>
