Browse Source

Ajout des class pour chaque module et pour la config du site, Correction module météo en cas de ville non trouvée, Correction d'ajout de tâche dans Todoist,

remotes/svn/ModulesALaMano
Chouchen 9 years ago
parent
commit
5c60146a97
10 changed files with 300 additions and 2 deletions
  1. +2
    -1
      GoogleMeteo.php
  2. +51
    -0
      class/AccueilModules.php
  3. +35
    -0
      class/Blogs.php
  4. +18
    -0
      class/Clock.php
  5. +60
    -0
      class/Links.php
  6. +20
    -0
      class/Notes.php
  7. +30
    -0
      class/Search.php
  8. +57
    -0
      class/Todo.php
  9. +26
    -0
      class/Weather.php
  10. +1
    -1
      js/getUncompletedTasks.php

+ 2
- 1
GoogleMeteo.php View File

@@ -8,7 +8,7 @@
if($gweather->isFound()) {
$currentTemp = $gweather->getCurrent();
$forecastTemp = $gweather->getForecast();
}
$present_weather = 'Actuellement : '.$currentTemp['temp_c'].'°C - '.$currentTemp['condition'];
$i=0;
foreach($forecastTemp as $temp) {
@@ -31,6 +31,7 @@
if(strpos(strtolower($present_weather),"neige") !== false) {?>
<link rel="stylesheet" type="text/css" href="css/neige.css">
<?}
}else{ $present_weather = 'Ville non trouvé : '.$city; }
}else
$present_weather = 'Ville non renseignée';

+ 51
- 0
class/AccueilModules.php View File

@@ -0,0 +1,51 @@
<?php
class AccueilModules {
private $persistance = 'db/config.xml';
private $modules = array();
function __construct(){
if($config = simplexml_load_file($this->persistance)){
$config_xml = $config->item;
foreach($config_xml as $item){
$this->modules["$item[id]"] = $item;
}
$this->getModules();
$this->buildConfigMenu();
}else{
echo 'baaaaad persistance...';
}
}
function getModules(){
foreach($this->modules as $module=>$moduleConf){
if(file_exists('class/'.ucfirst($module).'.php') && $moduleConf->visibility == "true"){
$params = array();
foreach($moduleConf as $confParam){
$params[$confParam->getName()] = "$confParam";
}
require ucfirst($module).'.php';
call_user_func(array($module, "start"), $params);
}
}
}
function buildConfigMenu(){
echo '<a href="#config" id="config-menu">Configuration</a>
<div style="display:none;">
<div id="config">
<form id="config_form" action="" method="post">
<h3>Modules configuration</h3><br/>';
foreach($this->modules as $module=>$moduleConf){
echo $module.' module : <input type="radio" name="'.$module.'_group" value="true"';
if ($moduleConf->visibility == "true") echo " checked";
echo '/>true&nbsp;&nbsp;<input type="radio" name="'.$module.'_group" value="false"';
if ($moduleConf->visibility == "false") echo " checked";
echo '/>false<br/><br/>';
}
echo '<a id="config-submit" href="" class="green-button">Enregistrer</a>
</form>
</div>
</div>';
}
}

+ 35
- 0
class/Blogs.php View File

@@ -0,0 +1,35 @@
<?php
class blogs {
private $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>';
echo '<a href="#blogLinksManager" id="blog-links-manager">Manage blog links</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/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);
}
}

+ 18
- 0
class/Clock.php View File

@@ -0,0 +1,18 @@
<?php
class clock {
private $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);
}
}

+ 60
- 0
class/Links.php View File

