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
require 'Module.php';
class AccueilModules {
const CONFIG_FILE = 'db/config.xml';
private $modules = array();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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