2010-09-15 16:55:54 +02:00
|
|
|
<?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>';
|
|
|
|
}
|
2010-09-17 15:38:57 +02:00
|
|
|
echo '<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
$(\'#todoList\').resizable();
|
|
|
|
});</script>';
|
2010-09-15 16:55:54 +02:00
|
|
|
}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);
|
|
|
|
}
|
|
|
|
}
|