Amélioration des scripts AJAX et des styles
Ajout de la fonctionnalité "changement d'options" pour la clockAdvanced
This commit is contained in:
@@ -11,7 +11,8 @@ class blogs extends Module {
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
require('blogs_last_post.php');
|
||||
echo '<script type="text/javascript" src="js/jquery.blogs.js"></script>';
|
||||
echo '<script type="text/javascript" src="js/jquery.blogs.js"></script>
|
||||
<div id="blogs" style="top:'.$params['y'].'; left :'.$params['x'].';"></div>';
|
||||
echo '<a href="#blogLinksManager" id="blog-links-manager"><img src="images/interface/blogs_edit.png" /></a>';
|
||||
echo '<div style="display:none;">
|
||||
<div id="blogLinksManager">
|
||||
@@ -39,7 +40,46 @@ class blogs extends Module {
|
||||
$blogs = new blogs($params);
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
|
||||
public function setX($x){
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='blogs']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='blogs']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='blogs']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -19,9 +19,13 @@ class clockAdvanced extends Module {
|
||||
$options = '';
|
||||
foreach (self::$paramsList as $paramName){
|
||||
if(isset($this->params[$paramName]))
|
||||
$options .= $paramName.' : '.$this->params[$paramName].',';
|
||||
$options .= $paramName.' : "'.$this->params[$paramName].'",';
|
||||
}
|
||||
echo '<script>$(document).ready(function(){
|
||||
$(\'#fontFamily\').val("'.$params['fontFamily'].'");
|
||||
$(\'#fontSize\').val("'.$params['fontSize'].'");
|
||||
$(\'#format\').val("'.$params['format'].'");
|
||||
$(\'#color\').val("'.$params['color'].'");
|
||||
$(\'.jclockAdvanced\').jclock({'.substr($options,0,-1).'});
|
||||
});
|
||||
</script>';
|
||||
@@ -34,6 +38,93 @@ class clockAdvanced extends Module {
|
||||
public static function start($params){
|
||||
$clockAdvanced = new clockAdvanced($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setFontFamily($fontFamily){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->fontFamily = $fontFamily;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setFontSize($fontSize){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->fontSize = $fontSize;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setColor($color){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->color = $color;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
public function setFormat($format){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='clockAdvanced']");
|
||||
$path[0]->format = $format;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -21,6 +21,12 @@ abstract class Module
|
||||
|
||||
abstract static function start($params);
|
||||
|
||||
abstract static function updateConfig($updated);
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -24,6 +24,10 @@ class notes extends Module {
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
return;
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -20,7 +20,7 @@ class todo extends Module {
|
||||
$this->setToken($xmla->token);
|
||||
$this->setProjectName($xmla->name);
|
||||
$this->setProjectId($xmla->id);
|
||||
echo '<div id="todoList">';
|
||||
echo '<div id="todo" style="top:'.$params['y'].'; left :'.$params['x'].';">';
|
||||
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{
|
||||
@@ -30,7 +30,7 @@ class todo extends Module {
|
||||
}
|
||||
echo '<script>
|
||||
$(document).ready(function(){
|
||||
$(\'#todoList\').resizable();
|
||||
$(\'#todo\').resizable();
|
||||
});</script>';
|
||||
}else{
|
||||
echo 'baaaaad persistance...';
|
||||
@@ -66,7 +66,47 @@ class todo extends Module {
|
||||
$todo = new todo($params);
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='todo']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='todo']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='todo']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
return;
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -33,21 +33,6 @@ class weather extends Module {
|
||||
public static function start($params){
|
||||
$weather = new weather($params);
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$params)){
|
||||
switch($what){
|
||||
case 'city':
|
||||
self::setCity($withWhat);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -66,4 +51,48 @@ class weather extends Module {
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setX($x){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setY($y){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->y = $y;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public function setVisibility($visibility){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->visibility = $visibility;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
echo "ok";
|
||||
}
|
||||
|
||||
public static function updateConfig($updated){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user