Ejemplo n.º 1
0
    public static function createMap($isAppartment = false)
    {
        $baseUrl = Yii::app()->request->baseUrl;
        //Yii::app()->clientScript->registerScriptFile('http://cdn.leafletjs.com/leaflet-0.7/leaflet.js', CClientScript::POS_END);
        //Yii::app()->clientScript->registerCssFile('http://cdn.leafletjs.com/leaflet-0.7/leaflet.css');
        Yii::app()->clientScript->registerScriptFile($baseUrl . '/common/js/leaflet/leaflet-0.7.2/leaflet.js', CClientScript::POS_HEAD);
        Yii::app()->clientScript->registerCssFile($baseUrl . '/common/js/leaflet/leaflet-0.7.2/leaflet.css');
        Yii::app()->clientScript->registerScriptFile($baseUrl . '/common/js/leaflet/leaflet-0.7.2/dist/leaflet.markercluster-src.js', CClientScript::POS_HEAD);
        Yii::app()->clientScript->registerCssFile($baseUrl . '/common/js/leaflet/leaflet-0.7.2/dist/MarkerCluster.css');
        Yii::app()->clientScript->registerCssFile($baseUrl . '/common/js/leaflet/leaflet-0.7.2/dist/MarkerCluster.Default.css');
        self::$jsVars = '

		var mapOSMap;
		var markerClusterOSMap;

		var markersOSMap = [];
		var markersForClasterOSMap = [];
		var latLngList = [];

		';
        self::$jsCode = '

		var zoomOSMap = ' . ($isAppartment ? param('module_apartments_osmapsZoomApartment', 15) : param('module_apartments_osmapsZoomCity', 11)) . ';
		mapOSMap = L.map("osmap").setView([' . param('module_apartments_osmapsCenterY', 55.75411314653655) . ', ' . param('module_apartments_osmapsCenterX', 37.620717508911184) . '], zoomOSMap);

		L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", {
		attribution: "&copy; <a href=\'http://osm.org/copyright\'>OpenStreetMap</a> contributors"
		}).addTo(mapOSMap);

		';
    }
Ejemplo n.º 2
0
    public static function createMap($isAppartment = false)
    {
        self::$jsVars = '

		var mapOSMap;
		var markerClusterOSMap;

		var markersOSMap = [];
		var markersForClasterOSMap = [];
		var latLngList = [];

		';
        self::$jsCode = '

		var zoomOSMap = ' . ($isAppartment ? param('module_apartments_osmapsZoomApartment', 15) : param('module_apartments_osmapsZoomCity', 11)) . ';
		mapOSMap = L.map("osmap").setView([' . param('module_apartments_osmapsCenterY', 55.75411314653655) . ', ' . param('module_apartments_osmapsCenterX', 37.620717508911184) . '], zoomOSMap);

		L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", {
		attribution: "&copy; <a href=\'http://osm.org/copyright\'>OpenStreetMap</a> contributors"
		}).addTo(mapOSMap);

		';
    }