| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/dijon/modules/mod_djclassifieds_maps/tmpl/ |
Upload File : |
<?php
/**
* @package DJ-Classifieds
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
defined ('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();
$par = JComponentHelper::getParams('com_djclassifieds');
if($params->get('layout','cluster') == 'cluster'){
$document->addScript(JURI::base(true).'/components/com_djclassifieds/assets/mapclustering/src/markerclusterer.js');
}
$map_styles = trim($params->get('gm_styles','')) ? $params->get('gm_styles') : '[{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]}]';
?>
<div id="mod_djcf_search<?php echo $module->id; ?>" class="dj_cf_maps">
<?php if($params->get('enable_places_search',0)){ ?>
<div class="djmod_map_places_search">
<span id="user_pos<?php echo $module->id; ?>" class="user_pos"></span>
<input id="pac-input<?php echo $module->id; ?>" class="controls pac-input" type="text" placeholder="<?php echo JText::_('MOD_DJCLASSIFIEDS_MAPS_ENTER_LOCATION'); ?>">
<div class="clear_both"></div>
</div>
<?php } ?>
<div id="djmod_map_box<?php echo $module->id; ?>" style="display:none;">
<div id="djmod_map<?php echo $module->id; ?>" class="djmod_map" style="width:<?php echo $params->get('map_width'); ?>;height:<?php echo $params->get('map_height'); ?>;border:1px solid #666;"></div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function(){
if(typeof google !== 'undefined' && typeof google.maps !== 'undefined'){
djmodMapStart<?php echo $module->id; ?>();
<?php if($params->get('enable_places_search',0)){ ?>
djmodMapPlacesSearch<?php echo $module->id; ?>();
getmodMAPDJLocation<?php echo $module->id; ?>();
<?php } ?>
}else{
console.error('Google Maps API not available');
}
});
if(typeof google !== 'undefined' && typeof google.maps !== 'undefined'){
var djmap<?php echo $module->id; ?>;
var djmarker<?php echo $module->id; ?> = new google.maps.InfoWindow();
var djgeocoder<?php echo $module->id; ?> = new google.maps.Geocoder();
var djmarkers<?php echo $module->id; ?> = new Array();
var djbounds<?php echo $module->id; ?> = new google.maps.LatLngBounds();
}
function djmodMarker(position,txt,icon)
{
var MarkerOptions =
{
position: position,
icon: icon
}
var marker = new google.maps.Marker(MarkerOptions);
marker.txt = txt;
google.maps.event.addListener(marker,"click",function()
{
djmarker<?php echo $module->id; ?>.setContent(marker.txt);
djmarker<?php echo $module->id; ?>.open(djmap<?php echo $module->id; ?>,marker);
});
djbounds<?php echo $module->id; ?>.extend(marker.getPosition());
return marker;
}
function djmodMapStart<?php echo $module->id; ?>()
{
djgeocoder<?php echo $module->id; ?>.geocode({address: '<?php echo $params->get('start_address'); ?>'}, function (results, status){
document.getElementById("djmod_map_box<?php echo $module->id; ?>").style.display='block';
<?php if($center_coords){ ?>
var map_center = new google.maps.LatLng(<?php echo $center_coords['lat'].','.$center_coords['lng']; ?>);
<?php }else if($advert){ ?>
var map_center = new google.maps.LatLng(<?php echo $advert->latitude.','.$advert->longitude; ?>);
<?php }else{ ?>
var map_center = status == google.maps.GeocoderStatus.OK ? results[0].geometry.location : new google.maps.LatLng(51.5287718,-0.241682);
<?php } ?>
var mapOpts = {
zoom: <?php echo $params->get('start_zoom'); ?>,
center: map_center,
mapTypeId: google.maps.MapTypeId.<?php echo $params->get('gm_type','ROADMAP'); ?>,
navigationControl: <?php echo $params->get('enable_zoom','true'); ?>,
scrollwheel: <?php echo $params->get('enable_scrolling','true'); ?>,
styles:<?php echo $map_styles; ?>
};
djmap<?php echo $module->id; ?> = new google.maps.Map(document.getElementById("djmod_map<?php echo $module->id; ?>"), mapOpts);
<?php foreach($items as $item){ ?>
<?php
$icon_size = !empty($item->marker_img) ? getimagesize(JPATH_ROOT.'/'.$item->marker_img) : array('','');
$icon_img = !empty($item->marker_img) ? JUri::root().$item->marker_img : '';
?>
<?php if($icon_img){ ?>
var size = new google.maps.Size(<?php echo $icon_size[0].','.$icon_size[1]; ?>);
var start_point = new google.maps.Point(0,0);
var anchor_point = new google.maps.Point(<?php echo ($icon_size[0]/2).','.$icon_size[1]; ?>);
var icon = new google.maps.MarkerImage("<?php echo $icon_img; ?>", size, start_point, anchor_point);
<?php }else{ ?>
var icon = '';
<?php } ?>
<?php
$marker_txt = '<div style="width:200px;margin-bottom:0px"><div style="margin-bottom:5px;">';
$marker_txt .= '<a style="text-decoration:none !important;" href="'.JRoute::_($item->item_uri, false).' ">';
if(!empty($item->images)){
$marker_txt .= '<img style="float:left;margin:5px 10px 0 0;" width="60px" src="'.JURI::base().$item->images[0]->thumb_s.'" /> ';
}
$marker_txt .= '<strong>'.addslashes($item->name).'</strong>'.(!empty($item->p_verified) ? '<span class="verified_icon" title="'.JText::_('COM_DJCLASSIFIEDS_VERIFIED_SELLER').'"></span>' : '').($item->published==2 ? '<span class="archived_icon" title="'.JText::_('COM_DJCLASSIFIEDS_ARCHIVE_ADVERT').'"></span>' : '');
$marker_txt .= $item->intro_desc ? '<br /><span style="color:#333333">'.addslashes(str_replace(array("\n","\r","\r\n"), '',$item->intro_desc)).'</span>' : '';
$marker_txt .='</a></div></div>';
?>
<?php if(floatval($item->latitude) && floatval($item->longitude)){ ?>
var adLatlng = new google.maps.LatLng(<?php echo $item->latitude.','.$item->longitude; ?>);
djmarkers<?php echo $module->id; ?>.push(djmodMarker(adLatlng,'<?php echo $marker_txt; ?>',icon));
<?php } ?>
<?php } ?>
<?php if($params->get('layout','cluster') == 'cluster'){ ?>
var mcOptions = {gridSize: 50, maxZoom: 14,styles: [{
height: 53,url: "<?php echo JURI::base()?>components/com_djclassifieds/assets/mapclustering/images/m1.png",width: 53},
{height: 56,url: "<?php echo JURI::base()?>components/com_djclassifieds/assets/mapclustering/images/m2.png",width: 56},
{height: 66,url: "<?php echo JURI::base()?>components/com_djclassifieds/assets/mapclustering/images/m3.png",width: 66},
{height: 78,url: "<?php echo JURI::base()?>components/com_djclassifieds/assets/mapclustering/images/m4.png",width: 78},
{height: 90,url: "<?php echo JURI::base()?>components/com_djclassifieds/assets/mapclustering/images/m5.png",width: 90}]};
var markerCluster = new MarkerClusterer(djmap<?php echo $module->id; ?>, djmarkers<?php echo $module->id; ?>,mcOptions);
<?php }else{ ?>
djmarkers<?php echo $module->id; ?>.forEach(function(marker){
marker.setMap(djmap<?php echo $module->id; ?>);
});
<?php } ?>
<?php if($params->get('fit_to_items', '0')){ ?>
var obj = djbounds<?php echo $module->id; ?>;
var obj_in = obj[Object.keys(obj)[0]];
if(obj_in[Object.keys(obj_in)[1]] != -1){
djmap<?php echo $module->id; ?>.fitBounds(djbounds<?php echo $module->id; ?>);
}
<?php } ?>
});
}
<?php if($params->get('enable_places_search',0)){ ?>
function djmodMapPlacesSearch<?php echo $module->id; ?>()
{
var input = (document.getElementById('pac-input<?php echo $module->id; ?>'));
var aut_options = '';
<?php if($params->get('api_country','')!=''){ ?>
var aut_options = {
componentRestrictions: {country: '<?php echo $params->get('api_country',''); ?>'}
};
<?php } ?>
var autocomplete = new google.maps.places.Autocomplete(input,aut_options);
var infowindow = new google.maps.InfoWindow();
var last_place = '';
google.maps.event.addListener(autocomplete, 'place_changed', function() {
var place = autocomplete.getPlace(); //to get first on enter
if (!place.geometry) {
return;
}
if(place.geometry.viewport){
djmap<?php echo $module->id; ?>.fitBounds(place.geometry.viewport);
}else{
djmap<?php echo $module->id; ?>.setCenter(place.geometry.location);
}
});
}
function getmodMAPDJLocation<?php echo $module->id; ?>()
{
document.getElementById('user_pos<?php echo $module->id; ?>').addEventListener('click', function(event){
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(modMAPShowDJPosition<?php echo $module->id; ?>);
}
})
}
function modMAPShowDJPosition<?php echo $module->id; ?>(position)
{
setDJLocationCookie(position);
var userLatlng = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
djmap<?php echo $module->id; ?>.setCenter(userLatlng);
}
<?php } ?>
<?php if($params->get('start_geoloc','0')==1){ ?>
document.addEventListener('DOMContentLoaded', function(){
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(modSearchShowDJPosition<?php echo $module->id; ?>,
function(error){
console.log(error);
}, {
timeout: 30000, enableHighAccuracy: true, maximumAge: 90000
});
}
});
function modSearchShowDJPosition<?php echo $module->id; ?>(position)
{
var userLatlng = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
djmap<?php echo $module->id; ?>.setCenter(userLatlng);
}
<?php } ?>
</script>