Accueil/class/Mappy.php

47 lines
1.3 KiB
PHP
Raw Normal View History

<?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);
}
}
}
}