Ajout de la classe abstraite Module

This commit is contained in:
Chouchen 2010-09-20 09:40:27 +00:00
parent efc9187699
commit 1e79cafb35
11 changed files with 108 additions and 18 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
require 'Module.php';
class AccueilModules { class AccueilModules {
const CONFIG_FILE = 'db/config.xml'; const CONFIG_FILE = 'db/config.xml';
private $modules = array(); private $modules = array();

View File

@ -1,6 +1,12 @@
<?php <?php
class blogs { class blogs extends Module {
private $params = array();
protected static $paramsList = array(
'visibility',
'x',
'y'
);
public $params = array();
public function __construct($params){ public function __construct($params){
$this->setParams($params); $this->setParams($params);
@ -32,4 +38,8 @@ class blogs {
public static function start($params){ public static function start($params){
$blogs = new blogs($params); $blogs = new blogs($params);
} }
public static function updateConfig($updated){
}
} }

View File

@ -1,6 +1,13 @@
<?php <?php
class clock { class clock extends Module {
private $params = array();
protected static $paramsList = array(
'visibility',
'x',
'y'
);
public $params = array();
public function __construct($params){ public function __construct($params){
$this->setParams($params); $this->setParams($params);
@ -15,4 +22,8 @@ class clock {
public static function start($params){ public static function start($params){
$clock = new clock($params); $clock = new clock($params);
} }
public static function updateConfig($updated){
}
} }

View File

@ -1,6 +1,6 @@
<?php <?php
class clockAdvanced { class clockAdvanced extends Module {
public static $paramsList = array( protected static $paramsList = array(
'visibility', 'visibility',
'x', 'x',
'y', 'y',
@ -34,4 +34,6 @@ class clockAdvanced {
public static function start($params){ public static function start($params){
$clockAdvanced = new clockAdvanced($params); $clockAdvanced = new clockAdvanced($params);
} }
public static function updateConfig($updated){
}
} }

View File

@ -1,6 +1,11 @@
<?php <?php
class links { class links {
private $params = array();
protected static $paramsList = array(
'visibility'
);
public $params = array();
public function __construct($params){ public function __construct($params){
$this->setParams($params); $this->setParams($params);
@ -57,4 +62,8 @@ class links {
public static function start($params){ public static function start($params){
$links = new links($params); $links = new links($params);
} }
public static function updateConfig($updated){
}
} }

26
class/Module.php Normal file
View File

@ -0,0 +1,26 @@
<?php
abstract 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();
/**
* Liste des paramètres et leurs valeurs de l'object
*
* @var array
*/
public $params = array();
private function setParams($params){
$this->params = $params;
}
abstract static function start($params);
abstract static function updateConfig($updated);
}

View File

@ -1,6 +1,11 @@
<?php <?php
class notes { class notes extends Module {
private $params = array();
protected static $paramsList = array(
'visibility'
);
public $params = array();
public function __construct($params){ public function __construct($params){
$this->setParams($params); $this->setParams($params);
@ -17,4 +22,8 @@ class notes {
public static function start($params){ public static function start($params){
$notes = new notes($params); $notes = new notes($params);
} }
public static function updateConfig($updated){
return;
}
} }

View File

@ -1,6 +1,10 @@
<?php <?php
class search { class search extends Module {
private $params = array();
protected static $paramsList = array(
'visibility'
);
public $params = array();
public function __construct($params){ public function __construct($params){
echo '<center> echo '<center>
@ -27,4 +31,8 @@ class search {
public static function start($params){ public static function start($params){
$search = new search($params); $search = new search($params);
} }
public static function updateConfig($updated){
}
} }

View File

@ -1,6 +1,13 @@
<?php <?php
class todo { class todo extends Module {
private $params = array();
protected static $paramsList = array(
'visibility',
'x',
'y'
);
public $params = array();
private $persistance = 'db/todoist.xml'; private $persistance = 'db/todoist.xml';
private $token; private $token;
private $project_name; private $project_name;
@ -58,4 +65,8 @@ class todo {
public static function start($params){ public static function start($params){
$todo = new todo($params); $todo = new todo($params);
} }
public static function updateConfig($updated){
return;
}
} }

View File

@ -1,15 +1,18 @@
<?php <?php
class weather {
class weather extends Module {
//TODO rajouter les params en détail //TODO rajouter les params en détail
public static $params = array( protected static $paramsList = array(
'visibility', 'visibility',
'city', 'city',
'x', 'x',
'y' 'y'
); );
public $params = array();
public function __construct($params){ public function __construct($params){
//$this->setParams($params); $this->setParams($params);
$ville = $params['city']; $ville = $params['city'];
include 'GoogleMeteo.php'; include 'GoogleMeteo.php';
echo '<script type="text/javascript" src="js/jquery.weather.js"></script> echo '<script type="text/javascript" src="js/jquery.weather.js"></script>
@ -23,7 +26,7 @@ class weather {
</div>'; </div>';
} }
private static function setParams($params){ private function setParams($params){
$this->params = $params; $this->params = $params;
} }

View File

@ -36,7 +36,7 @@
<y>10</y> <y>10</y>
<fontFamily>'Times New Roman, serial'</fontFamily> <fontFamily>'Times New Roman, serial'</fontFamily>
<fontSize>'20px'</fontSize> <fontSize>'20px'</fontSize>
<format>'%A %d %B %Y - %H:%m:%S'</format> <format>'%A %d %B %Y - %H:%M:%S'</format>
<color>'#000'</color> <color>'#000'</color>
</item> </item>
</Config> </Config>