Accueil/class/Todo.php
2010-09-20 09:40:27 +00:00

72 lines
1.8 KiB
PHP

<?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="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>';
}
echo '<script>
$(document).ready(function(){
$(\'#todoList\').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 static function updateConfig($updated){
return;
}
}