Correction du bug de l'ajout de module avec la nouvelle classe Module

This commit is contained in:
Chouchen 2010-10-06 08:24:08 +00:00
parent 759a5556cc
commit 3574fc102c
15 changed files with 29 additions and 35 deletions

View File

@ -121,19 +121,10 @@ class AccueilModules {
</script>';
}
/**
*
* @property Chaque module possède la fonction updateModule en static qui permet de changer un ou plusieurs de ses attributs
* @param $module String Nom du module à modifier
* @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 'Module.php';
//require '../modules/'.$module.'/'.ucfirst($module).'.php';
$module = new $module();
return call_user_func(array($module, "updateConfig"), $things2change);
}*/
public static function retrieveModuleParams($module){
$temp = new $module;
return $temp->getParamsList();
}
/**
*
@ -161,7 +152,8 @@ class AccueilModules {
if($config = simplexml_load_file('../'.self::CONFIG_FILE)){
$newItem = $config->addChild('item');
$newItem->addAttribute('id', $name);
$params = call_user_func(array($name, 'getParamList'));
//$params = call_user_func(array($name, 'getParamList'));
$params = self::retrieveModuleParams($name);
foreach($params as $param){
if($param == 'visibility')
$newItem->AddChild($param, 'true');

View File

@ -1,13 +1,7 @@
<?php
class Module
{
/**
* Liste des paramètres du module en concordance avec le "config.xml"
* Ses éléments ne peuvent être modifiés
* @var array
*/
protected static $paramsList = array();
// Nom du module (aka le nom de la classe en minuscule)
protected $moduleName;
@ -24,8 +18,9 @@ class Module
*/
private $params = array();
public function __construct($class, $params){
public function __construct($class, $params = null){
$this->setNames($class, $this->moduleTitle);
if($params != null && is_array($params))
$this->setParams($params);
}
@ -71,6 +66,13 @@ class Module
$this->moduleTitle = $libelle;
}
/**
* @return la liste des paramètres du module
*/
public function getParamsList(){
return $this->paramsList;
}
/**
* @param $class string nom du module
* @param $key string le nom du paramètre à changer

View File

@ -1,7 +1,7 @@
<?php
class blogs extends Module {
protected $moduleTitle = 'Blogs BD';
protected static $paramsList = array(
protected $paramsList = array(
'visibility',
'x',
'y'

View File

@ -1,7 +1,7 @@
<?php
class clock extends Module {
protected $moduleTitle = 'Horloge Simple';
protected static $paramsList = array(
protected $paramsList = array(
'visibility',
'x',
'y'

View File

@ -1,7 +1,7 @@
<?php
class clockAdvanced extends Module {
protected $moduleTitle = 'Horloge Avancée';
protected static $paramsList = array(
protected $paramsList = array(
'visibility',
'x',
'y',

View File

@ -1,7 +1,7 @@
<?php
class gmap extends Module {
protected $moduleTitle = 'Google Maps';
protected static $paramsList = array(
protected $paramsList = array(
'visibility'
);

View File

@ -1,7 +1,7 @@
<?php
class links extends Module{
protected $moduleTitle = 'Liens';
protected static $paramsList = array(
protected $paramsList = array(
'visibility'
);

View File

@ -1,7 +1,7 @@
<?php
class mappy extends Module {
protected $moduleTitle = 'Mappy';
protected static $paramsList = array(
protected $paramsList = array(
'visibility'
);

View File

@ -1,7 +1,7 @@
<?php
class news extends Module{
protected $moduleTitle = 'Google News';
protected static $paramsList = array(
protected $paramsList = array(
'visibility',
'x',
'y'

View File

@ -2,7 +2,7 @@
class notes extends Module {
protected $moduleTitle = 'Post-It';
protected static $paramsList = array(
protected $paramsList = array(
'visibility'
);

View File

@ -1,7 +1,7 @@
<?php
class ouifm extends Module {
protected $moduleTitle = 'Oui FM Radio';
protected static $paramsList = array(
protected $paramsList = array(
'visibility',
'x',
'y'

View File

@ -1,7 +1,7 @@
<?php
class rssblogs extends Module {
protected $moduleTitle = 'Lecteur de flux RSS';
protected static $paramsList = array(
protected $paramsList = array(
'visibility',
'x',
'y'

View File

@ -1,7 +1,7 @@
<?php
class search extends Module {
protected $moduleTitle = 'Recherche';
protected static $paramsList = array(
protected $paramsList = array(
'visibility'
);

View File

@ -3,7 +3,7 @@ class todo extends Module {
protected $moduleTitle = 'Todo List';
protected static $paramsList = array(
protected $paramsList = array(
'visibility',
'x',
'y'

View File

@ -3,7 +3,7 @@ class weather extends Module {
protected $moduleTitle = 'Météo';
protected static $paramsList = array(
protected $paramsList = array(
'visibility',
'city',
'x',