Browse Source

Ajout du module "Mappy", incompatible avec le module "Link"...

remotes/svn/ModulesALaMano
Chouchen 9 years ago
parent
commit
fd3c16dab2
8 changed files with 109 additions and 13 deletions
  1. +1
    -1
      ajax/loadReserve.php
  2. +3
    -3
      class/Links.php
  3. +47
    -0
      class/Mappy.php
  4. +2
    -0
      css/links.css
  5. +2
    -0
      css/mappy.css
  6. +16
    -5
      db/config.xml
  7. +4
    -4
      js/jquery.links.js
  8. +34
    -0
      js/mappy.js

+ 1
- 1
ajax/loadReserve.php View File

@@ -5,7 +5,7 @@ if($links_xml = simplexml_load_file('../'.links::LINKS_FILE)){
foreach($links as $label){
echo '<ul id="reserveiconlist">';
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> ';
}

+ 3
- 3
class/Links.php View File

@@ -17,10 +17,10 @@ class links {
if($links_xml = simplexml_load_file(self::LINKS_FILE)){
$links = $links_xml->label;
foreach($links as $label){
echo '<span class="label">'.$label['id'].'</span>
<ul class="iconlist" id="'.$label['id'].'">';
//<span class="label">'.$label['id'].'</span>
echo '<ul class="iconlist" id="'.$label['id'].'">';
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>
<hr>';


+ 47
- 0
class/Mappy.php View 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);
}
}
}
}

+ 2
- 0
css/links.css View File

@@ -71,6 +71,8 @@
}
ul.iconlist, ul#reserveiconlist {
display:block;
height:75px;
padding:5px;
list-style:none;
}


+ 2
- 0
css/mappy.css View File

@@ -0,0 +1,2 @@
#mymap{display:none;z-index:900;width:400px;height:400px;}
#myAdress{float:right; margin:12px 10px 0 0;}

+ 16
- 5
db/config.xml View File

@@ -8,8 +8,8 @@
<item id="weather">
<visibility>true</visibility>
<city>Paris</city>
<x>495</x>
<y>465</y>
<x>605</x>
<y>648</y>
</item>
<item id="notes">
<visibility>true</visibility>
@@ -27,8 +27,8 @@
</item>
<item id="todo">
<visibility>true</visibility>
<x>30</x>
<y>-4</y>
<x>32</x>
<y>-2</y>
</item>
<item id="clockAdvanced">
<visibility>true</visibility>
@@ -40,8 +40,19 @@
<color>#000</color>
</item>
<item id="rssblogs">
<visibility>true</visibility>
<visibility>false</visibility>
<x>478</x>
<y>73</y>
</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>

+ 4
- 4
js/jquery.links.js View File

@@ -20,19 +20,19 @@ $(document).ready(function(){
});
// Passage Reserve => Liste
$('#reserveiconlist .item').live('click', function(e){
$('#reserveiconlist .iconitem').live('click', function(e){
e.preventDefault();
$.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();
});
//Passage Liste => Reserve
$('.item').mouseover(function(){
$('.iconitem').mouseover(function(){
$(this).children('.deleteLink').show();
});
$('.item').mouseout(function(){
$('.iconitem').mouseout(function(){
$(this).children('.deleteLink').hide();
});


+ 34
- 0
js/mappy.js View 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…
Cancel
Save