Accueil/class/Links.php

60 lines
1.5 KiB
PHP
Raw Normal View History

<?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();
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>
<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){
echo '<li class="item" id="'.$link->title.'"><a href="'.$link->url.'" onclick="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
}
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
}
echo '</div>';
}
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-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
}
}