Amélioration de l'organisation du code : la classe principale "Module" est maintenant prête et les modules l'ont bien étendue.
This commit is contained in:
parent
ac017b84e9
commit
759a5556cc
@ -3,7 +3,11 @@ $options = array();
|
||||
$module ='';
|
||||
include '../class/AccueilModules.php';
|
||||
foreach($_POST as $module => $valeur){
|
||||
AccueilModules::updateModule($module, array('visibility'=>$valeur));
|
||||
$moduleToUpdate = AccueilModules::getModule($module);
|
||||
if($moduleToUpdate != null){
|
||||
$moduleToUpdate->updateConfig(array('visibility'=>$valeur));
|
||||
}
|
||||
//AccueilModules::updateModule($module, array('visibility'=>$valeur));
|
||||
}
|
||||
echo "1";
|
||||
echo "1"
|
||||
?>
|
||||
|
@ -8,9 +8,12 @@ $options = array();
|
||||
$module ='';
|
||||
foreach($_GET as $indice=>$valeur){
|
||||
if($indice == 'id')
|
||||
$module .= $valeur;
|
||||
$module = $valeur;
|
||||
else
|
||||
$options[$indice] = $valeur;
|
||||
}
|
||||
include '../class/AccueilModules.php';
|
||||
echo AccueilModules::updateModule($module, $options);
|
||||
$moduleToUpdate = AccueilModules::getModule($module);
|
||||
if($moduleToUpdate != null){
|
||||
echo $moduleToUpdate->updateConfig($options);
|
||||
}
|
||||
|
@ -1,14 +1,23 @@
|
||||
<?php
|
||||
require 'Module.php';
|
||||
function __autoload($class)
|
||||
{
|
||||
$BASE_DIR = '/homez.9/shikiryu/www/test/trunk3/';
|
||||
set_include_path($BASE_DIR);
|
||||
$path = 'modules/'.$class;
|
||||
if(file_exists($path . DIRECTORY_SEPARATOR . ucfirst($class) . '.php') || file_exists($BASE_DIR . $path . DIRECTORY_SEPARATOR . ucfirst($class) . '.php')){
|
||||
require_once($path . DIRECTORY_SEPARATOR . ucfirst($class) . '.php');
|
||||
}else{
|
||||
require_once('class/' . $class . '.php');
|
||||
}
|
||||
}
|
||||
class AccueilModules {
|
||||
|
||||
const CONFIG_FILE = 'db/config.xml';
|
||||
private $modules = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructeur
|
||||
* Initialise le XML de conf générale
|
||||
* Active les modules
|
||||
* Construit le menu
|
||||
*/
|
||||
function __construct(){
|
||||
if($config = simplexml_load_file(self::CONFIG_FILE)){
|
||||
@ -16,8 +25,6 @@ class AccueilModules {
|
||||
foreach($config_xml as $item){
|
||||
$this->modules["$item[id]"] = $item;
|
||||
}
|
||||
$this->getModules();
|
||||
$this->buildConfigMenu();
|
||||
}else{
|
||||
echo 'Impossible de trouver le fichier de configuration.';
|
||||
}
|
||||
@ -34,11 +41,40 @@ class AccueilModules {
|
||||
foreach($moduleConf as $confParam){
|
||||
$params[$confParam->getName()] = "$confParam";
|
||||
}
|
||||
require 'modules/'.$module.'/'.ucfirst($module).'.php';
|
||||
call_user_func(array($module, "start"), $params);
|
||||
$module = new $module($params);
|
||||
if(is_subclass_of($module,'Module'))
|
||||
$module->build();
|
||||
// require 'modules/'.$module.'/'.ucfirst($module).'.php';
|
||||
// call_user_func(array($module, "start"), $module, $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return le module donné avec ses paramètres actuellement présent en conf
|
||||
*/
|
||||
public static function getModule($module){
|
||||
if($config = simplexml_load_file('../'.self::CONFIG_FILE)){
|
||||
$config_xml = $config->item;
|
||||
foreach($config_xml as $item){
|
||||
if($item["id"] == $module){
|
||||
$params = array();
|
||||
foreach($item as $confParam){
|
||||
$params[$confParam->getName()] = "$confParam";
|
||||
}
|
||||
//require '../modules/'.$module.'/'.ucfirst($module).'.php';
|
||||
return new $module($params);
|
||||
}
|
||||
}
|
||||
echo "object not found";
|
||||
return;
|
||||
}else{
|
||||
echo "bad persistance";
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -92,10 +128,12 @@ class AccueilModules {
|
||||
* @param $things2change Array du ou des attributs à modifier avec sa ou ses nouvelles valeurs
|
||||
* @return "ok" String si c'est bon, ou le message d'erreur
|
||||
*/
|
||||
public static function updateModule($module, $things2change){
|
||||
require '../modules/'.$module.'/'.ucfirst($module).'.php';
|
||||
/*public static function updateModule($module, $things2change){
|
||||
//require 'Module.php';
|
||||
//require '../modules/'.$module.'/'.ucfirst($module).'.php';
|
||||
$module = new $module();
|
||||
return call_user_func(array($module, "updateConfig"), $things2change);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -94,8 +94,9 @@ class GoogleWeatherAPI {
|
||||
}
|
||||
|
||||
} else {
|
||||
trigger_error('Google results parse problem : http error '.$getContentCode,E_USER_WARNING);
|
||||
return null;
|
||||
//trigger_error('Google results parse problem : http error '.$getContentCode,E_USER_WARNING);
|
||||
$this->is_found = false;
|
||||
//return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
abstract class Module
|
||||
class Module
|
||||
{
|
||||
/**
|
||||
* Liste des paramètres du module en concordance avec le "config.xml"
|
||||
@ -22,20 +22,79 @@ abstract class Module
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $params = array();
|
||||
private $params = array();
|
||||
|
||||
private function setParams($params){
|
||||
public function __construct($class, $params){
|
||||
$this->setNames($class, $this->moduleTitle);
|
||||
$this->setParams($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array correspondant aux paramètres du $paramsList
|
||||
* Applique les paramètres du module depuis le conf
|
||||
*/
|
||||
public function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
abstract static function start($params);
|
||||
/**
|
||||
* @return Array les paramètres du module
|
||||
*/
|
||||
public function getParams(){
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string le paramètre dont on veut la valeur
|
||||
* @return string valeur du paramètre
|
||||
*/
|
||||
public function getParam($param){
|
||||
if(isset($this->params[$param]))
|
||||
return $this->params[$param];
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string le nom de la classe (du module)
|
||||
*/
|
||||
private function getModuleName(){
|
||||
return $this->moduleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Donne les noms et chemins du module
|
||||
*/
|
||||
private function setNames($module, $libelle){
|
||||
$this->moduleName = $module;
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->moduleTitle = $libelle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $class string nom du module
|
||||
* @param $key string le nom du paramètre à changer
|
||||
* @param $value string valeur du paramètre
|
||||
* Enregistre le paramètre dans le conf
|
||||
*/
|
||||
public function setParam($class, $key, $value) {
|
||||
echo 'setting :'.$key.' as '.$value.' in the '.$class.'\'s module';
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
public static function updateConfig($updated){
|
||||
$path = $xmla->xpath("//item[@id='".$class."']");
|
||||
$path[0]->$key = $value;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
}
|
||||
|
||||
public function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
if(array_key_exists($what, $this->getParams())){
|
||||
$this->setParam($this->moduleName, $what, $withWhat);
|
||||
}else{
|
||||
echo $what.' isn\'t in ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -31,7 +31,7 @@
|
||||
<y>-2</y>
|
||||
</item>
|
||||
<item id="clockAdvanced">
|
||||
<visibility>true</visibility>
|
||||
<visibility>false</visibility>
|
||||
<x>80</x>
|
||||
<y>10</y>
|
||||
<fontFamily>Times New Roman, serif</fontFamily>
|
||||
@ -46,6 +46,8 @@
|
||||
</item>
|
||||
<item id="news">
|
||||
<visibility>false</visibility>
|
||||
<x>0</x>
|
||||
<y>600</y>
|
||||
</item>
|
||||
<item id="ouifm">
|
||||
<visibility>true</visibility>
|
||||
|
@ -12,8 +12,10 @@
|
||||
</head>
|
||||
<body>
|
||||
<?
|
||||
require 'class/AccueilModules.php';
|
||||
include "class/AccueilModules.php";
|
||||
$index = new AccueilModules();
|
||||
$index->getModules();
|
||||
$index->buildConfigMenu();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -67,7 +67,7 @@ $(document).ready(function(){
|
||||
$('#menu-bar').prepend($('#config-menu'));
|
||||
|
||||
$("#q").focus(); //focus sur la recherche
|
||||
//$('.iconlist').sortable();
|
||||
|
||||
$('#config-menu').fancybox({
|
||||
'zoomSpeedIn' : 600,
|
||||
'zoomSpeedOut' : 500,
|
||||
|
@ -1,21 +1,21 @@
|
||||
<?php
|
||||
class blogs extends Module {
|
||||
|
||||
protected $moduleTitle = 'Blogs BD';
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
|
||||
require($this->pathToModule.'includes/blogs_last_post.php');
|
||||
echo '<div id="blogs" style="top:'.$params['y'].'; left :'.$params['x'].';"></div>';
|
||||
echo '<div id="blogs" style="top:'.$this->getParam('y').'; left :'.$this->getParam('x').';"></div>';
|
||||
echo '<a href="#blogLinksManager" id="blog-links-manager"><img src="images/interface/blogs_edit.png" /></a>';
|
||||
echo '<div style="display:none;">
|
||||
<div id="blogLinksManager">
|
||||
@ -34,55 +34,4 @@ class blogs extends Module {
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$blogs = new blogs($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='blogs']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='blogs']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='blogs']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,48 +1,19 @@
|
||||
<?php
|
||||
class clock extends Module {
|
||||
|
||||
protected $moduleTitle = 'Horloge Simple';
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
|
||||
echo '<div class="jclock" id="clock" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$clock = new clock($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='clock']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
echo '<div class="jclock" id="clock" style="left:'.$this->getParam('x').'; top:'.$this->getParam('y').';"></div>';
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
class clockAdvanced extends Module {
|
||||
protected $moduleTitle = 'Horloge Avancée';
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
@ -10,124 +11,26 @@ class clockAdvanced extends Module {
|
||||
'color'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
|
||||
echo '<div class="jclockAdvanced" id="clockAdvanced" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||||
echo '<div class="jclockAdvanced" id="clockAdvanced" style="left:'.$this->getParam('x').'; top:'.$this->getParam('y').';"></div>';
|
||||
$options = '';
|
||||
foreach (self::$paramsList as $paramName){
|
||||
if(isset($this->params[$paramName]))
|
||||
$options .= $paramName.' : "'.$this->params[$paramName].'",';
|
||||
if($this->getParam($paramName) != null)
|
||||
$options .= $paramName.' : "'.$this->getParam($paramName).'",';
|
||||
}
|
||||
echo '<script>$(document).ready(function(){
|
||||
$(\'#fontFamily\').val("'.$params['fontFamily'].'");
|
||||
$(\'#fontSize\').val("'.$params['fontSize'].'");
|
||||
$(\'#format\').val("'.$params['format'].'");
|
||||
$(\'#color\').val("'.$params['color'].'");
|
||||
$(\'#fontFamily\').val("'.$this->getParam('fontFamily').'");
|
||||
$(\'#fontSize\').val("'.$this->getParam('fontSize').'");
|
||||
$(\'#format\').val("'.$this->getParam('format').'");
|
||||
$(\'#color\').val("'.$this->getParam('color').'");
|
||||
$(\'.jclockAdvanced\').jclock({'.substr($options,0,-1).'});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$clockAdvanced = new clockAdvanced($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
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='clockAdvanced']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setFontFamily($fontFamily){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->fontFamily = $fontFamily;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setFontSize($fontSize){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->fontSize = $fontSize;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setColor($color){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->color = $color;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setFormat($format){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->format = $format;
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,49 +1,19 @@
|
||||
<?php
|
||||
|
||||
class gmap extends Module {
|
||||
//TODO rajouter les params en détail
|
||||
protected $moduleTitle = 'Google Maps';
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=fr"></script>
|
||||
<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />
|
||||
|
||||
<div id="myAdress"><label for="myAdressField"><img src="images/interface/map.png" /> Adresse pour Google Maps :</label><input type="text" name="myAdressField" id="myAdressField" /></div><a href="#map" id="gmapLink"></a><div id="map"><div id="mymap" style="width:400px;height:400px"></div></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$gmap = new gmap($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='gmap']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +1,17 @@
|
||||
<?php
|
||||
class links extends Module{
|
||||
|
||||
protected $moduleName;
|
||||
protected $moduleTitle;
|
||||
protected $pathToModule;
|
||||
|
||||
protected $moduleTitle = 'Liens';
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
const LINKS_FILE = 'db/links.xml';
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />
|
||||
<div style="display:none;"><div id="links-add-fancy"></div></div>
|
||||
@ -38,32 +33,4 @@ class links extends Module{
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$links = new links($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='links']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,49 +1,19 @@
|
||||
<?php
|
||||
class mappy extends Module {
|
||||
|
||||
protected $moduleTitle = 'Mappy';
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
|
||||
echo '<script src="http://axe.mappy.com/1v1/init/get.aspx?version=2.01&solution=ajax&auth=HbTTpMfC4//GWuldL2IsF+HJA4xVuTBsIQi0wcC7xRz+e17hobrJ+1947aq34rdjYAPy6nBYBQF8o56Qzdun9w=="></script>
|
||||
<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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,21 @@
|
||||
<?php
|
||||
class news {
|
||||
|
||||
class news extends Module{
|
||||
protected $moduleTitle = 'Google News';
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
|
||||
echo '<script type="text/javascript" src="http://www.google.com/jsapi"></script>
|
||||
<div id="news"></div>
|
||||
<div id="news" style="top:' . $this->getParam('y') . '; left: ' . $this->getParam('x') . ';"></div>
|
||||
<script type="text/javascript">
|
||||
google.load("elements", "1", {packages : ["newsshow"]});
|
||||
function onLoad() {
|
||||
@ -29,32 +34,4 @@ class news {
|
||||
google.setOnLoadCallback(onLoad);
|
||||
</script>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$news = new news($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='news']");
|
||||
$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
modules/news/css/news.css
Normal file
2
modules/news/css/news.css
Normal file
@ -0,0 +1,2 @@
|
||||
#news{position:absolute;}
|
||||
#news div{display:inline !important;}
|
4
modules/news/js/news.js
Normal file
4
modules/news/js/news.js
Normal file
@ -0,0 +1,4 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
make_draggable($('#news'));
|
||||
});
|
@ -1,51 +1,19 @@
|
||||
<?php
|
||||
class notes extends Module {
|
||||
|
||||
protected $moduleName;
|
||||
protected $moduleTitle;
|
||||
protected $pathToModule;
|
||||
|
||||
protected $moduleTitle = 'Post-It';
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">
|
||||
<a id="addButton" class="green-button" href="'.$this->pathToModule.'includes/add_note.html">Add a note</a>';
|
||||
include $this->pathToModule.'includes/notes_extract.php';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$notes = new notes($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='notes']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
include $this->pathToModule.'includes/notes_extract.php';
|
||||
}
|
||||
}
|
@ -1,48 +1,19 @@
|
||||
<?php
|
||||
class ouifm extends Module {
|
||||
|
||||
protected $moduleTitle = 'Oui FM Radio';
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
|
||||
echo '<div id="ouifm" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$ouifm = new ouifm($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='ouifm']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
echo '<div id="ouifm" style="left:'.$this->getParam('x').'; top:'.$this->getParam('y').';"></div>';
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
class rssblogs extends Module {
|
||||
//TODO rajouter les params en détail
|
||||
protected $moduleTitle = 'Lecteur de flux RSS';
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
@ -10,9 +10,10 @@ class rssblogs extends Module {
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
|
||||
require('class/lastRSS.php');
|
||||
@ -22,6 +23,7 @@ class rssblogs extends Module {
|
||||
$rss->cache_time = 3600; // fréquence de mise à jour du cache (en secondes)
|
||||
$rss->date_format = 'd/m/y'; // format de la date (voir fonction date() pour syntaxe)
|
||||
$rss->CDATA = 'content'; // on retire les tags CDATA en conservant leur contenu
|
||||
echo '<div id="rssblogs" style="top:' . $this->getParam('y') . '; left: ' . $this->getParam('x') . ';">';
|
||||
if($linksXML = simplexml_load_file($this->pathToModule.'db/rss.xml')){
|
||||
foreach($linksXML->link as $individualLink){
|
||||
if ($rs = $rss->get($individualLink->url))
|
||||
@ -32,56 +34,4 @@ class rssblogs extends Module {
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$rssblogs = new rssblogs($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='rssblogs']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='rssblogs']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
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='rssblogs']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
$(document).ready(function(){
make_draggable($('#rssblogs'));
});
|
@ -1,19 +1,15 @@
|
||||
<?php
|
||||
class search extends Module {
|
||||
|
||||
protected $moduleName;
|
||||
protected $moduleTitle;
|
||||
protected $pathToModule;
|
||||
|
||||
protected $moduleTitle = 'Recherche';
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">
|
||||
<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<form id="searchForm" method="post">
|
||||
@ -31,32 +27,4 @@ class search extends Module {
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$search = new search($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='search']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
class todo extends Module {
|
||||
|
||||
protected $moduleTitle = 'Todo List';
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
@ -8,23 +9,24 @@ class todo extends Module {
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
const TODO_FILE = 'db/todoist.xml';
|
||||
|
||||
private $token;
|
||||
private $project_name;
|
||||
private $project_id;
|
||||
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
|
||||
if($xmla = simplexml_load_file($this->pathToModule.self::TODO_FILE)){
|
||||
$this->setToken($xmla->token);
|
||||
$this->setProjectName($xmla->name);
|
||||
$this->setProjectId($xmla->id);
|
||||
echo '<div id="todo" style="top:'.$params['y'].'; left :'.$params['x'].';">';
|
||||
echo '<div id="todo" style="top:'.$this->getParam('y').'; left :'.$this->getParam('x').';">';
|
||||
if($this->token == null || $this->project_id == null)
|
||||
echo 'Impossible de trouver votre configuration. <a href="'.$this->pathToModule.'includes/install-todoist.php">Cliquez ici</a> pour la mettre en place.</div>';
|
||||
else{
|
||||
@ -38,7 +40,7 @@ class todo extends Module {
|
||||
});</script>';
|
||||
}else{
|
||||
echo 'baaaaad persistance...';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function setToken($token){
|
||||
@ -61,56 +63,4 @@ class todo extends Module {
|
||||
else
|
||||
$this->project_id = $id;
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$todo = new todo($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='todo']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='todo']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
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='todo']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
<?php
|
||||
|
||||
class weather extends Module {
|
||||
|
||||
protected $moduleName;
|
||||
protected $moduleTitle;
|
||||
protected $pathToModule;
|
||||
protected $moduleTitle = 'Météo';
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
@ -13,92 +10,21 @@ class weather extends Module {
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
$ville = $params['city'];
|
||||
parent::__construct(__CLASS__, $params);
|
||||
}
|
||||
|
||||
public function build(){
|
||||
$ville = $this->getParam('city');
|
||||
include $this->pathToModule.'includes/GoogleMeteo.php';
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
|
||||
echo '<div id="weather" style="left:'.$params['x'].'; top:'.$params['y'].';">
|
||||
echo '<div id="weather" style="left:'.$this->getParam("x").'; top:'.$this->getParam("y").';">
|
||||
'.$city.'<br/>
|
||||
<div class="weatherpic"></div>
|
||||
<strong>'.$present_weather.'</strong><br/>
|
||||
'.$future_weather1.'<br/>
|
||||
'.$future_weather2.'
|
||||
</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$weather = new weather($params);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Modifie la ville
|
||||
* @param String $city la ville.
|
||||
* @return String "ok" ou message d'erreur (effectue aussi l'enregistrement en XML)
|
||||
*/
|
||||
public function setCity($city){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->city = $city;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
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='weather']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
</div>';
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
if ($weather = simplexml_load_file('http://www.my-meteo.fr/meteo+rss+paris.html')){
|
||||
$present_weather = $weather->channel->item[0]->title;
|
||||
$future_weather1 = $weather->channel->item[1]->title;
|
||||
$future_weather2 = $weather->channel->item[2]->title;
|
||||
if(strpos(strtolower($present_weather),"soleil") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/soleil.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"nuage") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/nuage.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"peu nuageux") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/peunuage.css">
|
||||
<?}
|
||||
if((strpos(strtolower($present_weather),"pluie") !== false) || (strpos(strtolower($present_weather),"averse") !== false)) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/pluie.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"neige") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/neige.css">
|
||||
<?}
|
||||
}
|
||||
else
|
||||
{
|
||||
die ('Flux RSS non trouvé');
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user