Your IP : 216.73.216.84


Current Path : /home/helpink/www/components/com_jbusinessdirectory/views/events/tmpl/
Upload File :
Current File : /home/helpink/www/components/com_jbusinessdirectory/views/events/tmpl/map.php

<?php
/**
 * @package    J-BusinessDirectory
 *
 * @author     CMSJunkie http://www.cmsjunkie.com/
 * @copyright  Copyright (C) 2007 - 2022 CMSJunkie. All rights reserved.
 * @license    https://www.gnu.org/licenses/agpl-3.0.en.html
 */
defined ( '_JEXEC' ) or die ( 'Restricted access' );

if (! defined ( 'BD_COMPONENT_IMAGE_PATH' ))
	define ( "BD_COMPONENT_IMAGE_PATH", BD_ASSETS_FOLDER_PATH."images/" );

$appSettings = JBusinessUtil::getApplicationSettings();
$lang        = JBusinessUtil::getLanguageTag();
$key         = JBusinessUtil::loadMapScripts();

$map_latitude = ( float ) $appSettings->map_latitude;
$map_longitude = ( float ) $appSettings->map_longitude;
$map_apply_search = $appSettings->map_apply_search;

$map_latitude = ( float ) $appSettings->map_latitude;
$map_longitude = ( float ) $appSettings->map_longitude;
$map_zoom = ( float ) $appSettings->map_zoom;

if ((empty ( $map_latitude )) || (! is_numeric ( $map_latitude )))
	$map_latitude = 43.749156;

if ((empty ( $map_longitude )) || (! is_numeric ( $map_longitude )))
	$map_longitude = - 79.411048;

if ((empty ( $map_zoom )) || (! is_numeric ( $map_zoom ))) {
    $map_zoom = 6;
}

$session = JFactory::getSession();
if (empty($radius)) {
	$radius = JFactory::getApplication()->input->get("radius");
    if (empty($radius)) {
        $radius = $session->get("radius");
    }
}

if ($appSettings->enable_map_clustering) {
    JBusinessUtil::enqueueScript('libraries/map/markercluster.js');
}

$mapId = rand ( 1000, 10000 );

$event_locations = array();
if(!empty($this->events)){
	$event_locations = JBusinessUtil::prepareEventsMapLocations($this->events);
}

// the params array that will be used on map.js
$initparams = array ();
$initparams ["tmapId"] = $mapId;
$initparams ["map_div"] = 'events-map-';
$initparams ["map_latitude"] = ! empty ( $map_latitude ) ? $map_latitude : 0;
$initparams ["map_longitude"] = ! empty ( $map_longitude ) ? $map_longitude : 0;
$initparams ["map_zoom"] = $map_zoom;
$initparams ["has_location"] = (isset($this) && ! empty($this->location ["latitude"])) ? 1 : 0;
$initparams ["radius"] = ! empty ( $radius ) && isset($this) && !empty($this->location["latitude"]) ? $radius : 0;
$initparams ["imagePath"] = BD_COMPONENT_IMAGE_PATH;
$initparams ["longitude"] = '';
$initparams ["latitude"] = '';

if (isset ( $this ) && ! empty ( $this->location["latitude"] )) {
	$initparams ["longitude"] = $this->location["longitude"];
	$initparams ["latitude"] = $this->location["latitude"];
}

if ($appSettings->map_type == MAP_TYPE_BING) {
	$initparams["key"] = $key;
}
?>
<div id="events-map-<?php echo $mapId ?>" style="position: relative;"></div>

<script>
    var mapInstance;

    window.addEventListener('load', function() {
        mapInstance = JBDMapHelper.loadMapScript(
		    <?php echo json_encode($event_locations) ?>,
		    <?php echo json_encode($initparams) ?>,
		    <?php echo $appSettings->map_type ?>
        );
    });
</script>

<?php echo JBusinessUtil::getMapGDPRModal(); ?>