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:
57
class/Todo.php
Normal file
57
class/Todo.php
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user