2010-09-15 16:55:54 +02:00
|
|
|
<?php
|
|
|
|
class links {
|
2010-09-20 11:40:27 +02:00
|
|
|
|
|
|
|
protected static $paramsList = array(
|
|
|
|
'visibility'
|
|
|
|
);
|
|
|
|
|
2010-09-21 16:00:04 +02:00
|
|
|
const LINKS_FILE = 'db/links.xml';
|
|
|
|
|
2010-09-20 11:40:27 +02:00
|
|
|
public $params = array();
|
2010-09-15 16:55:54 +02:00
|
|
|
|
|
|
|
public function __construct($params){
|
|
|
|
$this->setParams($params);
|
2010-09-21 16:00:04 +02:00
|
|
|
echo '<script type="text/javascript" src="js/jquery.links.js"></script>
|
2010-09-23 12:59:56 +02:00
|
|
|
<link rel="stylesheet" href="css/links.css" type="text/css" />
|
2010-09-21 16:00:04 +02:00
|
|
|
<div class="appscontainer">';
|
|
|
|
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'].'">';
|
|
|
|
foreach($label->link as $link){
|
2010-09-23 15:02:42 +02:00
|
|
|
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>';
|
2010-09-21 16:00:04 +02:00
|
|
|
}
|
|
|
|
echo '</ul>
|
|
|
|
<hr>';
|
|
|
|
}
|
2010-09-21 17:09:31 +02:00
|
|
|
}else{
|
|
|
|
echo 'Can\'t find '.self::LINKS_FILE;
|
2010-09-21 16:00:04 +02:00
|
|
|
}
|
2010-09-23 15:02:42 +02:00
|
|
|
echo '</div>';
|
2010-09-23 12:59:56 +02:00
|
|
|
|
2010-09-15 16:55:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private function setParams($params){
|
|
|
|
$this->params = $params;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function start($params){
|
|
|
|
$links = new links($params);
|
|
|
|
}
|
2010-09-20 11:40:27 +02:00
|
|
|
|
2010-09-21 16:00:04 +02:00
|
|
|
public function setLink($link){
|
|
|
|
// Saving the position and z-index of the note:
|
|
|
|
$xmla = simplexml_load_file('../'.self::LINKS_FILE);
|
|
|
|
|
|
|
|
$path = $xmla->xpath("//item[@id='weather']");
|
|
|
|
$path[0]->x = $x;
|
|
|
|
|
|
|
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
|
|
|
|
|
|
|
echo "ok";
|
|
|
|
}
|
2010-09-20 11:40:27 +02:00
|
|
|
|
2010-09-22 16:02:40 +02:00
|
|
|
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='links']");
|
|
|
|
$path[0]->visibility = $visibility;
|
|
|
|
|
|
|
|
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
|
|
|
|
|
|
|
echo "ok";
|
|
|
|
}
|
|
|
|
|
2010-09-21 16:00:04 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2010-09-20 11:40:27 +02:00
|
|
|
}
|
2010-09-15 16:55:54 +02:00
|
|
|
}
|