66 lines
1.9 KiB
PHP
66 lines
1.9 KiB
PHP
<?php
|
|
class todo extends Module {
|
|
|
|
protected $moduleTitle = 'Todo List';
|
|
|
|
protected $paramsList = array(
|
|
'visibility',
|
|
'x',
|
|
'y'
|
|
);
|
|
|
|
const TODO_FILE = 'db/todoist.xml';
|
|
|
|
private $token;
|
|
private $project_name;
|
|
private $project_id;
|
|
|
|
public function __construct($params){
|
|
parent::__construct(__CLASS__, $params);
|
|
}
|
|
|
|
public function build(){
|
|
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
|
<link rel="stylesheet" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css" type="text/css" />';
|
|
if($xmla = simplexml_load_file($this->pathToModule.self::TODO_FILE)){
|
|
$this->setToken($xmla->token);
|
|
$this->setProjectName($xmla->name);
|
|
$this->setProjectId($xmla->id);
|
|
echo '<div id="todo" style="top:'.$this->getParam('y').'; left :'.$this->getParam('x').';">';
|
|
if($this->token == null || $this->project_id == null)
|
|
echo 'Impossible de trouver votre configuration. <a href="'.$this->pathToModule.'includes/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="'.$this->pathToModule.'js/getUncompletedTasks.php?token='.$token.'&id='.$id.'"></script>';
|
|
}
|
|
echo '<script>
|
|
$(document).ready(function(){
|
|
$(\'#todo\').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;
|
|
}
|
|
} |