Version avec modules séparés !
This commit is contained in:
@@ -19,7 +19,7 @@ class AccueilModules {
|
||||
$this->getModules();
|
||||
$this->buildConfigMenu();
|
||||
}else{
|
||||
echo 'baaaaad persistance...';
|
||||
echo 'Impossible de trouver le fichier de configuration.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ class AccueilModules {
|
||||
*/
|
||||
function getModules(){
|
||||
foreach($this->modules as $module=>$moduleConf){
|
||||
if(file_exists('class/'.ucfirst($module).'.php') && $moduleConf->visibility == "true"){
|
||||
if(file_exists('modules/'.$module.'/'.ucfirst($module).'.php') && $moduleConf->visibility == "true"){
|
||||
$params = array();
|
||||
foreach($moduleConf as $confParam){
|
||||
$params[$confParam->getName()] = "$confParam";
|
||||
}
|
||||
require ucfirst($module).'.php';
|
||||
require 'modules/'.$module.'/'.ucfirst($module).'.php';
|
||||
call_user_func(array($module, "start"), $params);
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ class AccueilModules {
|
||||
* @return "ok" String si c'est bon, ou le message d'erreur
|
||||
*/
|
||||
public static function updateModule($module, $things2change){
|
||||
require ucfirst($module).'.php';
|
||||
require '../modules/'.$module.'/'.ucfirst($module).'.php';
|
||||
return call_user_func(array($module, "updateConfig"), $things2change);
|
||||
}
|
||||
}
|
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
class blogs extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
require('blogs_last_post.php');
|
||||
echo '<script type="text/javascript" src="js/jquery.blogs.js"></script>
|
||||
<div id="blogs" style="top:'.$params['y'].'; left :'.$params['x'].';"></div>';
|
||||
echo '<a href="#blogLinksManager" id="blog-links-manager"><img src="images/interface/blogs_edit.png" /></a>';
|
||||
echo '<div style="display:none;">
|
||||
<div id="blogLinksManager">
|
||||
<h3>Blogs Management</h3><br/>
|
||||
<h4>Delete Site feed</h4>
|
||||
<ul>';
|
||||
$blogs = new Blogs_last_post();
|
||||
foreach($blogs->getLinks() as $link)
|
||||
echo '<li>'.$link['url'].' <img src="images/interface/delete.png" id="link-'.$link['name'].'"/></li>';
|
||||
echo '</ul>
|
||||
<h4>Insert Site feed</h4>
|
||||
<form action="addSite.php" method="POST">
|
||||
<input type="text" id="newLink" name="newLink" value="url" />
|
||||
<input type="submit" id="link-submit" class="green-button" value="Ajouter"></input>
|
||||
</form>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$blogs = new blogs($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='blogs']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='blogs']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='blogs']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
class clock extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="js/jquery.jclock.js"></script>';
|
||||
echo '<div class="jclock" id="clock" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$clock = new clock($params);
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,130 +0,0 @@
|
||||
<?php
|
||||
class clockAdvanced extends Module {
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y',
|
||||
'fontFamily',
|
||||
'fontSize',
|
||||
'format',
|
||||
'color'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="js/jquery.jclockAdvanced.js"></script>';
|
||||
echo '<div class="jclockAdvanced" id="clockAdvanced" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||||
$options = '';
|
||||
foreach (self::$paramsList as $paramName){
|
||||
if(isset($this->params[$paramName]))
|
||||
$options .= $paramName.' : "'.$this->params[$paramName].'",';
|
||||
}
|
||||
echo '<script>$(document).ready(function(){
|
||||
$(\'#fontFamily\').val("'.$params['fontFamily'].'");
|
||||
$(\'#fontSize\').val("'.$params['fontSize'].'");
|
||||
$(\'#format\').val("'.$params['format'].'");
|
||||
$(\'#color\').val("'.$params['color'].'");
|
||||
$(\'.jclockAdvanced\').jclock({'.substr($options,0,-1).'});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$clockAdvanced = new clockAdvanced($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setFontFamily($fontFamily){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->fontFamily = $fontFamily;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setFontSize($fontSize){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->fontSize = $fontSize;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setColor($color){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->color = $color;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setFormat($format){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->format = $format;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
class gmap extends Module {
|
||||
//TODO rajouter les params en détail
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="js/gmap.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="css/gmap.css" />
|
||||
|
||||
<div id="myAdress"><label for="myAdressField"><img src="images/interface/map.png" /> Adresse pour Google Maps :</label><input type="text" name="myAdressField" id="myAdressField" /></div><a href="#map" id="gmapLink"></a><div id="map">';
|
||||
|
||||
include 'GoogleMapAPIv3.class.php';
|
||||
$gmap = new GoogleMapAPI();
|
||||
$gmap->setDivId('mymap'); //crée une div avec l'id donnée
|
||||
//$gmap->setDirectionDivId('route');
|
||||
$gmap->setCenter('Paris France'); // Adresse du centre par défaut
|
||||
$gmap->setEnableWindowZoom(true); // Permet de zoomer (trop important !)
|
||||
$gmap->setEnableAutomaticCenterZoom(false); // FALSE ! ou sinon le setCenter ne sert à rien !
|
||||
//$gmap->setDisplayDirectionFields(false);
|
||||
$gmap->setSize('400px','400px'); // La taille... duh !
|
||||
$gmap->setZoom(11); // Le zoom (+ il est haut, plus le zoom est proche)
|
||||
$gmap->setLang('fr'); // La langue par défaut
|
||||
$gmap->setDefaultHideMarker(false); // Cache les markers ?
|
||||
$gmap->generate(); // Génère le JS
|
||||
echo $gmap->getGoogleMap();
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$gmap = new gmap($params);
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='gmap']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
class links {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
const LINKS_FILE = 'db/links.xml';
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="js/jquery.links.js"></script>
|
||||
<link rel="stylesheet" href="css/links.css" type="text/css" />
|
||||
<div style="display:none;"><div id="links-add-fancy"></div></div>
|
||||
<div class="appscontainer">';
|
||||
if($links_xml = simplexml_load_file(self::LINKS_FILE)){
|
||||
$links = $links_xml->label;
|
||||
foreach($links as $label){
|
||||
//<span class="label">'.$label['id'].'</span>
|
||||
echo '<ul class="iconlist" id="'.$label['id'].'">';
|
||||
foreach($label->link as $link){
|
||||
echo '<li class="iconitem" id="'.$link->title.'"><img src="images/interface/delete.png" class="deleteLink" /><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
|
||||
}
|
||||
echo '</ul>
|
||||
<hr>';
|
||||
}
|
||||
}else{
|
||||
echo 'Can\'t find '.self::LINKS_FILE;
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$links = new links($params);
|
||||
}
|
||||
|
||||
public function setLink($link){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.self::LINKS_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='links']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
class mappy extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script src="http://axe.mappy.com/1v1/init/get.aspx?version=2.01&solution=ajax&auth=HbTTpMfC4//GWuldL2IsF+HJA4xVuTBsIQi0wcC7xRz+e17hobrJ+1947aq34rdjYAPy6nBYBQF8o56Qzdun9w=="></script>
|
||||
<script type="text/javascript" src="js/mappy.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="css/mappy.css" />
|
||||
<div id="mymap"></div>
|
||||
<div id="myAdress"><input type="text" name="myAdressField" id="myAdressField" /></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
|
||||
$mappy = new mappy($params);
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='mappy']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -8,6 +8,15 @@ abstract class Module
|
||||
*/
|
||||
protected static $paramsList = array();
|
||||
|
||||
// Nom du module (aka le nom de la classe en minuscule)
|
||||
protected $moduleName;
|
||||
|
||||
// Libellé du module (aka le nom affiché)
|
||||
protected $moduleTitle;
|
||||
|
||||
// Le chemin vers le module
|
||||
protected $pathToModule;
|
||||
|
||||
/**
|
||||
* Liste des paramètres et leurs valeurs de l'object
|
||||
*
|
||||
|
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
class news {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="http://www.google.com/jsapi"></script>
|
||||
<div id="news"></div>
|
||||
<script type="text/javascript">
|
||||
google.load("elements", "1", {packages : ["newsshow"]});
|
||||
function onLoad() {
|
||||
var options = {
|
||||
"format" : "300x250",
|
||||
"language" : "fr",
|
||||
"linkTarget" : "_blank"
|
||||
}
|
||||
// Load it using all of the defaults.
|
||||
var content = document.getElementById(\'news\');
|
||||
var newsShow = new google.elements.NewsShow(content, options);
|
||||
make_draggable($(\'#news\'));
|
||||
}
|
||||
|
||||
|
||||
google.setOnLoadCallback(onLoad);
|
||||
</script>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$news = new news($params);
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='news']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
class notes extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="js/jquery.notes.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/note.css">
|
||||
<a id="addButton" class="green-button" href="add_note.html">Add a note</a>';
|
||||
include 'notes_extract.php';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$notes = new notes($params);
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='notes']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
class ouifm extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="js/jquery.ouifm.js"></script>';
|
||||
echo '<div id="ouifm" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$ouifm = new ouifm($params);
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='ouifm']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
class rssblogs extends Module {
|
||||
//TODO rajouter les params en d<>tail
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<link rel="stylesheet" type="text/css" href="css/rssblogs.css"><div id="rssblogs">';
|
||||
require('class/lastRSS.php');
|
||||
$rss = new lastRSS;
|
||||
// options lastRSS
|
||||
$rss->cache_dir = './cache'; // dossier pour le cache
|
||||
$rss->cache_time = 3600; // fr<66>quence de mise <20> jour du cache (en secondes)
|
||||
$rss->date_format = 'd/m/y'; // format de la date (voir fonction date() pour syntaxe)
|
||||
$rss->CDATA = 'content'; // on retire les tags CDATA en conservant leur contenu
|
||||
if($linksXML = simplexml_load_file('db/rss.xml')){
|
||||
foreach($linksXML->link as $individualLink){
|
||||
if ($rs = $rss->get($individualLink->url))
|
||||
echo '<span class="date">'.$rs['items'][0]['pubDate'].'</span> <a href="'.$rs['items'][0]['link'].'">'.$rs['items'][0]['title'].'</a><br />';
|
||||
else
|
||||
echo 'Flux RSS non trouv<75>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$rssblogs = new rssblogs($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='rssblogs']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='rssblogs']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='rssblogs']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
class search extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
echo '<link rel="stylesheet" type="text/css" href="css/search.css">
|
||||
<script type="text/javascript" src="js/jquery.search.js"></script>
|
||||
<form id="searchForm" method="post">
|
||||
<fieldset>
|
||||
<input id="s" type="text" />
|
||||
<input type="submit" value="Submit" id="submitButton" class="searchbutton" />
|
||||
|
||||
<ul class="icons">
|
||||
<li class="web" title="Web Search" data-searchType="web">Web</li>
|
||||
<li class="images" title="Image Search" data-searchType="images">Images</li>
|
||||
<li class="news" title="News Search" data-searchType="news">News</li>
|
||||
<li class="videos" title="Video Search" data-searchType="video">Videos</li>
|
||||
</ul>
|
||||
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$search = new search($params);
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
|
||||
}
|
||||
}
|
112
class/Todo.php
112
class/Todo.php
@@ -1,112 +0,0 @@
|
||||
<?php
|
||||
class todo extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
private $persistance = 'db/todoist.xml';
|
||||
private $token;
|
||||
private $project_name;
|
||||
private $project_id;
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<link rel="stylesheet" type="text/css" href="css/todo.css">';
|
||||
if($xmla = simplexml_load_file($this->persistance)){
|
||||
$this->setToken($xmla->token);
|
||||
$this->setProjectName($xmla->name);
|
||||
$this->setProjectId($xmla->id);
|
||||
echo '<div id="todo" style="top:'.$params['y'].'; left :'.$params['x'].';">';
|
||||
if($this->token == null || $this->project_id == null)
|
||||
echo 'Impossible de trouver votre configuration. <a href="install-todoist.php">Cliquez ici</a> pour la mettre en place.</div>';
|
||||
else{
|
||||
$token = $xmla->token;
|
||||
$id = $xmla->id;
|
||||
echo '</div><script type="text/javascript" src="js/getUncompletedTasks.php?token='.$token.'&id='.$id.'"></script>';
|
||||
}
|
||||
echo '<script>
|
||||
$(document).ready(function(){
|
||||
$(\'#todo\').resizable();
|
||||
});</script>';
|
||||
}else{
|
||||
echo 'baaaaad persistance...';
|
||||
}
|
||||
}
|
||||
|
||||
private function setToken($token){
|
||||
if($token == '' || $token == null)
|
||||
$this->token = null;
|
||||
else
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
private function setProjectName($name){
|
||||
if($name == '' || $name == null)
|
||||
$this->project_name = null;
|
||||
else
|
||||
$this->project_name = $name;
|
||||
}
|
||||
|
||||
private function setProjectId($id){
|
||||
if($id == '' || $id == null)
|
||||
$this->project_id = null;
|
||||
else
|
||||
$this->project_id = $id;
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$todo = new todo($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='todo']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='todo']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='todo']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
|
||||
class weather extends Module {
|
||||
//TODO rajouter les params en d<>tail
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'city',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
$ville = $params['city'];
|
||||
include 'GoogleMeteo.php';
|
||||
echo '<script type="text/javascript" src="js/jquery.weather.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="css/weather.css">';
|
||||
echo '<div id="weather" style="left:'.$params['x'].'; top:'.$params['y'].';">
|
||||
'.$city.'<br/>
|
||||
<div class="weatherpic"></div>
|
||||
<strong>'.$present_weather.'</strong><br/>
|
||||
'.$future_weather1.'<br/>
|
||||
'.$future_weather2.'
|
||||
</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$weather = new weather($params);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Modifie la ville
|
||||
* @param String $city la ville.
|
||||
* @return String "ok" ou message d'erreur (effectue aussi l'enregistrement en XML)
|
||||
*/
|
||||
public function setCity($city){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->city = $city;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user