Browse Source

Ajout de la classe abstraite Module

remotes/svn/ModulesALaMano
Chouchen 9 years ago
parent
commit
1e79cafb35
11 changed files with 108 additions and 18 deletions
  1. +1
    -0
      class/AccueilModules.php
  2. +12
    -2
      class/Blogs.php
  3. +13
    -2
      class/Clock.php
  4. +4
    -2
      class/ClockAdvanced.php
  5. +10
    -1
      class/Links.php
  6. +26
    -0
      class/Module.php
  7. +11
    -2
      class/Notes.php
  8. +10
    -2
      class/Search.php
  9. +13
    -2
      class/Todo.php
  10. +7
    -4
      class/Weather.php
  11. +1
    -1
      db/config.xml

+ 1
- 0
class/AccueilModules.php View File

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


+ 12
- 2
class/Blogs.php 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){
}
}

+ 13
- 2
class/Clock.php 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){
}
}

+ 4
- 2
class/ClockAdvanced.php 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){
}
}

+ 10
- 1
class/Links.php 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
- 0
class/Module.php 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);
}

+ 11
- 2
class/Notes.php 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;
}
}

+ 10
- 2
class/Search.php 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){
}
}

+ 13
- 2
class/Todo.php 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;
}
}

+ 7
- 4
class/Weather.php 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;
}


+ 1
- 1
db/config.xml 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>

Loading…
Cancel
Save