@@ -0,0 +1,60 @@
<?php
class links {
private $params = array();
public function __construct($params){
$this->setParams($params);
echo '<div class="appscontainer">
<span class="label">Google Apps</span>
<ul class="iconlist">
<li class="item"><a href="http://mail.google.com" onclick="spawnLink(this);return false;"><img src="images/gmail_128.png" /><br>Gmail</a></li>
<li class="item"><a href="http://mail.live.com" onclick="spawnLink(this);return false;"><img src="images/mail-msn.png" /><br>Hotmail</a></li>
<li class="item"><a href="http://mail1.voila.fr/webmail/fr_FR/login.html" onclick="spawnLink(this);return false;"><img src="images/voila.png" /><br>Voila.fr mail</a></li>
<li class="item"><a href="http://calendar.google.com" onclick="spawnLink(this);return false;"><img src="images/calendar_128.png" /><br>Google&nbsp;Calendar</a></li>
<li class="item"><a href="http://reader.google.com" onclick="spawnLink(this);return false;"><img src="images/reader_128.png" /><br>Google Reader</a></li>
<li class="item"><a href="http://docs.google.com" onclick="return spawnLink(this);"><img src="images/docs_128.png" /><br>Google Docs</a></li>
</ul>
<hr>
<span class="label">Media</span>
<ul class="iconlist">
<li class="item"><a href="http://youtube.com" onclick="spawnLink(this);return false;"><img src="images/youtube_128.png" /><br>YouTube</a></li>
<li class="item"><a href="http://picasaweb.com" onclick="spawnLink(this);return false;"><img src="images/picasaweb_128.png" /><br>PicasaWeb</a></li>
<li class="item"><a href="http://www.netvibes.com" onclick="spawnLink(this);return false;"><img src="images/netvibes.png" /><br>Netvibes</a></li>
<li class="item"><a href="http://www.deviantart.com" onclick="spawnLink(this);return false;"><img src="images/deviantART128.png" /><br>DeviantArt</a></li>
<li class="item"><a href="https://www.labanquepostale.fr/index.html" onclick="spawnLink(this);return false;"><img src="images/banquepostale.png" /><br>Banque 1</a></li>
<li class="item"><a href="http://www.societegenerale.fr/" onclick="spawnLink(this);return false;"><img src="images/societegenerale.png" /><br>Banque 2</a></li>
</ul>
<hr>
<span class="label">Desk Accessories</span>
<ul class="iconlist">
<li class="item"><a href="javascript: openContactList()" ><img src="images/contacts.png" /><br>Contacts</a></li>
<li class="item"><a href="javascript: openCalculator();"><img src="images/calculator.png" width="16" height="16" /><br>Calculator</a></li>
<li class="item"><a href="javascript: openTodo();"><img src="images/tasks.png" width="16" height="16" /><br>To-do list</a></li>
<li class="item"><a href="javascript: openCalendar();"><img src="images/calendar_128.png" width="16" height="16" /><br>Calendar Panel</a></li>
<li class="item"><a href="javascript: openNotepad();"><img src="images/notepad.png" width="16" height="16" /><br>NotePad</a></li>
</ul>
<hr>
<span class="label">Entertainment</span>
<ul class="iconlist">
<li class="item"><a href="http://facebook.com" onclick="spawnLink(this);return false;"><img src="images/facebook.png" /><br>Facebook</a></li>
<li class="item"><a href="http://twitter.com" onclick="spawnLink(this);return false;"><img src="images/twitter.png" />Twitter</a></li>
<li class="item"><a href="http://fr.vente-privee.com/" onclick="spawnLink(this);return false;"><img src="images/vp128.png" />Ventes Privées</a></li>
<li class="item"><a href="http://www.google.fr/movies" onclick="spawnLink(this);return false;"><img src="images/Gmovie.png" />Horaires Ciné</a></li>
</ul>
<hr>
</div>';
}
private function setParams($params){
$this->params = $params;
}
public static function start($params){
$links = new links($params);
}
}

+ 20
- 0
class/Notes.php View File

@@ -0,0 +1,20 @@
<?php
class notes {
private $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);
}
}

+ 30
- 0
class/Search.php View File

@@ -0,0 +1,30 @@
<?php
class search {
private $params = array();
public function __construct($params){
echo '<center>
<form method="get" action="http://www.google.fr/custom" target="_top" name="form" id="form">
<table bgcolor="#ffffff" id="recherche">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<input type="text" name="q" id="q" size="31" maxlength="255" value=""></input>
<input type="submit" name="sa" value="Rechercher" class="searchbutton"></input>
<input type="hidden" name="client" value="pub-5878090856826866"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1;"></input>
<input type="hidden" name="hl" value="fr"></input>
</td></tr></table>
</form>
</center>';
}
private function setParams($params){
$this->params = $params;
}
public static function start($params){
$search = new search($params);
}
}

+ 57
- 0
class/Todo.php View File

@@ -0,0 +1,57 @@
<?php
class todo {
private $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="todoList">';
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>';
}
}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);
}
}

+ 26
- 0
class/Weather.php View File

@@ -0,0 +1,26 @@
<?php
class weather {
private $params = array();
public function __construct($params){
$this->setParams($params);
$city = $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'].';">
<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);
}
}

+ 1
- 1
js/getUncompletedTasks.php View File

@@ -11,7 +11,7 @@ function cbfunc(o){
}
function cbfunc2(o){
$('#uncompletedList').append('<li id="'+o.id+'">'+o.content+' - '+o.date_string+' <img src="images/delete.png" id="delete-'+o.id+'"/> <img src="images/complete.png" class="completeTask" id="complete-'+o[i].id+'"/> </li>');
$('#uncompletedList').append('<li id="'+o.id+'">'+o.content+' - '+o.date_string+' <img src="images/delete.png" id="delete-'+o.id+'"/> <img src="images/complete.png" class="completeTask" id="complete-'+o.id+'"/> </li>');
}
$(document).ready(function(){


Loading…
Cancel
Save