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,

This commit is contained in:
Chouchen
2010-09-15 14:55:54 +00:00
parent 14e63a7844
commit 5c60146a97
10 changed files with 300 additions and 2 deletions

57
class/Todo.php Normal file
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);
}
}