Ajout du module "Mappy", incompatible avec le module "Link"...
This commit is contained in:
parent
2a7b957440
commit
fd3c16dab2
@ -5,7 +5,7 @@ if($links_xml = simplexml_load_file('../'.links::LINKS_FILE)){
|
|||||||
foreach($links as $label){
|
foreach($links as $label){
|
||||||
echo '<ul id="reserveiconlist">';
|
echo '<ul id="reserveiconlist">';
|
||||||
foreach($label->link as $link){
|
foreach($label->link as $link){
|
||||||
echo '<li class="item" id="'.$link->title.'"><img src="images/interface/delete.png" class="deleteLink" /><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
|
echo '<li class="iconitem" id="'.$link->title.'"><img src="images/interface/delete.png" class="deleteLink" /><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
|
||||||
}
|
}
|
||||||
echo '</ul> ';
|
echo '</ul> ';
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,10 @@ class links {
|
|||||||
if($links_xml = simplexml_load_file(self::LINKS_FILE)){
|
if($links_xml = simplexml_load_file(self::LINKS_FILE)){
|
||||||
$links = $links_xml->label;
|
$links = $links_xml->label;
|
||||||
foreach($links as $label){
|
foreach($links as $label){
|
||||||
echo '<span class="label">'.$label['id'].'</span>
|
//<span class="label">'.$label['id'].'</span>
|
||||||
<ul class="iconlist" id="'.$label['id'].'">';
|
echo '<ul class="iconlist" id="'.$label['id'].'">';
|
||||||
foreach($label->link as $link){
|
foreach($label->link as $link){
|
||||||
echo '<li class="item" id="'.$link->title.'"><img src="images/interface/delete.png" class="deleteLink" /><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
|
echo '<li class="iconitem" id="'.$link->title.'"><img src="images/interface/delete.png" class="deleteLink" /><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
|
||||||
}
|
}
|
||||||
echo '</ul>
|
echo '</ul>
|
||||||
<hr>';
|
<hr>';
|
||||||
|
47
class/Mappy.php
Normal file
47
class/Mappy.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
class mappy extends Module {
|
||||||
|
|
||||||
|
protected static $paramsList = array(
|
||||||
|
'visibility'
|
||||||
|
);
|
||||||
|
|
||||||
|
public $params = array();
|
||||||
|
|
||||||
|
public function __construct($params){
|
||||||
|
$this->setParams($params);
|
||||||
|
echo '<script src="http://axe.mappy.com/1v1/init/get.aspx?version=2.01&solution=ajax&auth=HbTTpMfC4//GWuldL2IsF+HJA4xVuTBsIQi0wcC7xRz+e17hobrJ+1947aq34rdjYAPy6nBYBQF8o56Qzdun9w=="></script>
|
||||||
|
<script type="text/javascript" src="js/mappy.js"></script>
|
||||||
|
<link type="text/css" rel="stylesheet" href="css/mappy.css" />
|
||||||
|
<div id="mymap"></div>
|
||||||
|
<div id="myAdress"><input type="text" name="myAdressField" id="myAdressField" /></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setParams($params){
|
||||||
|
$this->params = $params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function start($params){
|
||||||
|
|
||||||
|
$mappy = new mappy($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setVisibility($visibility){
|
||||||
|
// Saving the position and z-index of the note:
|
||||||
|
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||||
|
|
||||||
|
$path = $xmla->xpath("//item[@id='mappy']");
|
||||||
|
$path[0]->visibility = $visibility;
|
||||||
|
|
||||||
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||||
|
|
||||||
|
echo "ok";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updateConfig($updated){
|
||||||
|
foreach ($updated as $what=>$withWhat){
|
||||||
|
if(in_array($what, self::$paramsList)){
|
||||||
|
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -71,6 +71,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
ul.iconlist, ul#reserveiconlist {
|
ul.iconlist, ul#reserveiconlist {
|
||||||
|
display:block;
|
||||||
|
height:75px;
|
||||||
padding:5px;
|
padding:5px;
|
||||||
list-style:none;
|
list-style:none;
|
||||||
}
|
}
|
||||||
|
2
css/mappy.css
Normal file
2
css/mappy.css
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#mymap{display:none;z-index:900;width:400px;height:400px;}
|
||||||
|
#myAdress{float:right; margin:12px 10px 0 0;}
|
@ -8,8 +8,8 @@
|
|||||||
<item id="weather">
|
<item id="weather">
|
||||||
<visibility>true</visibility>
|
<visibility>true</visibility>
|
||||||
<city>Paris</city>
|
<city>Paris</city>
|
||||||
<x>495</x>
|
<x>605</x>
|
||||||
<y>465</y>
|
<y>648</y>
|
||||||
</item>
|
</item>
|
||||||
<item id="notes">
|
<item id="notes">
|
||||||
<visibility>true</visibility>
|
<visibility>true</visibility>
|
||||||
@ -27,8 +27,8 @@
|
|||||||
</item>
|
</item>
|
||||||
<item id="todo">
|
<item id="todo">
|
||||||
<visibility>true</visibility>
|
<visibility>true</visibility>
|
||||||
<x>30</x>
|
<x>32</x>
|
||||||
<y>-4</y>
|
<y>-2</y>
|
||||||
</item>
|
</item>
|
||||||
<item id="clockAdvanced">
|
<item id="clockAdvanced">
|
||||||
<visibility>true</visibility>
|
<visibility>true</visibility>
|
||||||
@ -40,8 +40,19 @@
|
|||||||
<color>#000</color>
|
<color>#000</color>
|
||||||
</item>
|
</item>
|
||||||
<item id="rssblogs">
|
<item id="rssblogs">
|
||||||
<visibility>true</visibility>
|
<visibility>false</visibility>
|
||||||
<x>478</x>
|
<x>478</x>
|
||||||
<y>73</y>
|
<y>73</y>
|
||||||
</item>
|
</item>
|
||||||
|
<item id="news">
|
||||||
|
<visibility>false</visibility>
|
||||||
|
</item>
|
||||||
|
<item id="ouifm">
|
||||||
|
<visibility>true</visibility>
|
||||||
|
<x>500</x>
|
||||||
|
<y>10</y>
|
||||||
|
</item>
|
||||||
|
<item id="mappy">
|
||||||
|
<visibility>true</visibility>
|
||||||
|
</item>
|
||||||
</Config>
|
</Config>
|
||||||
|
@ -20,19 +20,19 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Passage Reserve => Liste
|
// Passage Reserve => Liste
|
||||||
$('#reserveiconlist .item').live('click', function(e){
|
$('#reserveiconlist .iconitem').live('click', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$.post("ajax/reserveToList.php", {reserve: $(this).attr('id')});
|
$.post("ajax/reserveToList.php", {reserve: $(this).attr('id')});
|
||||||
$('.iconlist').last().append('<li class="item" id="'+$(this).attr('id')+'">'+$(this).html()+'</li>');
|
$('.iconlist').last().append('<li class="iconitem" id="'+$(this).attr('id')+'">'+$(this).html()+'</li>');
|
||||||
$.fancybox.close();
|
$.fancybox.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//Passage Liste => Reserve
|
//Passage Liste => Reserve
|
||||||
$('.item').mouseover(function(){
|
$('.iconitem').mouseover(function(){
|
||||||
$(this).children('.deleteLink').show();
|
$(this).children('.deleteLink').show();
|
||||||
});
|
});
|
||||||
$('.item').mouseout(function(){
|
$('.iconitem').mouseout(function(){
|
||||||
$(this).children('.deleteLink').hide();
|
$(this).children('.deleteLink').hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
34
js/mappy.js
Normal file
34
js/mappy.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
$(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