parent
45f726b537
commit
835fbf8a46
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
class mappy extends Module {
|
||||
protected $moduleTitle = 'Mappy';
|
||||
protected $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public function __construct($params){
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
|
||||
echo '<script src="http://axe.mappy.com/1v1/init/get.aspx?version=2.01&solution=ajax&auth=HbTTpMfC4//GWuldL2IsF+HJA4xVuTBsIQi0wcC7xRz+e17hobrJ+1947aq34rdjYAPy6nBYBQF8o56Qzdun9w=="></script>
|
||||
<div id="mymap"></div>
|
||||
<div id="myAdress"><input type="text" name="myAdressField" id="myAdressField" /></div>';
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
#mymap{display:none;z-index:900;width:400px;height:400px;}
|
||||
#myAdress{float:right; margin:12px 10px 0 0;}
|
@ -1,34 +0,0 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#menu-bar').append($('#myAdress'));
|
||||
$('#myAdressField').keydown(function(e){
|
||||
var code = (e.keyCode ? e.keyCode : e.which);
|
||||
if(code == 13) {
|
||||
var adress = $(this).val();
|
||||
geocode(adress);
|
||||
$('#mymap').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function geocode (addr)
|
||||
{
|
||||
var geo = new Mappy.api.geolocation.Geocoder();
|
||||
geo.geocode(addr, function (results)
|
||||
{
|
||||
var map = new Mappy.api.map.Map({
|
||||
container:"#mymap"
|
||||
});
|
||||
var scalePosition = new Mappy.api.map.tools.ToolPosition('lb', new Mappy.api.types.Point(10, 0));
|
||||
var scale = new Mappy.api.map.tools.Scale(scalePosition);
|
||||
map.addTool(scale);
|
||||
var latitude = results[0].Placemark.Point.coordinates[0];
|
||||
var longitude = results[0].Placemark.Point.coordinates[1];
|
||||
var markerLayer = new Mappy.api.map.layer.MarkerLayer(40);
|
||||
map.addLayer(markerLayer);
|
||||
var icon = new Mappy.api.ui.Icon(Mappy.api.ui.Icon.DEFAULT);
|
||||
var marker = new Mappy.api.map.Marker(new Mappy.api.geo.Coordinates(latitude, longitude), icon);
|
||||
markerLayer.addMarker(marker);
|
||||
map.setCenter(new Mappy.api.geo.Coordinates(latitude,longitude),7);
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user