Browse Source

Ajout de la classe abstraite Module

remotes/svn/ModulesALaMano
Chouchen 11 years ago
parent
commit
1e79cafb35
  1. 1
      class/AccueilModules.php
  2. 14
      class/Blogs.php
  3. 15
      class/Clock.php
  4. 6
      class/ClockAdvanced.php
  5. 11
      class/Links.php
  6. 26
      class/Module.php
  7. 13
      class/Notes.php
  8. 12
      class/Search.php
  9. 15
      class/Todo.php
  10. 11
      class/Weather.php
  11. 2
      db/config.xml

1
class/AccueilModules.php

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

14
class/Blogs.php

@ -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){
}
}

15
class/Clock.php

@ -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){
}
}

6
class/ClockAdvanced.php

@ -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){
}
}

11
class/Links.php

@ -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

@ -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);
}

13
class/Notes.php

@ -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;
}
}

12
class/Search.php

@ -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){
}
}

15
class/Todo.php

@ -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;
}
}

11
class/Weather.php

@ -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;
}

2
db/config.xml

@ -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>

Loading…
Cancel
Save