Version avec modules séparés !
This commit is contained in:
88
modules/blogs/Blogs.php
Normal file
88
modules/blogs/Blogs.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
class blogs extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
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" />';
|
||||
require($this->pathToModule.'includes/blogs_last_post.php');
|
||||
echo '<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">
|
||||
<h3>Blogs Management</h3><br/>
|
||||
<h4>Delete Site feed</h4>
|
||||
<ul>';
|
||||
$blogs = new Blogs_last_post();
|
||||
foreach($blogs->getLinks() as $link)
|
||||
echo '<li>'.$link['url'].' <img src="images/interface/delete.png" id="link-'.$link['name'].'"/></li>';
|
||||
echo '</ul>
|
||||
<h4>Insert Site feed</h4>
|
||||
<form action="modules/blogs/includes/addSite.php" method="POST">
|
||||
<input type="text" id="newLink" name="newLink" value="url" />
|
||||
<input type="submit" id="link-submit" class="green-button" value="Ajouter"></input>
|
||||
</form>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$blogs = new blogs($params);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
0
modules/blogs/css/blogs.css
Normal file
0
modules/blogs/css/blogs.css
Normal file
18
modules/blogs/db/blog_links.xml
Normal file
18
modules/blogs/db/blog_links.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<links>
|
||||
<link>
|
||||
<number>0</number>
|
||||
<name>PenelopeBagieu</name>
|
||||
<url>http://www.penelope-jolicoeur.com/</url>
|
||||
</link>
|
||||
<link>
|
||||
<number>12</number>
|
||||
<name>CyanideAndHapiness</name>
|
||||
<url>http://www.explosm.net/comics/</url>
|
||||
</link>
|
||||
<link>
|
||||
<number>0</number>
|
||||
<name>MargauxMotin</name>
|
||||
<url>http://margauxmotin.typepad.fr/</url>
|
||||
</link>
|
||||
<link><name>test</name><number>n-0</number><url>http://blog-de-vincent.blogspot.com/</url></link></links>
|
251
modules/blogs/includes/CURL.php
Normal file
251
modules/blogs/includes/CURL.php
Normal file
@@ -0,0 +1,251 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* OO cURL Class
|
||||
* Object oriented wrapper for the cURL library.
|
||||
* @author David Hopkins (semlabs.co.uk)
|
||||
* @version 0.3
|
||||
*/
|
||||
class CURL
|
||||
{
|
||||
|
||||
public $sessions = array();
|
||||
public $retry = 0;
|
||||
|
||||
/**
|
||||
* Adds a cURL session to stack
|
||||
* @param $url string, session's URL
|
||||
* @param $opts array, optional array of cURL options and values
|
||||
*/
|
||||
public function addSession( $url, $opts = false )
|
||||
{
|
||||
$this->sessions[] = curl_init( $url );
|
||||
if( $opts != false )
|
||||
{
|
||||
$key = count( $this->sessions ) - 1;
|
||||
$this->setOpts( $opts, $key );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an option to a cURL session
|
||||
* @param $option constant, cURL option
|
||||
* @param $value mixed, value of option
|
||||
* @param $key int, session key to set option for
|
||||
*/
|
||||
public function setOpt( $option, $value, $key = 0 )
|
||||
{
|
||||
curl_setopt( $this->sessions[$key], $option, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of options to a cURL session
|
||||
* @param $options array, array of cURL options and values
|
||||
* @param $key int, session key to set option for
|
||||
*/
|
||||
public function setOpts( $options, $key = 0 )
|
||||
{
|
||||
curl_setopt_array( $this->sessions[$key], $options );
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes as cURL session
|
||||
* @param $key int, optional argument if you only want to execute one session
|
||||
*/
|
||||
public function exec( $key = false )
|
||||
{
|
||||
$no = count( $this->sessions );
|
||||
|
||||
if( $no == 1 )
|
||||
$res = $this->execSingle();
|
||||
elseif( $no > 1 ) {
|
||||
if( $key === false )
|
||||
$res = $this->execMulti();
|
||||
else
|
||||
$res = $this->execSingle( $key );
|
||||
}
|
||||
|
||||
if( $res )
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a single cURL session
|
||||
* @param $key int, id of session to execute
|
||||
* @return array of content if CURLOPT_RETURNTRANSFER is set
|
||||
*/
|
||||
public function execSingle( $key = 0 )
|
||||
{
|
||||
if( $this->retry > 0 )
|
||||
{
|
||||
$retry = $this->retry;
|
||||
$code = 0;
|
||||
while( $retry >= 0 && ( $code[0] == 0 || $code[0] >= 400 ) )
|
||||
{
|
||||
$res = curl_exec( $this->sessions[$key] );
|
||||
$code = $this->info( $key, CURLINFO_HTTP_CODE );
|
||||
|
||||
$retry--;
|
||||
}
|
||||
}
|
||||
else
|
||||
$res = curl_exec( $this->sessions[$key] );
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a stack of sessions
|
||||
* @return array of content if CURLOPT_RETURNTRANSFER is set
|
||||
*/
|
||||
public function execMulti()
|
||||
{
|
||||
$mh = curl_multi_init();
|
||||
|
||||
#Add all sessions to multi handle
|
||||
foreach ( $this->sessions as $i => $url )
|
||||
curl_multi_add_handle( $mh, $this->sessions[$i] );
|
||||
|
||||
do
|
||||
$mrc = curl_multi_exec( $mh, $active );
|
||||
while ( $mrc == CURLM_CALL_MULTI_PERFORM );
|
||||
|
||||
while ( $active && $mrc == CURLM_OK )
|
||||
{
|
||||
if ( curl_multi_select( $mh ) != -1 )
|
||||
{
|
||||
do
|
||||
$mrc = curl_multi_exec( $mh, $active );
|
||||
while ( $mrc == CURLM_CALL_MULTI_PERFORM );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $mrc != CURLM_OK )
|
||||
echo "Curl multi read error $mrc\n";
|
||||
|
||||
#Get content foreach session, retry if applied
|
||||
foreach ( $this->sessions as $i => $url )
|
||||
{
|
||||
$code = $this->info( $i, CURLINFO_HTTP_CODE );
|
||||
if( $code[0] > 0 && $code[0] < 400 )
|
||||
$res[] = curl_multi_getcontent( $this->sessions[$i] );
|
||||
else
|
||||
{
|
||||
if( $this->retry > 0 )
|
||||
{
|
||||
$retry = $this->retry;
|
||||
$this->retry -= 1;
|
||||
$eRes = $this->execSingle( $i );
|
||||
|
||||
if( $eRes )
|
||||
$res[] = $eRes;
|
||||
else
|
||||
$res[] = false;
|
||||
|
||||
$this->retry = $retry;
|
||||
echo '1';
|
||||
}
|
||||
else
|
||||
$res[] = false;
|
||||
}
|
||||
|
||||
curl_multi_remove_handle( $mh, $this->sessions[$i] );
|
||||
}
|
||||
|
||||
curl_multi_close( $mh );
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes cURL sessions
|
||||
* @param $key int, optional session to close
|
||||
*/
|
||||
public function close( $key = false )
|
||||
{
|
||||
if( $key === false )
|
||||
{
|
||||
foreach( $this->sessions as $session )
|
||||
curl_close( $session );
|
||||
}
|
||||
else
|
||||
curl_close( $this->sessions[$key] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all cURL sessions
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
foreach( $this->sessions as $session )
|
||||
curl_close( $session );
|
||||
unset( $this->sessions );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of session information
|
||||
* @param $key int, optional session key to return info on
|
||||
* @param $opt constant, optional option to return
|
||||
*/
|
||||
public function info( $key = false, $opt = false )
|
||||
{
|
||||
if( $key === false )
|
||||
{
|
||||
foreach( $this->sessions as $key => $session )
|
||||
{
|
||||
if( $opt )
|
||||
$info[] = curl_getinfo( $this->sessions[$key], $opt );
|
||||
else
|
||||
$info[] = curl_getinfo( $this->sessions[$key] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $opt )
|
||||
$info[] = curl_getinfo( $this->sessions[$key], $opt );
|
||||
else
|
||||
$info[] = curl_getinfo( $this->sessions[$key] );
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of errors
|
||||
* @param $key int, optional session key to retun error on
|
||||
* @return array of error messages
|
||||
*/
|
||||
public function error( $key = false )
|
||||
{
|
||||
if( $key === false )
|
||||
{
|
||||
foreach( $this->sessions as $session )
|
||||
$errors[] = curl_error( $session );
|
||||
}
|
||||
else
|
||||
$errors[] = curl_error( $this->sessions[$key] );
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of session error numbers
|
||||
* @param $key int, optional session key to retun error on
|
||||
* @return array of error codes
|
||||
*/
|
||||
public function errorNo( $key = false )
|
||||
{
|
||||
if( $key === false )
|
||||
{
|
||||
foreach( $this->sessions as $session )
|
||||
$errors[] = curl_errno( $session );
|
||||
}
|
||||
else
|
||||
$errors[] = curl_errno( $this->sessions[$key] );
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
41
modules/blogs/includes/addSite.php
Normal file
41
modules/blogs/includes/addSite.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?
|
||||
$url = $_POST['newLink'];
|
||||
if($url == '' || !isset($_POST['newLink']))
|
||||
header('Location: index.php');
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="SHORTCUT ICON" href="../favicon.ico"/>
|
||||
<link rel="stylesheet" type="text/css" href="css/main.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/jquery.fancybox-1.3.0.css">
|
||||
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
|
||||
|
||||
<title>Ma Page d'accueil</title>
|
||||
<style>img{max-width:100px;max-height:100px;padding:5px;} img:hover{border:5px solid #00AAFF;padding:0;}</style>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('.choose').click(function(){
|
||||
var id = $(this).attr('id');
|
||||
var url = "<?=$url?>";
|
||||
var name = 'test';
|
||||
$.post('addSiteXML.php', {number: id, url: url, name: name}, function(data){
|
||||
document.location.href="index.php"
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?
|
||||
echo 'URL : '.$url.'<br/>';
|
||||
require('blogs_last_post.php');
|
||||
$opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10);
|
||||
$blogs = new Blogs_last_post();
|
||||
$blogs->addSession($url, $opts);
|
||||
$result = $blogs->exec();
|
||||
echo $blogs->getAllImagesToChoose($result);
|
||||
$blogs->clear();
|
11
modules/blogs/includes/blogs.php
Normal file
11
modules/blogs/includes/blogs.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?
|
||||
require('blogs_last_post.php');
|
||||
$opts = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 10, CURLOPT_CONNECTTIMEOUT => 10);
|
||||
$blogs = new Blogs_last_post();
|
||||
foreach($blogs->getLinks() as $link)
|
||||
{
|
||||
$blogs->addSession($link['url'], $opts);
|
||||
}
|
||||
echo $blogs->getEverything();
|
||||
$blogs->clear();
|
||||
|
177
modules/blogs/includes/blogs_last_post.php
Normal file
177
modules/blogs/includes/blogs_last_post.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?
|
||||
require('CURL.php');
|
||||
class Blogs_last_post extends CURL{
|
||||
|
||||
private $_result;
|
||||
|
||||
/*private $listeImages = array(
|
||||
0 => 0, // penelope
|
||||
1 => 12, //explosm
|
||||
2 => 0, // margaux
|
||||
);
|
||||
|
||||
private $nomImages = array(
|
||||
0 => 'PenelopeBagieu',
|
||||
1 => 'CyanideAndHapiness',
|
||||
2 => 'MargauxMotin',
|
||||
);
|
||||
|
||||
public $link = array(
|
||||
0 => 'http://www.penelope-jolicoeur.com/',
|
||||
1 => 'http://www.explosm.net/comics/',
|
||||
2 => 'http://margauxmotin.typepad.fr/',
|
||||
);*/
|
||||
private $link = array();
|
||||
|
||||
|
||||
function getResult()
|
||||
{
|
||||
return $this->_result;
|
||||
}
|
||||
|
||||
public function getLinks(){
|
||||
if($linksXML = simplexml_load_file('../db/blog_links.xml')){
|
||||
foreach($linksXML->link as $individualLink){
|
||||
$this->link[] = array('name'=>$individualLink->name, 'url'=>$individualLink->url, 'number'=>$individualLink->number);
|
||||
}
|
||||
return $this->link;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
function getTitles()
|
||||
{
|
||||
$xhtml = "";
|
||||
try{
|
||||
foreach($this->exec() as $result)
|
||||
{
|
||||
$xhtml .= $this->getTitle($result);
|
||||
$xhtml .= '<br/>';
|
||||
}
|
||||
}catch(Exception $e)
|
||||
{
|
||||
$xhtml .= $this->error();
|
||||
}
|
||||
return $xhtml;
|
||||
|
||||
}
|
||||
|
||||
function getTitle($result = null, $url = null)
|
||||
{
|
||||
if(isset($result))
|
||||
{
|
||||
preg_match( "/<h3 class=\"entry-header\">(.*)<\/h3>/i", $result, $match );
|
||||
|
||||
if(isset($match[1]))
|
||||
return utf8_decode(strip_tags($match[1]));
|
||||
else{
|
||||
preg_match( "/<title>(.*)<\/title>/i", $result, $title );
|
||||
if(isset($title[1]))
|
||||
return $title[1];
|
||||
else
|
||||
return 'Erreur : pas de titre de blog trouv<75>.';
|
||||
}
|
||||
|
||||
}
|
||||
//TODO en fonction de l'url et non du resultat du cURL
|
||||
}
|
||||
|
||||
function getPost()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function createThumbnail($result, $title = 0)
|
||||
{
|
||||
if(isset($result))
|
||||
{
|
||||
|
||||
preg_match_all( "#<img[^>]+src=['|\"](.*?)['|\"][^>]*>#i", $result, $match );
|
||||
|
||||
/*$ret = file_put_contents('match.txt', var_export($match,true), FILE_APPEND);
|
||||
if ($ret === false)
|
||||
{
|
||||
echo 'erreur';
|
||||
}*/
|
||||
$number = $this->link[$title]['number'];
|
||||
$title = $this->link[$title]['name'];
|
||||
if(isset($match[1][(int)$number]))
|
||||
{
|
||||
$source = @imagecreatefromjpeg($match[1][(int)$number]);
|
||||
if($source == false)
|
||||
$source = @imagecreatefrompng($match[1][(int)$number]);
|
||||
|
||||
$wSource = @imagesx($source);
|
||||
$hSource = @imagesy($source);
|
||||
|
||||
$destination = imagecreatetruecolor(50, 50);
|
||||
@imagecopyresampled($destination, $source, 0, 0, 0, 0, 50, 50, $wSource, $hSource);
|
||||
@imagepng($destination, 'images/blogs/'.$title.'.png');
|
||||
return 'images/blogs/'.$title.'.png';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getImages($notFromGetImage = false)
|
||||
{
|
||||
if($notFromGetImage){
|
||||
//TODO stuff
|
||||
}else{
|
||||
$xhtml = "";
|
||||
$i = 0;
|
||||
try{
|
||||
foreach($this->exec() as $result)
|
||||
{
|
||||
$xhtml .= '<img src="'.$this->createThumbnail($result, $i).'" />';
|
||||
$xhtml .= '<br/>';
|
||||
$i++;
|
||||
}
|
||||
}catch(Exception $e)
|
||||
{
|
||||
$xhtml .= $this->error();
|
||||
}
|
||||
return $xhtml;
|
||||
}
|
||||
}
|
||||
|
||||
function getAllImagesToChoose($result,$notFromGetImage = false)
|
||||
{
|
||||
if($notFromGetImage){
|
||||
//TODO stuff
|
||||
}else{
|
||||
preg_match_all( "#<img[^>]+src=['|\"](.*?)['|\"][^>]*>#i", $result, $match );
|
||||
$nbImages = count($match[1]);
|
||||
$xhtml = 'Liste d\'images : <br/>';
|
||||
|
||||
for($i = 0; $i<$nbImages; $i++){
|
||||
$xhtml .= '<img src="'.$match[1][$i].'" id="n-'.$i.'" class="choose"/><br/>';
|
||||
}
|
||||
return $xhtml;
|
||||
}
|
||||
}
|
||||
|
||||
function getEverything()
|
||||
{
|
||||
$temps_debut = microtime(true);
|
||||
$xhtml = "";
|
||||
$i = 0;
|
||||
try{
|
||||
foreach($this->exec() as $result)
|
||||
{
|
||||
$xhtml .= '<a href="'.$this->link[$i]['url'].'" target="_blank" class="blogLinks"><img src="'.$this->createThumbnail($result, $i).'" /> '.utf8_encode($this->getTitle($result))."</a>";
|
||||
$xhtml .= '<br/>';
|
||||
$i++;
|
||||
}
|
||||
}catch(Exception $e)
|
||||
{
|
||||
$xhtml .= $this->error();
|
||||
}
|
||||
$temps_fin = microtime(true);
|
||||
$xhtml .= 'Temps d\'execution : '.round($temps_fin - $temps_debut, 4).'s';
|
||||
return $xhtml;
|
||||
}
|
||||
|
||||
|
||||
}
|
22
modules/blogs/js/blogs.js
Normal file
22
modules/blogs/js/blogs.js
Normal file
@@ -0,0 +1,22 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#menu-bar').prepend($('#blog-links-manager'));
|
||||
|
||||
//affichage des blogs
|
||||
$("#blogs").html("<img src=\"images/interface/ajax_load.gif\"/> Loading Blogs...");
|
||||
var tmp;
|
||||
|
||||
/* A helper function for converting a set of elements to draggables: */
|
||||
make_draggable($('#blogs'));
|
||||
|
||||
$.ajax(
|
||||
{url : "modules/blogs/includes/blogs.php",
|
||||
timeout : 36000,
|
||||
error: function(data){
|
||||
$("#blogs").html('<img src="images/interface/error.png"/> Délai dépassé !');
|
||||
},
|
||||
success:function(data){
|
||||
$("#blogs").html(data);
|
||||
}
|
||||
});
|
||||
});
|
48
modules/clock/Clock.php
Normal file
48
modules/clock/Clock.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
class clock extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
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" />';
|
||||
echo '<div class="jclock" id="clock" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$clock = new clock($params);
|
||||
}
|
||||
|
||||
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='clock']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
0
modules/clock/css/clock.css
Normal file
0
modules/clock/css/clock.css
Normal file
219
modules/clock/js/clock.js
Normal file
219
modules/clock/js/clock.js
Normal file
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* jQuery jclock - Clock plugin - v 2.3.0
|
||||
* http://plugins.jquery.com/project/jclock
|
||||
*
|
||||
* Copyright (c) 2007-2009 Doug Sparling <http://www.dougsparling.com>
|
||||
* Licensed under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
$.fn.jclock = function(options) {
|
||||
var version = '2.3.0';
|
||||
|
||||
// options
|
||||
var opts = $.extend({}, $.fn.jclock.defaults, options);
|
||||
|
||||
return this.each(function() {
|
||||
$this = $(this);
|
||||
$this.timerID = null;
|
||||
$this.running = false;
|
||||
|
||||
// Record keeping for seeded clock
|
||||
$this.increment = 0;
|
||||
$this.lastCalled = new Date().getTime();
|
||||
|
||||
var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
|
||||
|
||||
$this.format = o.format;
|
||||
$this.utc = o.utc;
|
||||
// deprecate utc_offset (v 2.2.0)
|
||||
$this.utcOffset = (o.utc_offset != null) ? o.utc_offset : o.utcOffset;
|
||||
$this.seedTime = o.seedTime;
|
||||
$this.timeout = o.timeout;
|
||||
|
||||
$this.css({
|
||||
fontFamily: o.fontFamily,
|
||||
fontSize: o.fontSize,
|
||||
backgroundColor: o.background,
|
||||
color: o.foreground
|
||||
});
|
||||
|
||||
// %a
|
||||
$this.daysAbbrvNames = new Array(7);
|
||||
$this.daysAbbrvNames[0] = "Sun";
|
||||
$this.daysAbbrvNames[1] = "Mon";
|
||||
$this.daysAbbrvNames[2] = "Tue";
|
||||
$this.daysAbbrvNames[3] = "Wed";
|
||||
$this.daysAbbrvNames[4] = "Thu";
|
||||
$this.daysAbbrvNames[5] = "Fri";
|
||||
$this.daysAbbrvNames[6] = "Sat";
|
||||
|
||||
// %A
|
||||
$this.daysFullNames = new Array(7);
|
||||
$this.daysFullNames[0] = "Sunday";
|
||||
$this.daysFullNames[1] = "Monday";
|
||||
$this.daysFullNames[2] = "Tuesday";
|
||||
$this.daysFullNames[3] = "Wednesday";
|
||||
$this.daysFullNames[4] = "Thursday";
|
||||
$this.daysFullNames[5] = "Friday";
|
||||
$this.daysFullNames[6] = "Saturday";
|
||||
|
||||
// %b
|
||||
$this.monthsAbbrvNames = new Array(12);
|
||||
$this.monthsAbbrvNames[0] = "Jan";
|
||||
$this.monthsAbbrvNames[1] = "Feb";
|
||||
$this.monthsAbbrvNames[2] = "Mar";
|
||||
$this.monthsAbbrvNames[3] = "Apr";
|
||||
$this.monthsAbbrvNames[4] = "May";
|
||||
$this.monthsAbbrvNames[5] = "Jun";
|
||||
$this.monthsAbbrvNames[6] = "Jul";
|
||||
$this.monthsAbbrvNames[7] = "Aug";
|
||||
$this.monthsAbbrvNames[8] = "Sep";
|
||||
$this.monthsAbbrvNames[9] = "Oct";
|
||||
$this.monthsAbbrvNames[10] = "Nov";
|
||||
$this.monthsAbbrvNames[11] = "Dec";
|
||||
|
||||
// %B
|
||||
$this.monthsFullNames = new Array(12);
|
||||
$this.monthsFullNames[0] = "January";
|
||||
$this.monthsFullNames[1] = "February";
|
||||
$this.monthsFullNames[2] = "March";
|
||||
$this.monthsFullNames[3] = "April";
|
||||
$this.monthsFullNames[4] = "May";
|
||||
$this.monthsFullNames[5] = "June";
|
||||
$this.monthsFullNames[6] = "July";
|
||||
$this.monthsFullNames[7] = "August";
|
||||
$this.monthsFullNames[8] = "September";
|
||||
$this.monthsFullNames[9] = "October";
|
||||
$this.monthsFullNames[10] = "November";
|
||||
$this.monthsFullNames[11] = "December";
|
||||
|
||||
$.fn.jclock.startClock($this);
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.jclock.startClock = function(el) {
|
||||
$.fn.jclock.stopClock(el);
|
||||
$.fn.jclock.displayTime(el);
|
||||
}
|
||||
|
||||
$.fn.jclock.stopClock = function(el) {
|
||||
if(el.running) {
|
||||
clearTimeout(el.timerID);
|
||||
}
|
||||
el.running = false;
|
||||
}
|
||||
|
||||
$.fn.jclock.displayTime = function(el) {
|
||||
var time = $.fn.jclock.getTime(el);
|
||||
el.html(time);
|
||||
el.timerID = setTimeout(function(){$.fn.jclock.displayTime(el)},el.timeout);
|
||||
}
|
||||
|
||||
$.fn.jclock.getTime = function(el) {
|
||||
if(typeof(el.seedTime) == 'undefined') {
|
||||
// Seed time not being used, use current time
|
||||
var now = new Date();
|
||||
} else {
|
||||
// Otherwise, use seed time with increment
|
||||
el.increment += new Date().getTime() - el.lastCalled;
|
||||
var now = new Date(el.seedTime + el.increment);
|
||||
el.lastCalled = new Date().getTime();
|
||||
}
|
||||
|
||||
if(el.utc == true) {
|
||||
var localTime = now.getTime();
|
||||
var localOffset = now.getTimezoneOffset() * 60000;
|
||||
var utc = localTime + localOffset;
|
||||
var utcTime = utc + (3600000 * el.utcOffset);
|
||||
now = new Date(utcTime);
|
||||
}
|
||||
|
||||
var timeNow = "";
|
||||
var i = 0;
|
||||
var index = 0;
|
||||
while ((index = el.format.indexOf("%", i)) != -1) {
|
||||
timeNow += el.format.substring(i, index);
|
||||
index++;
|
||||
|
||||
// modifier flag
|
||||
//switch (el.format.charAt(index++)) {
|
||||
//}
|
||||
|
||||
var property = $.fn.jclock.getProperty(now, el, el.format.charAt(index));
|
||||
index++;
|
||||
|
||||
//switch (switchCase) {
|
||||
//}
|
||||
|
||||
timeNow += property;
|
||||
i = index
|
||||
}
|
||||
|
||||
timeNow += el.format.substring(i);
|
||||
return timeNow;
|
||||
};
|
||||
|
||||
$.fn.jclock.getProperty = function(dateObject, el, property) {
|
||||
|
||||
switch (property) {
|
||||
case "a": // abbrv day names
|
||||
return (el.daysAbbrvNames[dateObject.getDay()]);
|
||||
case "A": // full day names
|
||||
return (el.daysFullNames[dateObject.getDay()]);
|
||||
case "b": // abbrv month names
|
||||
return (el.monthsAbbrvNames[dateObject.getMonth()]);
|
||||
case "B": // full month names
|
||||
return (el.monthsFullNames[dateObject.getMonth()]);
|
||||
case "d": // day 01-31
|
||||
return ((dateObject.getDate() < 10) ? "0" : "") + dateObject.getDate();
|
||||
case "H": // hour as a decimal number using a 24-hour clock (range 00 to 23)
|
||||
return ((dateObject.getHours() < 10) ? "0" : "") + dateObject.getHours();
|
||||
case "I": // hour as a decimal number using a 12-hour clock (range 01 to 12)
|
||||
var hours = (dateObject.getHours() % 12 || 12);
|
||||
return ((hours < 10) ? "0" : "") + hours;
|
||||
case "m": // month number
|
||||
return (((dateObject.getMonth() + 1) < 10) ? "0" : "") + (dateObject.getMonth() + 1);
|
||||
case "M": // minute as a decimal number
|
||||
return ((dateObject.getMinutes() < 10) ? "0" : "") + dateObject.getMinutes();
|
||||
case "p": // either `am' or `pm' according to the given time value,
|
||||
// or the corresponding strings for the current locale
|
||||
return (dateObject.getHours() < 12 ? "am" : "pm");
|
||||
case "P": // either `AM' or `PM' according to the given time value,
|
||||
return (dateObject.getHours() < 12 ? "AM" : "PM");
|
||||
case "S": // second as a decimal number
|
||||
return ((dateObject.getSeconds() < 10) ? "0" : "") + dateObject.getSeconds();
|
||||
case "y": // two-digit year
|
||||
return dateObject.getFullYear().toString().substring(2);
|
||||
case "Y": // full year
|
||||
return (dateObject.getFullYear());
|
||||
case "%":
|
||||
return "%";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// plugin defaults (24-hour)
|
||||
$.fn.jclock.defaults = {
|
||||
format: '%H:%M:%S',
|
||||
utcOffset: 0,
|
||||
utc: false,
|
||||
fontFamily: '',
|
||||
fontSize: '',
|
||||
foreground: '',
|
||||
background: '',
|
||||
seedTime: undefined,
|
||||
timeout: 1000 // 1000 = one second, 60000 = one minute
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
$(document).ready(function(){
|
||||
$('.jclock').jclock(); //l'horloge
|
||||
var tmp;
|
||||
|
||||
/* A helper function for converting a set of elements to draggables: */
|
||||
make_draggable($('.jclock'));
|
||||
|
||||
});
|
133
modules/clockAdvanced/ClockAdvanced.php
Normal file
133
modules/clockAdvanced/ClockAdvanced.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
class clockAdvanced extends Module {
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y',
|
||||
'fontFamily',
|
||||
'fontSize',
|
||||
'format',
|
||||
'color'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
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" />';
|
||||
echo '<div class="jclockAdvanced" id="clockAdvanced" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||||
$options = '';
|
||||
foreach (self::$paramsList as $paramName){
|
||||
if(isset($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>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
0
modules/clockAdvanced/css/clockAdvanced.css
Normal file
0
modules/clockAdvanced/css/clockAdvanced.css
Normal file
237
modules/clockAdvanced/js/clockAdvanced.js
Normal file
237
modules/clockAdvanced/js/clockAdvanced.js
Normal file
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
* jQuery jclock - Clock plugin - v 2.3.0
|
||||
* http://plugins.jquery.com/project/jclock
|
||||
*
|
||||
* Copyright (c) 2007-2009 Doug Sparling <http://www.dougsparling.com>
|
||||
* Licensed under the MIT License:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
$.fn.jclock = function(options) {
|
||||
var version = '2.3.0';
|
||||
|
||||
// options
|
||||
var opts = $.extend({}, $.fn.jclock.defaults, options);
|
||||
|
||||
return this.each(function() {
|
||||
$this = $(this);
|
||||
$this.timerID = null;
|
||||
$this.running = false;
|
||||
|
||||
// Record keeping for seeded clock
|
||||
$this.increment = 0;
|
||||
$this.lastCalled = new Date().getTime();
|
||||
|
||||
var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
|
||||
|
||||
$this.format = o.format;
|
||||
$this.utc = o.utc;
|
||||
// deprecate utc_offset (v 2.2.0)
|
||||
$this.utcOffset = (o.utc_offset != null) ? o.utc_offset : o.utcOffset;
|
||||
$this.seedTime = o.seedTime;
|
||||
$this.timeout = o.timeout;
|
||||
|
||||
$this.css({
|
||||
fontFamily: o.fontFamily,
|
||||
fontSize: o.fontSize,
|
||||
backgroundColor: o.background,
|
||||
color: o.foreground
|
||||
});
|
||||
|
||||
// %a
|
||||
$this.daysAbbrvNames = new Array(7);
|
||||
$this.daysAbbrvNames[0] = "Dim";
|
||||
$this.daysAbbrvNames[1] = "Lun";
|
||||
$this.daysAbbrvNames[2] = "Mar";
|
||||
$this.daysAbbrvNames[3] = "Mer";
|
||||
$this.daysAbbrvNames[4] = "Jeu";
|
||||
$this.daysAbbrvNames[5] = "Ven";
|
||||
$this.daysAbbrvNames[6] = "Sam";
|
||||
|
||||
// %A
|
||||
$this.daysFullNames = new Array(7);
|
||||
$this.daysFullNames[0] = "Dimanche";
|
||||
$this.daysFullNames[1] = "Lundi";
|
||||
$this.daysFullNames[2] = "Mardi";
|
||||
$this.daysFullNames[3] = "Mercredi";
|
||||
$this.daysFullNames[4] = "Jeudi";
|
||||
$this.daysFullNames[5] = "Vendredi";
|
||||
$this.daysFullNames[6] = "Samedi";
|
||||
|
||||
// %b
|
||||
$this.monthsAbbrvNames = new Array(12);
|
||||
$this.monthsAbbrvNames[0] = "Jan";
|
||||
$this.monthsAbbrvNames[1] = "Fev";
|
||||
$this.monthsAbbrvNames[2] = "Mar";
|
||||
$this.monthsAbbrvNames[3] = "Avr";
|
||||
$this.monthsAbbrvNames[4] = "Mai";
|
||||
$this.monthsAbbrvNames[5] = "Jun";
|
||||
$this.monthsAbbrvNames[6] = "Jul";
|
||||
$this.monthsAbbrvNames[7] = "Aou";
|
||||
$this.monthsAbbrvNames[8] = "Sep";
|
||||
$this.monthsAbbrvNames[9] = "Oct";
|
||||
$this.monthsAbbrvNames[10] = "Nov";
|
||||
$this.monthsAbbrvNames[11] = "Dec";
|
||||
|
||||
// %B
|
||||
$this.monthsFullNames = new Array(12);
|
||||
$this.monthsFullNames[0] = "Janvier";
|
||||
$this.monthsFullNames[1] = "Février";
|
||||
$this.monthsFullNames[2] = "Mars";
|
||||
$this.monthsFullNames[3] = "Avril";
|
||||
$this.monthsFullNames[4] = "Mai";
|
||||
$this.monthsFullNames[5] = "Juin";
|
||||
$this.monthsFullNames[6] = "Juillet";
|
||||
$this.monthsFullNames[7] = "Aout";
|
||||
$this.monthsFullNames[8] = "Septembre";
|
||||
$this.monthsFullNames[9] = "Octobre";
|
||||
$this.monthsFullNames[10] = "Novembre";
|
||||
$this.monthsFullNames[11] = "Décembre";
|
||||
|
||||
$.fn.jclock.startClock($this);
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.jclock.startClock = function(el) {
|
||||
$.fn.jclock.stopClock(el);
|
||||
$.fn.jclock.displayTime(el);
|
||||
}
|
||||
|
||||
$.fn.jclock.stopClock = function(el) {
|
||||
if(el.running) {
|
||||
clearTimeout(el.timerID);
|
||||
}
|
||||
el.running = false;
|
||||
}
|
||||
|
||||
$.fn.jclock.displayTime = function(el) {
|
||||
var time = $.fn.jclock.getTime(el);
|
||||
el.html(time);
|
||||
el.timerID = setTimeout(function(){$.fn.jclock.displayTime(el)},el.timeout);
|
||||
}
|
||||
|
||||
$.fn.jclock.getTime = function(el) {
|
||||
if(typeof(el.seedTime) == 'undefined') {
|
||||
// Seed time not being used, use current time
|
||||
var now = new Date();
|
||||
} else {
|
||||
// Otherwise, use seed time with increment
|
||||
el.increment += new Date().getTime() - el.lastCalled;
|
||||
var now = new Date(el.seedTime + el.increment);
|
||||
el.lastCalled = new Date().getTime();
|
||||
}
|
||||
|
||||
if(el.utc == true) {
|
||||
var localTime = now.getTime();
|
||||
var localOffset = now.getTimezoneOffset() * 60000;
|
||||
var utc = localTime + localOffset;
|
||||
var utcTime = utc + (3600000 * el.utcOffset);
|
||||
now = new Date(utcTime);
|
||||
}
|
||||
|
||||
var timeNow = "";
|
||||
var i = 0;
|
||||
var index = 0;
|
||||
while ((index = el.format.indexOf("%", i)) != -1) {
|
||||
timeNow += el.format.substring(i, index);
|
||||
index++;
|
||||
|
||||
// modifier flag
|
||||
//switch (el.format.charAt(index++)) {
|
||||
//}
|
||||
|
||||
var property = $.fn.jclock.getProperty(now, el, el.format.charAt(index));
|
||||
index++;
|
||||
|
||||
//switch (switchCase) {
|
||||
//}
|
||||
|
||||
timeNow += property;
|
||||
i = index
|
||||
}
|
||||
|
||||
timeNow += el.format.substring(i);
|
||||
return timeNow;
|
||||
};
|
||||
|
||||
$.fn.jclock.getProperty = function(dateObject, el, property) {
|
||||
|
||||
switch (property) {
|
||||
case "a": // abbrv day names
|
||||
return (el.daysAbbrvNames[dateObject.getDay()]);
|
||||
case "A": // full day names
|
||||
return (el.daysFullNames[dateObject.getDay()]);
|
||||
case "b": // abbrv month names
|
||||
return (el.monthsAbbrvNames[dateObject.getMonth()]);
|
||||
case "B": // full month names
|
||||
return (el.monthsFullNames[dateObject.getMonth()]);
|
||||
case "d": // day 01-31
|
||||
return ((dateObject.getDate() < 10) ? "0" : "") + dateObject.getDate();
|
||||
case "H": // hour as a decimal number using a 24-hour clock (range 00 to 23)
|
||||
return ((dateObject.getHours() < 10) ? "0" : "") + dateObject.getHours();
|
||||
case "I": // hour as a decimal number using a 12-hour clock (range 01 to 12)
|
||||
var hours = (dateObject.getHours() % 12 || 12);
|
||||
return ((hours < 10) ? "0" : "") + hours;
|
||||
case "m": // month number
|
||||
return (((dateObject.getMonth() + 1) < 10) ? "0" : "") + (dateObject.getMonth() + 1);
|
||||
case "M": // minute as a decimal number
|
||||
return ((dateObject.getMinutes() < 10) ? "0" : "") + dateObject.getMinutes();
|
||||
case "p": // either `am' or `pm' according to the given time value,
|
||||
// or the corresponding strings for the current locale
|
||||
return (dateObject.getHours() < 12 ? "am" : "pm");
|
||||
case "P": // either `AM' or `PM' according to the given time value,
|
||||
return (dateObject.getHours() < 12 ? "AM" : "PM");
|
||||
case "S": // second as a decimal number
|
||||
return ((dateObject.getSeconds() < 10) ? "0" : "") + dateObject.getSeconds();
|
||||
case "y": // two-digit year
|
||||
return dateObject.getFullYear().toString().substring(2);
|
||||
case "Y": // full year
|
||||
return (dateObject.getFullYear());
|
||||
case "%":
|
||||
return "%";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// plugin defaults (24-hour)
|
||||
$.fn.jclock.defaults = {
|
||||
format: '%H:%M:%S',
|
||||
utcOffset: 0,
|
||||
utc: false,
|
||||
fontFamily: '',
|
||||
fontSize: '',
|
||||
foreground: '',
|
||||
background: '',
|
||||
seedTime: undefined,
|
||||
timeout: 1000 // 1000 = one second, 60000 = one minute
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
$(document).ready(function(){
|
||||
$('body').append('<a href="#jca" id="jclockAdvanced-menu"><img src="images/interface/clock_edit.png" /></a><div style="display:none;"><div id="jca"></div></div>');
|
||||
$('#menu-bar').prepend($('#jclockAdvanced-menu'));
|
||||
$('#jca').append('<h3>Options</h3><br/><label for="fontFamily">Font Family : </label><input type="text" id="fontFamily" name="fontFamily"/><br/><label for="fontSize">Font Size : </label><input type="text" id="fontSize" name="fontSize"/><br/><label for="format">Format : </label><input type="text" id="format" name="format"/><br/><label for="color">Color : </label><input type="text" id="color" name="color"/><span id="jca-submit" class="green-button">Enregistrer</span>');
|
||||
$('#jclockAdvanced-menu').fancybox({
|
||||
'zoomSpeedIn' : 600,
|
||||
'zoomSpeedOut' : 500,
|
||||
'easingIn' : 'easeOutBack',
|
||||
'easingOut' : 'easeInBack',
|
||||
'hideOnContentClick': false,
|
||||
'padding' : 15
|
||||
});
|
||||
$('#jca-submit').live('click', function(){
|
||||
var fontFamily = $('#fontFamily').val();
|
||||
var fontSize = $('#fontSize').val();
|
||||
var format = $('#format').val();
|
||||
var color = $('#color').val();
|
||||
if(fontFamily != '' && fontSize != '' && format != '' && color != ''){
|
||||
$.get('ajax/update.php', {id:'clockAdvanced', fontFamily: fontFamily, fontSize:fontSize, format:format, color:color}, function(msg){
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
$('#jca').append('<span class="error">Fields can\'t be empty.</span>');
|
||||
}
|
||||
});
|
||||
});
|
49
modules/gmap/Gmap.php
Normal file
49
modules/gmap/Gmap.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
class gmap extends Module {
|
||||
//TODO rajouter les params en détail
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=fr"></script>
|
||||
<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" />
|
||||
|
||||
<div id="myAdress"><label for="myAdressField"><img src="images/interface/map.png" /> Adresse pour Google Maps :</label><input type="text" name="myAdressField" id="myAdressField" /></div><a href="#map" id="gmapLink"></a><div id="map"><div id="mymap" style="width:400px;height:400px"></div></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$gmap = new gmap($params);
|
||||
}
|
||||
|
||||
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='gmap']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
4
modules/gmap/css/gmap.css
Normal file
4
modules/gmap/css/gmap.css
Normal file
@@ -0,0 +1,4 @@
|
||||
#myAdress{float:right; margin:12px 10px 0 0;}
|
||||
#route {height: 130px;overflow-y: auto;}
|
||||
#global {text-align: center;margin-left: auto; margin-right: auto;}
|
||||
#route {height: 130px;overflow-y: auto;}
|
89
modules/gmap/js/gmap.js
Normal file
89
modules/gmap/js/gmap.js
Normal file
@@ -0,0 +1,89 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
var geocoder = new google.maps.Geocoder();
|
||||
var map;
|
||||
var gmarkers = [];
|
||||
var infowindow;
|
||||
var directions = new google.maps.DirectionsRenderer();
|
||||
var directionsService = new google.maps.DirectionsService();
|
||||
var current_lat = 0;
|
||||
var current_lng = 0;
|
||||
function getCurrentLat() {
|
||||
return current_lat;
|
||||
}
|
||||
function getCurrentLng() {
|
||||
return current_lng;
|
||||
}
|
||||
function addMarker(latlng,title,content,category,icon) {
|
||||
var marker = new google.maps.Marker({
|
||||
map: map,
|
||||
title : title,
|
||||
icon: new google.maps.MarkerImage(icon, new google.maps.Size(57,34)),
|
||||
position: latlng
|
||||
});
|
||||
var html = '<div style="float:left;text-align:left;width:250;">'+content+'</div>'
|
||||
google.maps.event.addListener(marker, "click", function() {
|
||||
if (infowindow) infowindow.close();
|
||||
infowindow = new google.maps.InfoWindow({content: html});
|
||||
infowindow.open(map,marker);
|
||||
map.setCenter(new google.maps.LatLng(latlng.lat(),latlng.lng()),3);
|
||||
});
|
||||
marker.mycategory = category;
|
||||
gmarkers.push(marker);
|
||||
}
|
||||
function geocodeMarker(address,title,content,category,icon) {
|
||||
if (geocoder) {
|
||||
geocoder.geocode( { "address" : address}, function(results, status) {
|
||||
if (status == google.maps.GeocoderStatus.OK) {
|
||||
var latlng = results[0].geometry.location;
|
||||
addMarker(results[0].geometry.location,title,content,category,icon)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function geocodeCenter(address) {
|
||||
if (geocoder) {
|
||||
geocoder.geocode( { "address": address}, function(results, status) {
|
||||
if (status == google.maps.GeocoderStatus.OK) {
|
||||
map.setCenter(results[0].geometry.location);
|
||||
} else {
|
||||
alert("Geocode was not successful for the following reason: " + status);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function initialize() {
|
||||
var myLatlng = new google.maps.LatLng(48.8792,2.34778);
|
||||
var myOptions = {
|
||||
zoom: 11,
|
||||
center: myLatlng,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
}
|
||||
map = new google.maps.Map(document.getElementById("mymap"), myOptions);
|
||||
geocodeCenter("Paris France");
|
||||
google.maps.event.addListener(map,"click",function(event) { if (event) { current_lat=event.latLng.lat();current_lng=event.latLng.lng(); }}) ;
|
||||
directions.setMap(map);
|
||||
directions.setPanel(document.getElementById("route"))
|
||||
}
|
||||
initialize();
|
||||
$('#menu-bar').append($('#myAdress'));
|
||||
$('#map').css({'visibility':'hidden'});
|
||||
$('#gmapLink').fancybox({
|
||||
'transitionIn': 'elastic',
|
||||
'transitionOut': 'elastic',
|
||||
'onClosed': function(){$('#map').css({'visibility':'hidden'});},
|
||||
'onStart': function(){$('#map').css({'visibility':'visible'});}
|
||||
});
|
||||
$('#myAdressField').keydown(function(e){
|
||||
var code = (e.keyCode ? e.keyCode : e.which);
|
||||
if(code == 13) {
|
||||
e.preventDefault();
|
||||
var adress = $(this).val();
|
||||
geocodeMarker(adress,adress,adress,'','http://maps.gstatic.com/intl/fr_ALL/mapfiles/markers/marker_sprite.png');
|
||||
geocodeCenter(adress);
|
||||
$('#gmapLink').trigger('click');
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
81
modules/links/Links.php
Normal file
81
modules/links/Links.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
class links extends Module{
|
||||
|
||||
protected $moduleName;
|
||||
protected $moduleTitle;
|
||||
protected $pathToModule;
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
const LINKS_FILE = 'db/links.xml';
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
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" />
|
||||
<div style="display:none;"><div id="links-add-fancy"></div></div>
|
||||
<div class="appscontainer">';
|
||||
if($links_xml = simplexml_load_file($this->pathToModule.self::LINKS_FILE)){
|
||||
$links = $links_xml->label;
|
||||
foreach($links as $label){
|
||||
//<span class="label">'.$label['id'].'</span>
|
||||
echo '<ul class="iconlist" id="'.$label['id'].'">';
|
||||
foreach($label->link as $link){
|
||||
echo '<li class="iconitem" id="'.$link->title.'"><img src="images/interface/delete.png" class="deleteLink" /><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
|
||||
}
|
||||
echo '</ul>
|
||||
<hr>';
|
||||
}
|
||||
}else{
|
||||
echo 'Can\'t find '.$this->pathToModule.self::LINKS_FILE;
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$links = new links($params);
|
||||
}
|
||||
|
||||
public function setLink($link){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.self::LINKS_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->x = $x;
|
||||
|
||||
$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='links']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
18
modules/links/ajax/listToReserve.php
Normal file
18
modules/links/ajax/listToReserve.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?
|
||||
$reserve = $_POST['reserve'];
|
||||
|
||||
$doc = new DOMDocument;
|
||||
$doc->load('../db/links.xml');
|
||||
|
||||
$xpath = new DOMXpath($doc);
|
||||
|
||||
// Buffering and deleting moved element
|
||||
foreach($xpath->query('label/link[title = "'.$reserve.'"]') as $node) {
|
||||
$buffer = $node;
|
||||
$node->parentNode->removeChild($node);
|
||||
}
|
||||
|
||||
$searchLabel = $xpath->query('reserve');
|
||||
|
||||
$searchLabel->item(0)->appendChild($buffer);
|
||||
$doc->save('../db/links.xml');
|
11
modules/links/ajax/loadReserve.php
Normal file
11
modules/links/ajax/loadReserve.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?
|
||||
if($links_xml = simplexml_load_file("../db/links.xml")){
|
||||
$links = $links_xml->reserve;
|
||||
foreach($links as $label){
|
||||
echo '<ul id="reserveiconlist">';
|
||||
foreach($label->link as $link){
|
||||
echo '<li class="iconitem" id="'.$link->title.'"><img src="images/interface/delete.png" class="deleteLink" /><a href="'.$link->url.'" class="'.$link->onclick.'"><img src="images/links/'.$link->img.'" /><br>'.$link->title.'</a></li>';
|
||||
}
|
||||
echo '</ul> ';
|
||||
}
|
||||
}
|
19
modules/links/ajax/reserveToList.php
Normal file
19
modules/links/ajax/reserveToList.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?
|
||||
$reserve = $_POST['reserve'];
|
||||
|
||||
$doc = new DOMDocument;
|
||||
$doc->load('../db/links.xml');
|
||||
|
||||
$xpath = new DOMXpath($doc);
|
||||
|
||||
// Buffering and deleting moved element
|
||||
foreach($xpath->query('reserve/link[title = "'.$reserve.'"]') as $node) {
|
||||
$buffer = $node;
|
||||
$node->parentNode->removeChild($node);
|
||||
}
|
||||
|
||||
$searchLabel = $xpath->query('label');
|
||||
$lastLabel = $searchLabel->length -1;
|
||||
|
||||
$searchLabel->item($lastLabel)->appendChild($buffer);
|
||||
$doc->save('../db/links.xml');
|
36
modules/links/ajax/update-links-order.php
Normal file
36
modules/links/ajax/update-links-order.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?
|
||||
$label = $_POST['label'];
|
||||
$order = $_POST['order'];
|
||||
$itemMoved = $_POST['itemMoved'];
|
||||
|
||||
$orderArray = explode(',', $order);
|
||||
$itemIndex = 0;
|
||||
|
||||
foreach($orderArray as $index=>$value){
|
||||
if($value == $itemMoved)
|
||||
$itemIndex = (int)$index;
|
||||
}
|
||||
|
||||
$itemAfter = '';
|
||||
if(isset($orderArray[$itemIndex+1]))
|
||||
$itemAfter = $orderArray[$itemIndex+1];
|
||||
|
||||
$doc = new DOMDocument;
|
||||
$doc->load('../db/links.xml');
|
||||
|
||||
$xpath = new DOMXpath($doc);
|
||||
|
||||
// Buffering and deleting moved element
|
||||
foreach($xpath->query('label/link[title = "'.$itemMoved.'"]') as $node) {
|
||||
$buffer = $node;
|
||||
$node->parentNode->removeChild($node);
|
||||
}
|
||||
|
||||
if($itemAfter != ''){
|
||||
$searchLabel = $xpath->query('label[@id="'.$label.'"]/link[title = "'.$itemAfter.'"]')->item(0);
|
||||
$searchLabel->parentNode->insertBefore($buffer, $searchLabel);
|
||||
}else{
|
||||
$searchLabel = $xpath->query('label[@id="'.$label.'"]');
|
||||
$searchLabel->item(0)->appendChild($buffer);
|
||||
}
|
||||
$doc->save('../db/links.xml');
|
165
modules/links/css/links.css
Normal file
165
modules/links/css/links.css
Normal file
@@ -0,0 +1,165 @@
|
||||
#reserve{display:none;background:#000;}
|
||||
.deleteLink{display:none; position:absolute; top:-5px; right:-5px;width:16px !important; height:16px !important;}
|
||||
|
||||
.divider {
|
||||
display:block;
|
||||
font-size:1px;
|
||||
border-width:0px;
|
||||
border-style:solid;
|
||||
border-top-width:1px;
|
||||
margin:9px 0px 4px -2px;
|
||||
border-color:#BFBFBF;
|
||||
}
|
||||
|
||||
ul.iconlist li, ul#reserveiconlist li{
|
||||
/*display:inline-block;*/
|
||||
position:relative;
|
||||
float:left;
|
||||
margin:0 10px 10px 0;
|
||||
text-align:center;
|
||||
font-weight:bold;
|
||||
color:#2D406D;
|
||||
}
|
||||
|
||||
ul.iconlist li a, ul#reserveiconlist li a {
|
||||
display:block;
|
||||
padding:6px;
|
||||
margin:0px;
|
||||
text-align:center;
|
||||
font-weight:bold;
|
||||
|
||||
/*background-color:rgba(235,239,249,0.0);*/
|
||||
background-color:#FFFFFF;
|
||||
cursor:pointer;
|
||||
-webkit-border-radius: 10px;
|
||||
width:96px;
|
||||
/*height:86px;*/
|
||||
height:66px;
|
||||
-webkit-transition: background-color 0.3s ease-out ;
|
||||
|
||||
}
|
||||
|
||||
ul.iconlist li a:hover, ul#reserveiconlist li a:hover {
|
||||
background-color:#ebeff9;
|
||||
-webkit-transition: background-color 0s ease-out ;
|
||||
|
||||
}
|
||||
|
||||
ul.iconlist li.disabled a:hover {
|
||||
background-color:white;
|
||||
opacity:0.5;
|
||||
|
||||
}
|
||||
|
||||
ul.iconlist li.disabled a {
|
||||
background-color:white;
|
||||
opacity:0.5;
|
||||
cursor:default;
|
||||
|
||||
}
|
||||
|
||||
ul.iconlist li a img, ul#reserveiconlist li a img{
|
||||
x-webkit-transition: -webkit-transform 0.3s ease-out ;
|
||||
|
||||
}
|
||||
|
||||
ul.iconlist li a:hover img, ul#reserveiconlist li a:hover{
|
||||
x-webkit-transform: scale(1.1);
|
||||
x-webkit-transition: -webkit-transform 0.0s ease-out ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
ul.iconlist, ul#reserveiconlist {
|
||||
display:block;
|
||||
height:75px;
|
||||
padding:5px;
|
||||
list-style:none;
|
||||
}
|
||||
|
||||
ul.iconlist img, ul#reserveiconlist img{
|
||||
width:64px;
|
||||
height:64px;
|
||||
margin-bottom:1px;
|
||||
}
|
||||
|
||||
div.sidemenu{
|
||||
xbackground:rgba(255,255,255,0.8);
|
||||
x-webkit-border-radius: 5px;
|
||||
xborder: 1px solid rgba(0,0,0,0.3);
|
||||
x-webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
|
||||
width:150px;
|
||||
margin-left: 0px;
|
||||
height:90%;
|
||||
display:none;
|
||||
float:left;
|
||||
border-right:1px solid red;
|
||||
}
|
||||
|
||||
div.appscontainer {
|
||||
width:730px;
|
||||
margin:20px auto;
|
||||
padding:0px;
|
||||
/*background:red;*/
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
xmargin-left:160px;
|
||||
background:rgba(255,255,255,0.8);
|
||||
overflow:auto;
|
||||
|
||||
border: 1px solid rgba(0,0,0,0.3);
|
||||
-webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
|
||||
-moz-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
hr {
|
||||
clear:left;
|
||||
border:none;
|
||||
height:0px;
|
||||
border-bottom:1px solid #eee;
|
||||
}
|
||||
|
||||
.label {
|
||||
display:none;
|
||||
float:Right;
|
||||
padding-top:6px;
|
||||
padding-right:6px;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
.fakelocation {
|
||||
background:white;
|
||||
height:38px;
|
||||
background:-webkit-gradient(linear, left top, left bottom, from(#fff), to(#ebeff9));
|
||||
border-bottom:1px solid #eee;
|
||||
padding:0;
|
||||
display:none;
|
||||
}
|
||||
|
||||
a.getmore {
|
||||
display:block;
|
||||
text-align:right;
|
||||
padding:10px;
|
||||
|
||||
}
|
||||
|
||||
div.url {
|
||||
font-weight:normal;
|
||||
opacity:0;
|
||||
position:absolute;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
ul.iconlist li:hover div.url, ul#reserveiconlist li:hover div.url{
|
||||
opacity:.5;
|
||||
}
|
||||
li.selected {
|
||||
background-color:#D6DEF7 !important;
|
||||
}
|
||||
|
||||
li.vseparator {
|
||||
width:1px;
|
||||
height:86px;
|
||||
background-color:red;
|
||||
}
|
168
modules/links/db/links.xml
Normal file
168
modules/links/db/links.xml
Normal file
@@ -0,0 +1,168 @@
|
||||
<links>
|
||||
<label id="Google Apps">
|
||||
<link>
|
||||
<url>http://mail.google.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>gmail_128.png</img>
|
||||
<title>Gmail</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://mail.live.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>mail-msn.png</img>
|
||||
<title>Hotmail</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://mail1.voila.fr/webmail/fr_FR/login.html</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>voila.png</img>
|
||||
<title>Voila.fr mail</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://calendar.google.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>calendar_128.png</img>
|
||||
<title>GoogleCalendar</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://reader.google.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>reader_128.png</img>
|
||||
<title>Google Reader</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://docs.google.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>docs_128.png</img>
|
||||
<title>Google Docs</title>
|
||||
</link>
|
||||
</label>
|
||||
<label id="Media">
|
||||
<link>
|
||||
<url>http://youtube.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>youtube_128.png</img>
|
||||
<title>YouTube</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://picasaweb.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>picasaweb_128.png</img>
|
||||
<title>PicasaWeb</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://www.netvibes.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>netvibes.png</img>
|
||||
<title>Netvibes</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://www.deviantart.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>deviantART128.png</img>
|
||||
<title>DeviantArt</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>https://www.labanquepostale.fr/index.html</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>banquepostale.png</img>
|
||||
<title>Banque 1</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://www.societegenerale.fr/</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>societegenerale.png</img>
|
||||
<title>Banque 2</title>
|
||||
</link>
|
||||
</label>
|
||||
<label id="Desk Accessories">
|
||||
<link>
|
||||
<url>javascript: openContactList()</url>
|
||||
<onclick></onclick>
|
||||
<img>contacts.png</img>
|
||||
<title>Contacts</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>javascript: openCalculator();</url>
|
||||
<onclick></onclick>
|
||||
<img>calculator.png</img>
|
||||
<title>Calculator</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>javascript: openTodo();</url>
|
||||
<onclick></onclick>
|
||||
<img>tasks.png</img>
|
||||
<title>To-do list</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>javascript: openCalendar();</url>
|
||||
<onclick></onclick>
|
||||
<img>calendar_128.png</img>
|
||||
<title>Calendar Panel</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>javascript: openNotepad();</url>
|
||||
<onclick></onclick>
|
||||
<img>notepad.png</img>
|
||||
<title>NotePad</title>
|
||||
</link>
|
||||
</label>
|
||||
<label id="Entertainment">
|
||||
<link>
|
||||
<url>http://facebook.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>facebook.png</img>
|
||||
<title>Facebook</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://twitter.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>twitter.png</img>
|
||||
<title>Twitter</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://fr.vente-privee.com/</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>vp128.png</img>
|
||||
<title>Ventes Privées</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://www.google.fr/movies</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>Gmovie.png</img>
|
||||
<title>Horaires Ciné</title>
|
||||
</link>
|
||||
</label>
|
||||
<reserve>
|
||||
<link>
|
||||
<url>http://fr.mail.yahoo.com/</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>mail-yahoo.png</img>
|
||||
<title>Yahoo Mail</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://www.meebo.com/messenger/</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>meebo.png</img>
|
||||
<title>Meebo</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://www.mail.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>mailcom.png</img>
|
||||
<title>Mail.com</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://www.xp-dev.com</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>xp-dev.png</img>
|
||||
<title>XP-DEV</title>
|
||||
</link>
|
||||
<link>
|
||||
<url>http://www.leboncoin.fr</url>
|
||||
<onclick>popup</onclick>
|
||||
<img>leboncoin.gif</img>
|
||||
<title>LeBonCoin</title>
|
||||
</link>
|
||||
</reserve>
|
||||
</links>
|
80
modules/links/js/links.js
Normal file
80
modules/links/js/links.js
Normal file
@@ -0,0 +1,80 @@
|
||||
$(document).ready(function(){
|
||||
// Réglage des options
|
||||
$('body').append('<img src="images/interface/link_edit.png" id="links-menu" />');
|
||||
$('body').append('<img src="images/interface/link_add.png" id="links-add-menu" />');
|
||||
$('#menu-bar').prepend($('#links-menu'));
|
||||
$('#menu-bar').prepend($('#links-add-menu'));
|
||||
$('#links-add-fancy').append('<form action="addLink.php" enctype="multipart/form-data" method="POST"><label for="urlField">URL : </label><input type="text" name="urlField" id="urlField"/><br/><label for="popupField">popup ? </label><input type="checkbox" name="popupField" id="popupField" checked="checked" value="1" /><br/><label for="imgField">Icône : </label><input type="file" name="imgField" id="imgField"/><br/><label for="titreField">Titre : </label><input type="text" name="titreField" id="titreField"/><br/><input type="submit" class="green-button" id="links-add-submit" value="Envoyer"/></form>');
|
||||
|
||||
// Apparition du menu d'ajout de lien
|
||||
$('#links-add-menu').live('click', function(){
|
||||
$.fancybox(
|
||||
$('#links-add-fancy').html()
|
||||
);
|
||||
});
|
||||
|
||||
// Apparition de la reserve de liens
|
||||
$('#links-menu').live('click', function(){
|
||||
$.get('modules/links/ajax/loadReserve.php', function(html){
|
||||
$.fancybox(
|
||||
html,
|
||||
{
|
||||
'autoDimensions' : false,
|
||||
'width' : 400,
|
||||
'height' : 'auto',
|
||||
'showNavArrows' : false,
|
||||
'transitionIn' : 'elastic'
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// Passage Reserve => Liste
|
||||
$('#reserveiconlist .iconitem').live('click', function(e){
|
||||
e.preventDefault();
|
||||
$.post("modules/links/ajax/reserveToList.php", {reserve: $(this).attr('id')});
|
||||
$('.iconlist').last().append('<li class="iconitem" id="'+$(this).attr('id')+'">'+$(this).html()+'</li>');
|
||||
$.fancybox.close();
|
||||
});
|
||||
|
||||
|
||||
//Passage Liste => Reserve
|
||||
$('.iconitem').mouseover(function(){
|
||||
$(this).children('.deleteLink').show();
|
||||
});
|
||||
$('.iconitem').mouseout(function(){
|
||||
$(this).children('.deleteLink').hide();
|
||||
});
|
||||
|
||||
$('.deleteLink').click(function(){
|
||||
$.post("modules/links/ajax/listToReserve.php", {reserve: $(this).parent().attr('id')});
|
||||
$(this).parent().fadeOut();
|
||||
});
|
||||
|
||||
// Mouvement des liens avec enregistrement
|
||||
$(".iconlist").sortable(
|
||||
{
|
||||
connectWith: '.iconlist',
|
||||
update: function(event,ui){
|
||||
var linkOrder = $(this).sortable('toArray').toString();
|
||||
var label = $(ui.item).parent()[0].id;
|
||||
var itemMoved = $(ui.item)[0].id;
|
||||
$.post("modules/links/ajax/update-links-order.php", {order: linkOrder, label : label, itemMoved: itemMoved});
|
||||
},
|
||||
start: function(e) {
|
||||
// have to remvoe click handler off item so drop doesn't click
|
||||
$("a.popup").unbind("click");
|
||||
}
|
||||
}
|
||||
).disableSelection().mouseout(function(){
|
||||
// reattach the item click handler
|
||||
$('a.popup').unbind("click").bind("click", function(e){
|
||||
e.preventDefault();
|
||||
var url = $(this).attr('href');
|
||||
spawnURL(url);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
49
modules/mappy/Mappy.php
Normal file
49
modules/mappy/Mappy.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
class mappy extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
|
||||
echo '<script src="http://axe.mappy.com/1v1/init/get.aspx?version=2.01&solution=ajax&auth=HbTTpMfC4//GWuldL2IsF+HJA4xVuTBsIQi0wcC7xRz+e17hobrJ+1947aq34rdjYAPy6nBYBQF8o56Qzdun9w=="></script>
|
||||
<div id="mymap"></div>
|
||||
<div id="myAdress"><input type="text" name="myAdressField" id="myAdressField" /></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
|
||||
$mappy = new mappy($params);
|
||||
}
|
||||
|
||||
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='mappy']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
2
modules/mappy/css/mappy.css
Normal file
2
modules/mappy/css/mappy.css
Normal file
@@ -0,0 +1,2 @@
|
||||
#mymap{display:none;z-index:900;width:400px;height:400px;}
|
||||
#myAdress{float:right; margin:12px 10px 0 0;}
|
34
modules/mappy/js/mappy.js
Normal file
34
modules/mappy/js/mappy.js
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#menu-bar').append($('#myAdress'));
|
||||
$('#myAdressField').keydown(function(e){
|
||||
var code = (e.keyCode ? e.keyCode : e.which);
|
||||
if(code == 13) {
|
||||
var adress = $(this).val();
|
||||
geocode(adress);
|
||||
$('#mymap').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function geocode (addr)
|
||||
{
|
||||
var geo = new Mappy.api.geolocation.Geocoder();
|
||||
geo.geocode(addr, function (results)
|
||||
{
|
||||
var map = new Mappy.api.map.Map({
|
||||
container:"#mymap"
|
||||
});
|
||||
var scalePosition = new Mappy.api.map.tools.ToolPosition('lb', new Mappy.api.types.Point(10, 0));
|
||||
var scale = new Mappy.api.map.tools.Scale(scalePosition);
|
||||
map.addTool(scale);
|
||||
var latitude = results[0].Placemark.Point.coordinates[0];
|
||||
var longitude = results[0].Placemark.Point.coordinates[1];
|
||||
var markerLayer = new Mappy.api.map.layer.MarkerLayer(40);
|
||||
map.addLayer(markerLayer);
|
||||
var icon = new Mappy.api.ui.Icon(Mappy.api.ui.Icon.DEFAULT);
|
||||
var marker = new Mappy.api.map.Marker(new Mappy.api.geo.Coordinates(latitude, longitude), icon);
|
||||
markerLayer.addMarker(marker);
|
||||
map.setCenter(new Mappy.api.geo.Coordinates(latitude,longitude),7);
|
||||
});
|
||||
}
|
60
modules/news/News.php
Normal file
60
modules/news/News.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
class news {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="http://www.google.com/jsapi"></script>
|
||||
<div id="news"></div>
|
||||
<script type="text/javascript">
|
||||
google.load("elements", "1", {packages : ["newsshow"]});
|
||||
function onLoad() {
|
||||
var options = {
|
||||
"format" : "300x250",
|
||||
"language" : "fr",
|
||||
"linkTarget" : "_blank"
|
||||
}
|
||||
// Load it using all of the defaults.
|
||||
var content = document.getElementById(\'news\');
|
||||
var newsShow = new google.elements.NewsShow(content, options);
|
||||
make_draggable($(\'#news\'));
|
||||
}
|
||||
|
||||
|
||||
google.setOnLoadCallback(onLoad);
|
||||
</script>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$news = new news($params);
|
||||
}
|
||||
|
||||
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='news']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
51
modules/notes/Notes.php
Normal file
51
modules/notes/Notes.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
class notes extends Module {
|
||||
|
||||
protected $moduleName;
|
||||
protected $moduleTitle;
|
||||
protected $pathToModule;
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">
|
||||
<a id="addButton" class="green-button" href="'.$this->pathToModule.'includes/add_note.html">Add a note</a>';
|
||||
include $this->pathToModule.'includes/notes_extract.php';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$notes = new notes($params);
|
||||
}
|
||||
|
||||
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='notes']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
modules/notes/ajax/update_position.php
Normal file
22
modules/notes/ajax/update_position.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// Error reporting
|
||||
error_reporting(E_ALL^E_NOTICE);
|
||||
|
||||
// Validating the input data:
|
||||
if(!is_numeric($_GET['id']) || !is_numeric($_GET['x']) || !is_numeric($_GET['y']) || !is_numeric($_GET['z']))
|
||||
die("0");
|
||||
|
||||
// Escaping:
|
||||
$id = (int)$_GET['id'];
|
||||
$x = (int)$_GET['x'];
|
||||
$y = (int)$_GET['y'];
|
||||
$z = (int)$_GET['z'];
|
||||
|
||||
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../db/notes.xml');
|
||||
|
||||
$target = -1;
|
||||
$i = 0;
|
||||
|
||||
foreach ($xmla->note as $s) {
|
118
modules/notes/css/notes.css
Normal file
118
modules/notes/css/notes.css
Normal file
@@ -0,0 +1,118 @@
|
||||
.note{
|
||||
height:150px;
|
||||
padding:10px;
|
||||
width:150px;
|
||||
position:absolute;
|
||||
overflow:hidden;
|
||||
cursor:move;
|
||||
|
||||
font-family:Trebuchet MS,Tahoma,Myriad Pro,Arial,Verdana,sans-serif;
|
||||
font-size:22px;
|
||||
|
||||
/* Adding a CSS3 shadow below the note, in the browsers which support it: */
|
||||
-moz-box-shadow:2px 2px 0 #DDDDDD;
|
||||
-webkit-box-shadow:2px 2px 0 #DDDDDD;
|
||||
box-shadow:2px 2px 0 #DDDDDD;
|
||||
}
|
||||
|
||||
#fancy_ajax .note{ cursor:default; }
|
||||
|
||||
/* Three styles for the notes: */
|
||||
|
||||
.yellow{
|
||||
background-color:#FDFB8C;
|
||||
border:1px solid #DEDC65;
|
||||
}
|
||||
|
||||
.blue{
|
||||
background-color:#A6E3FC;
|
||||
border:1px solid #75C5E7;
|
||||
}
|
||||
|
||||
.green{
|
||||
background-color:#A5F88B;
|
||||
border:1px solid #98E775;
|
||||
}
|
||||
|
||||
/* Each note has a data span, which holds its ID */
|
||||
span.data{ display:none; }
|
||||
|
||||
/* The "Add a note" button: */
|
||||
#addButton{
|
||||
position:absolute;
|
||||
top:10px;
|
||||
left:10;
|
||||
}
|
||||
|
||||
|
||||
.author{
|
||||
/* The author name on the note: */
|
||||
bottom:10px;
|
||||
color:#666666;
|
||||
font-family:Arial,Verdana,sans-serif;
|
||||
font-size:12px;
|
||||
position:absolute;
|
||||
right:10px;
|
||||
}
|
||||
|
||||
#main{
|
||||
/* Contains all the notes and limits their movement: */
|
||||
margin:0 auto;
|
||||
position:relative;
|
||||
width:980px;
|
||||
height:500px;
|
||||
z-index:10;
|
||||
/*background:url(../images/add_a_note_help.gif) no-repeat left top;*/
|
||||
}
|
||||
|
||||
h3.popupTitle{
|
||||
border-bottom:1px solid #DDDDDD;
|
||||
color:#666666;
|
||||
font-size:24px;
|
||||
font-weight:normal;
|
||||
padding:0 0 5px;
|
||||
}
|
||||
|
||||
#noteData{
|
||||
/* The input form in the pop-up: */
|
||||
height:200px;
|
||||
margin:30px 0 0 200px;
|
||||
width:350px;
|
||||
}
|
||||
|
||||
.note-form label{
|
||||
display:block;
|
||||
font-size:10px;
|
||||
font-weight:bold;
|
||||
letter-spacing:1px;
|
||||
text-transform:uppercase;
|
||||
padding-bottom:3px;
|
||||
}
|
||||
|
||||
.note-form textarea, .note-form input[type=text]{
|
||||
background-color:#FCFCFC;
|
||||
border:1px solid #AAAAAA;
|
||||
font-family:Arial,Verdana,sans-serif;
|
||||
font-size:16px;
|
||||
height:60px;
|
||||
padding:5px;
|
||||
width:300px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
.note-form input[type=text]{ height:auto; }
|
||||
|
||||
.color{
|
||||
/* The color swatches in the form: */
|
||||
cursor:pointer;
|
||||
float:left;
|
||||
height:10px;
|
||||
margin:0 5px 0 0;
|
||||
width:10px;
|
||||
}
|
||||
|
||||
#note-submit{ margin:20px auto; }
|
||||
.delete {display:none; height:16px; width:16px; background:url(../../../images/interface/delete.png) top left no-repeat; position:absolute; top:5px; right:5px; z-index:9999;}
|
||||
.delete:hover{cursor:pointer !important;}
|
||||
|
||||
|
6
modules/notes/db/notes.xml
Normal file
6
modules/notes/db/notes.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Notes>
|
||||
|
||||
|
||||
|
||||
<note id="2"><text>Test de post-it.</text><color>green</color><zindex>1</zindex><top>153</top><left>53</left></note><note id="7"><text>/!\ C'est bien fait ? :)</text><color>yellow</color><zindex>1</zindex><top>85</top><left>1038</left></note><note id="10"><text>Des améliorations ?</text><color>yellow</color><zindex>1</zindex><top>264</top><left>1038</left></note><note id="11"><text>Application android pour les horaires et prix des trains à faire</text><color>blue</color><zindex>2</zindex><top>586</top><left>916</left></note></Notes>
|
26
modules/notes/includes/add_note.html
Normal file
26
modules/notes/includes/add_note.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<h3 class="popupTitle">Add a new note</h3>
|
||||
|
||||
<!-- The preview: -->
|
||||
<div id="previewNote" class="note yellow" style="left:0;top:65px;z-index:1">
|
||||
<div class="delete"></div>
|
||||
<div class="body"></div>
|
||||
<div class="author"></div>
|
||||
<span class="data"></span>
|
||||
</div>
|
||||
|
||||
<div id="noteData"> <!-- Holds the form -->
|
||||
<form action="" method="post" class="note-form">
|
||||
|
||||
<label for="note-body">Texte de la note</label>
|
||||
<textarea name="note-body" id="note-body" class="pr-body" cols="30" rows="6"></textarea>
|
||||
|
||||
<label>Couleur</label> <!-- Clicking one of the divs changes the color of the preview -->
|
||||
<div class="color yellow"></div>
|
||||
<div class="color blue"></div>
|
||||
<div class="color green"></div>
|
||||
|
||||
<!-- The green submit button: -->
|
||||
<a id="note-submit" href="" class="green-button">Enregistrer</a>
|
||||
|
||||
</form>
|
||||
</div>
|
8
modules/notes/includes/notes_extract.php
Normal file
8
modules/notes/includes/notes_extract.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php $nb = 0;
|
||||
$notes = simplexml_load_file('modules/notes/db/notes.xml');
|
||||
foreach($notes as $test){$nb++;}
|
||||
for($i=0; $i<$nb; $i++){?>
|
||||
<div class="note <?echo $notes->note[$i]->color;?>" style="position:absolute; left:<? echo $notes->note[$i]->left;?>; top:<? echo $notes->note[$i]->top;?>;z-index:<? echo $notes->note[$i]->zindex;?>;"><div class="delete" id="r-<?echo $notes->note[$i]['id'];?>"></div><? echo $notes->note[$i]->text;?><br/><span class="data"><?echo $notes->note[$i]['id'];?></span></div>
|
||||
<?}?>
|
||||
|
||||
|
130
modules/notes/js/notes.js
Normal file
130
modules/notes/js/notes.js
Normal file
@@ -0,0 +1,130 @@
|
||||
$(document).ready(function(){
|
||||
$('.delete').css({"display":"none"});//initialisation des delete
|
||||
|
||||
//passage au dessus des notes
|
||||
$('.note').hover(function () {
|
||||
$(this).find('.delete').css({"display":"block"});
|
||||
},
|
||||
function () {
|
||||
$(this).find('.delete').css({"display":"none"});
|
||||
});
|
||||
|
||||
//click sur delete
|
||||
$('.delete').click(function(){
|
||||
var data2 = {'id' : $(this).attr("id")};
|
||||
$(this).replaceWith('<img src="images/interface/ajax_load.gif" style="display:block" />');
|
||||
/* Sending an AJAX POST request: */
|
||||
$.post('modules/notes/ajax/delete-notes.php',data2,function(msg2){
|
||||
if(parseInt(msg2))
|
||||
{
|
||||
msg2--;
|
||||
//alert(msg2);
|
||||
$(".note:eq("+msg2+")").fadeOut();
|
||||
}
|
||||
|
||||
//$(this).parent('.note').hide();
|
||||
});
|
||||
});
|
||||
|
||||
var tmp;
|
||||
|
||||
$('.note').each(function(){
|
||||
/* Finding the biggest z-index value of the notes */
|
||||
|
||||
tmp = $(this).css('z-index');
|
||||
if(tmp>zIndex) zIndex = tmp;
|
||||
})
|
||||
|
||||
/* A helper function for converting a set of elements to draggables: */
|
||||
make_draggable($('.note'));
|
||||
|
||||
/* Configuring the fancybox plugin for the "Add a note" button: */
|
||||
$("#addButton").fancybox({
|
||||
'zoomSpeedIn' : 600,
|
||||
'zoomSpeedOut' : 500,
|
||||
'easingIn' : 'easeOutBack',
|
||||
'easingOut' : 'easeInBack',
|
||||
'hideOnContentClick': false,
|
||||
'padding' : 15
|
||||
});
|
||||
|
||||
/* Listening for keyup events on fields of the "Add a note" form: */
|
||||
$('.pr-body,.pr-author').live('keyup',function(e){
|
||||
|
||||
if(!this.preview)
|
||||
this.preview=$('#previewNote');
|
||||
|
||||
/* Setting the text of the preview to the contents of the input field, and stripping all the HTML tags: */
|
||||
this.preview.find($(this).attr('class').replace('pr-','.')).html($(this).val().replace(/<[^>]+>/ig,''));
|
||||
});
|
||||
|
||||
/* Changing the color of the preview note: */
|
||||
$('.color').live('click',function(){
|
||||
|
||||
$('#previewNote').removeClass('yellow green blue').addClass($(this).attr('class').replace('color',''));
|
||||
});
|
||||
/* The submit button: */
|
||||
$('#note-submit').live('click',function(e){
|
||||
|
||||
if($('.pr-body').val().length<4)
|
||||
{
|
||||
alert("The note text is too short!")
|
||||
return false;
|
||||
}
|
||||
|
||||
/*if($('.pr-author').val().length<1)
|
||||
{
|
||||
alert("You haven't entered your name!")
|
||||
return false;
|
||||
}*/
|
||||
|
||||
$(this).replaceWith('<img src="images/interface/ajax_load.gif" style="margin:30px auto;display:block" />');
|
||||
|
||||
var data = {
|
||||
'zindex' : ++zIndex,
|
||||
'body' : $('.pr-body').val(),
|
||||
/*'author' : $('.pr-author').val(),*/
|
||||
'color' : $.trim($('#previewNote').attr('class').replace('note',''))
|
||||
};
|
||||
|
||||
/* Sending an AJAX POST request: */
|
||||
$.post('modules/notes/ajax/post-notes.php',data,function(msg){
|
||||
|
||||
if(parseInt(msg))
|
||||
{
|
||||
/* msg contains the ID of the note, assigned by MySQL's auto increment: */
|
||||
var tmp = $('#previewNote').clone();
|
||||
//tmp.find('.delete').attr('id',msg);
|
||||
tmp.find('span.data').text(msg).end().css({'z-index':zIndex,top:0,left:0});
|
||||
tmp.appendTo('body');
|
||||
|
||||
make_draggable(tmp)
|
||||
}
|
||||
|
||||
//$.fn.fancybox.close;
|
||||
$.fancybox.close();
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
var zIndex = 0;
|
||||
|
||||
function make_draggable(elements)
|
||||
{
|
||||
/* Elements is a jquery object: */
|
||||
elements.draggable({
|
||||
containment:'parent',
|
||||
start:function(e,ui){ ui.helper.css('z-index',++zIndex); },
|
||||
stop:function(e,ui){
|
||||
|
||||
/* Sending the z-index and positon of the note to update_position.php via AJAX GET: */
|
||||
$.get('modules/notes/ajax/update_position.php',{
|
||||
x : ui.position.left,
|
||||
y : ui.position.top,
|
||||
z : zIndex,
|
||||
id : parseInt(ui.helper.find('span.data').html())
|
||||
});
|
||||
}
|
||||
});}
|
||||
});
|
48
modules/ouifm/Ouifm.php
Normal file
48
modules/ouifm/Ouifm.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
class ouifm extends Module {
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
|
||||
echo '<div id="ouifm" style="left:'.$params['x'].'; top:'.$params['y'].';"></div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$ouifm = new ouifm($params);
|
||||
}
|
||||
|
||||
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='ouifm']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
0
modules/ouifm/css/ouifm.css
Normal file
0
modules/ouifm/css/ouifm.css
Normal file
12
modules/ouifm/js/ouifm.js
Normal file
12
modules/ouifm/js/ouifm.js
Normal file
@@ -0,0 +1,12 @@
|
||||
$(document).ready(function(){
|
||||
$('body').append('<img src="images/interface/music.png" id="ouifm-menu"/>');
|
||||
$('#menu-bar').prepend($('#ouifm-menu'));
|
||||
|
||||
$('#ouifm-menu').click(function(){
|
||||
var radioUrl_adswizz="http://ouifm.ice.infomaniak.ch/ouifm-high.mp3";
|
||||
// radioUrl_adswizz=com_adswizz_synchro_decorateUrl(radioUrl_adswizz);
|
||||
|
||||
var player_object_adswizz='<object data="http://www.ouifm.fr/scripts_player/miniPlayer.swf" name="name_player_radio_1829" id="id_player_radio_894_1829" type="application/x-shockwave-flash" height="28" width="144"><param value="false" name="menu"><param value="always" name="AllowScriptAccess"><param value="transparent" name="wmode"><param value="noscale" name="scale"><param value="lt" name="salign"><param value="#ffffff" name="bgcolor"><param value="high" name="quality"><param value="false" name="allowfullscreen"><param value="objId=id_player_radio_894_1829&paramCurrentAudioMode=liveMP3&paramServerUrl=&paramStreamName=&paramStreamUrl='+escape(radioUrl_adswizz)+'&paramBackgroundColor=0x000000&paramButtonsColor=0xcccccc&paramErrorColor=0xff0000&paramAutoplay=1&paramSoundValue=100&paramFlashCookie=0&paramCallback=1" name="flashvars"></object>';
|
||||
$('#ouifm').html(player_object_adswizz);
|
||||
});
|
||||
});
|
87
modules/rssblogs/Rssblogs.php
Normal file
87
modules/rssblogs/Rssblogs.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
class rssblogs extends Module {
|
||||
//TODO rajouter les params en d<>tail
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
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" />';
|
||||
require('class/lastRSS.php');
|
||||
$rss = new lastRSS;
|
||||
// options lastRSS
|
||||
$rss->cache_dir = './cache'; // dossier pour le cache
|
||||
$rss->cache_time = 3600; // fr<66>quence de mise <20> jour du cache (en secondes)
|
||||
$rss->date_format = 'd/m/y'; // format de la date (voir fonction date() pour syntaxe)
|
||||
$rss->CDATA = 'content'; // on retire les tags CDATA en conservant leur contenu
|
||||
if($linksXML = simplexml_load_file($this->pathToModule.'db/rss.xml')){
|
||||
foreach($linksXML->link as $individualLink){
|
||||
if ($rs = $rss->get($individualLink->url))
|
||||
echo '<span class="date">'.$rs['items'][0]['pubDate'].'</span> <a href="'.$rs['items'][0]['link'].'">'.$rs['items'][0]['title'].'</a><br />';
|
||||
else
|
||||
echo 'Flux RSS non trouv<75>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$rssblogs = new rssblogs($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='rssblogs']");
|
||||
$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='rssblogs']");
|
||||
$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='rssblogs']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
18
modules/rssblogs/css/rssblogs.css
Normal file
18
modules/rssblogs/css/rssblogs.css
Normal file
@@ -0,0 +1,18 @@
|
||||
#rssblogs {padding:5px;width:350px;-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;border: 1px solid rgba(0,0,0,0.3);
|
||||
-webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
|
||||
-moz-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
|
||||
overflow:hidden;}
|
||||
|
||||
|
||||
.ui-resizable { position: relative;}
|
||||
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; background-position: -80px -224px;background-image: url(../images/interface/ui-icons_888888_256x240.png);}
|
||||
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
||||
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
|
||||
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
|
||||
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
|
||||
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
|
||||
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
||||
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
||||
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
||||
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
|
15
modules/rssblogs/db/rss.xml
Normal file
15
modules/rssblogs/db/rss.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<links>
|
||||
<link>
|
||||
<name>PenelopeBagieu</name>
|
||||
<url>http://feeds.feedburner.com/BlogPenelopeJolicoeur</url>
|
||||
</link>
|
||||
<link>
|
||||
<name>CyanideAndHapiness</name>
|
||||
<url>http://feeds.feedburner.com/Explosm</url>
|
||||
</link>
|
||||
<link>
|
||||
<name>MargauxMotin</name>
|
||||
<url>http://margauxmotin.typepad.fr/margaux_motin/rss.xml</url>
|
||||
</link>
|
||||
</links>
|
0
modules/rssblogs/js/rssblogs.js
Normal file
0
modules/rssblogs/js/rssblogs.js
Normal file
62
modules/search/Search.php
Normal file
62
modules/search/Search.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
class search extends Module {
|
||||
|
||||
protected $moduleName;
|
||||
protected $moduleTitle;
|
||||
protected $pathToModule;
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility'
|
||||
);
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/search.css">
|
||||
<script type="text/javascript" src="'.$this->pathToModule.'js/jquery.search.js"></script>
|
||||
<form id="searchForm" method="post">
|
||||
<fieldset>
|
||||
<input id="s" type="text" />
|
||||
<input type="submit" value="Submit" id="submitButton" class="searchbutton" />
|
||||
|
||||
<ul class="icons">
|
||||
<li class="web" title="Web Search" data-searchType="web">Web</li>
|
||||
<li class="images" title="Image Search" data-searchType="images">Images</li>
|
||||
<li class="news" title="News Search" data-searchType="news">News</li>
|
||||
<li class="videos" title="Video Search" data-searchType="video">Videos</li>
|
||||
</ul>
|
||||
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$search = new search($params);
|
||||
}
|
||||
|
||||
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='search']");
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
164
modules/search/css/search.css
Normal file
164
modules/search/css/search.css
Normal file
@@ -0,0 +1,164 @@
|
||||
#searchForm{
|
||||
/* The search form. */
|
||||
width:525px;
|
||||
/*background-color:#4C5A65;
|
||||
padding:50px 50px 30px;*/
|
||||
margin:0 auto;
|
||||
position:relative;
|
||||
|
||||
-moz-border-radius:16px;
|
||||
-webkit-border-radius:16px;
|
||||
border-radius:16px;
|
||||
}
|
||||
|
||||
fieldset{
|
||||
border:none;
|
||||
}
|
||||
|
||||
#s{
|
||||
/* The search text box. */
|
||||
|
||||
border:none;
|
||||
color:#888888;
|
||||
/*background:url("../images/interface/searchBox.png") no-repeat;*/
|
||||
background:url('../../../images/interface/zoom.png') 10px center no-repeat;
|
||||
border:1px solid #888888;
|
||||
float:left;
|
||||
font-family:Arial,Helvetica,sans-serif;
|
||||
font-size:15px;
|
||||
height:36px;
|
||||
line-height:36px;
|
||||
margin-right:12px;
|
||||
outline:medium none;
|
||||
padding:0 0 0 35px;
|
||||
text-shadow:1px 1px 0 white;
|
||||
width:385px;
|
||||
-moz-border-radius:10px;
|
||||
-webkit-border-radius:10px;
|
||||
border-radius:10px;
|
||||
-moz-box-shadow: 2px 2px 3px #888;
|
||||
-webkit-box-shadow: 2px 2px 3px #888;
|
||||
box-shadow: 2px 2px 3px #888;
|
||||
/* For IE 8 */
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#888888')";
|
||||
/* For IE 5.5 - 7 */
|
||||
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#888888');
|
||||
|
||||
}
|
||||
.icons{
|
||||
background:#4C5A65;
|
||||
padding:3px 3px 10px 3px;
|
||||
list-style:none;
|
||||
margin:10px 0;
|
||||
height:19px;
|
||||
position:relative;
|
||||
-moz-border-radius:5px;
|
||||
-webkit-border-radius:5px;
|
||||
border-radius:5px;
|
||||
}
|
||||
|
||||
.icons li{
|
||||
background:url("../../../images/interface/icons.png") no-repeat;
|
||||
float:left;
|
||||
height:19px;
|
||||
text-indent:-999px;
|
||||
cursor:pointer;
|
||||
margin-right:5px;
|
||||
}
|
||||
|
||||
/* Styling each icon */
|
||||
|
||||
li.web{ width:15px;}
|
||||
li.web.active,
|
||||
li.web:hover{ background-position:left bottom;}
|
||||
|
||||
li.images{ width:22px; background-position:-18px 0;}
|
||||
li.images.active,
|
||||
li.images:hover{ background-position:-18px bottom;}
|
||||
|
||||
li.news{ width:14px; background-position:-44px 0;}
|
||||
li.news.active,
|
||||
li.news:hover{ background-position:-44px bottom;}
|
||||
|
||||
li.videos{ width:17px; background-position:right 0;}
|
||||
li.videos.active,
|
||||
li.videos:hover{ background-position:right bottom;}
|
||||
|
||||
span.arrow{
|
||||
/* The little arrow that moves below the icons */
|
||||
|
||||
width:11px;
|
||||
height:6px;
|
||||
margin:21px 0 0 5px;
|
||||
position:absolute;
|
||||
background:url('../../../images/interface/arrow.png') no-repeat;
|
||||
left:0;
|
||||
}
|
||||
|
||||
/* The submit button */
|
||||
|
||||
#submitButton{
|
||||
/*background:url('../images/interface/buttons.png') no-repeat;
|
||||
width:83px;
|
||||
height:36px;
|
||||
text-indent:-9999px;
|
||||
overflow:hidden;
|
||||
text-transform:uppercase;
|
||||
border:none;*/
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
#submitButton:hover{
|
||||
background-position:left bottom;
|
||||
}
|
||||
|
||||
/* Web & news results */
|
||||
|
||||
.webResult{ text-shadow:1px 1px 0 #586a75;margin-bottom:50px;}
|
||||
.webResult h2{
|
||||
background-color:#5D6F7B;
|
||||
font-size:18px;
|
||||
font-weight:normal;
|
||||
padding:8px 20px;
|
||||
|
||||
/* Applying CSS3 rounded corners */
|
||||
-moz-border-radius:18px;
|
||||
-webkit-border-radius:18px;
|
||||
border-radius:18px;
|
||||
}
|
||||
.webResult h2 b{ color:#fff; }
|
||||
.webResult h2 a{ color:#eee;border:none;}
|
||||
.webResult p{ line-height:1.5;padding:15px 20px;}
|
||||
.webResult p b{ color:white;}
|
||||
.webResult > a{ margin-left:20px;}
|
||||
|
||||
/* Image & video search results */
|
||||
|
||||
.imageResult{
|
||||
float:left;
|
||||
height:170px;
|
||||
margin:0 0 20px 40px;
|
||||
text-align:center;
|
||||
width:150px;
|
||||
}
|
||||
.imageResult img{ display:block;border:none;}
|
||||
.imageResult a.pic{
|
||||
border:1px solid #fff;
|
||||
outline:1px solid #777;
|
||||
display:block;
|
||||
margin:0 auto 15px;
|
||||
}
|
||||
|
||||
/* The show more button */
|
||||
|
||||
#more{
|
||||
width:83px;
|
||||
height:24px;
|
||||
background:url('../../../images/interface/more.png') no-repeat;
|
||||
cursor:pointer;
|
||||
margin:40px auto;
|
||||
}
|
||||
|
||||
#more:hover{
|
||||
background-position:left bottom;
|
||||
}
|
184
modules/search/js/search.js
Normal file
184
modules/search/js/search.js
Normal file
@@ -0,0 +1,184 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
var config = {
|
||||
type : 'web',
|
||||
perPage : 8, // A maximum of 8 is allowed by Google
|
||||
page : 0 // The start page
|
||||
}
|
||||
|
||||
// The small arrow that marks the active search icon:
|
||||
var arrow = $('<span>',{className:'arrow'}).appendTo('ul.icons');
|
||||
|
||||
$('ul.icons li').click(function(){
|
||||
var el = $(this);
|
||||
|
||||
if(el.hasClass('active')){
|
||||
// The icon is already active, exit
|
||||
return false;
|
||||
}
|
||||
|
||||
el.siblings().removeClass('active');
|
||||
el.addClass('active');
|
||||
|
||||
// Move the arrow below this icon
|
||||
arrow.stop().animate({
|
||||
left : el.position().left,
|
||||
marginLeft : (el.width()/2)-4
|
||||
});
|
||||
|
||||
// Set the search type
|
||||
config.type = el.attr('data-searchType');
|
||||
$('#more').fadeOut();
|
||||
});
|
||||
|
||||
// Focusing the input text box:
|
||||
$('#s').focus();
|
||||
|
||||
$('#searchForm').submit(function(){
|
||||
googleSearch();
|
||||
return false;
|
||||
});
|
||||
|
||||
function googleSearch(settings){
|
||||
|
||||
// If no parameters are supplied to the function,
|
||||
// it takes its defaults from the config object above:
|
||||
|
||||
settings = $.extend({},config,settings);
|
||||
settings.term = settings.term || $('#s').val();
|
||||
|
||||
// URL of Google's AJAX search API
|
||||
var apiURL = 'http://ajax.googleapis.com/ajax/services/search/'+settings.type+
|
||||
'?v=1.0&callback=?';
|
||||
|
||||
$.getJSON(apiURL,{
|
||||
q : settings.term,
|
||||
rsz : settings.perPage,
|
||||
start : settings.page*settings.perPage
|
||||
},function(r){
|
||||
|
||||
var results = r.responseData.results;
|
||||
$('#more').remove();
|
||||
|
||||
if(results.length){
|
||||
|
||||
// If results were returned, add them to a pageContainer div,
|
||||
// after which append them to the #resultsDiv:
|
||||
|
||||
var pageContainer = $('<div>',{className:'pageContainer'});
|
||||
|
||||
for(var i=0;i<results.length;i++){
|
||||
// Creating a new result object and firing its toString method:
|
||||
pageContainer.append(new result(results[i]) + '');
|
||||
}
|
||||
|
||||
var cursor = r.responseData.cursor;
|
||||
|
||||
// Checking if there are more pages with results,
|
||||
// and deciding whether to show the More button:
|
||||
|
||||
if( +cursor.estimatedResultCount > (settings.page+1)*settings.perPage){
|
||||
$('<div>',{id:'more'}).appendTo(pageContainer).click(function(){
|
||||
googleSearch({append:true,page:settings.page+1});
|
||||
$(this).fadeOut();
|
||||
});
|
||||
}
|
||||
|
||||
pageContainer.append('<div class="clear"></div>').hide();
|
||||
|
||||
$.fancybox(
|
||||
$(pageContainer).html(),
|
||||
{
|
||||
'autoDimensions' : false,
|
||||
'width' : 400,
|
||||
'height' : 'auto',
|
||||
'showNavArrows' : false,
|
||||
'transitionIn' : 'elastic'
|
||||
}
|
||||
);
|
||||
$('#more').click(function(){
|
||||
googleSearch({append:true,page:settings.page+1});
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
var pageContainer = $('<div>',{className:'pageContainer'});
|
||||
// No results were found for this search.
|
||||
|
||||
$('<p>',{
|
||||
className : 'notFound',
|
||||
html : 'No Results Were Found!'
|
||||
}).appendTo(pageContainer);
|
||||
// .hide().appendTo(resultsDiv).fadeIn();
|
||||
$.fancybox(
|
||||
$(pageContainer).html(),
|
||||
{
|
||||
'autoDimensions' : false,
|
||||
'width' : 400,
|
||||
'height' : 'auto',
|
||||
'showNavArrows' : false,
|
||||
'transitionIn' : 'elastic'
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function result(r){
|
||||
|
||||
// This is class definition. Object of this class are created for
|
||||
// each result. The markup is generated by the .toString() method.
|
||||
|
||||
var arr = [];
|
||||
|
||||
// GsearchResultClass is passed by the google API
|
||||
switch(r.GsearchResultClass){
|
||||
|
||||
case 'GwebSearch':
|
||||
arr = [
|
||||
'<div class="webResult">',
|
||||
'<h2><a href="',r.url,'">',r.title,'</a></h2>',
|
||||
'<p>',r.content,'</p>',
|
||||
'<a href="',r.url,'">',r.visibleUrl,'</a>',
|
||||
'</div>'
|
||||
];
|
||||
break;
|
||||
case 'GimageSearch':
|
||||
arr = [
|
||||
'<div class="imageResult">',
|
||||
'<a href="',r.url,'" title="',r.titleNoFormatting,
|
||||
'" class="pic" style="width:',r.tbWidth,'px;height:',r.tbHeight,'px;">',
|
||||
'<img src="',r.tbUrl,'" width="',r.tbWidth,'" height="',
|
||||
r.tbHeight,'" /></a>','<div class="clear"></div>',
|
||||
'<a href="',r.originalContextUrl,'">',r.visibleUrl,'</a>',
|
||||
'</div>'
|
||||
];
|
||||
break;
|
||||
case 'GvideoSearch':
|
||||
arr = [
|
||||
'<div class="imageResult">',
|
||||
'<a href="',r.url,'" title="',r.titleNoFormatting,
|
||||
'" class="pic" style="width:150px;height:auto;">',
|
||||
'<img src="',r.tbUrl,'" width="100%" /></a>',
|
||||
'<div class="clear"></div>','<a href="',
|
||||
r.originalContextUrl,'">',r.publisher,'</a>',
|
||||
'</div>'
|
||||
];
|
||||
break;
|
||||
case 'GnewsSearch':
|
||||
arr = [
|
||||
'<div class="webResult">',
|
||||
'<h2><a href="',r.unescapedUrl,'">',r.title,'</a></h2>',
|
||||
'<p>',r.content,'</p>',
|
||||
'<a href="',r.unescapedUrl,'">',r.publisher,'</a>',
|
||||
'</div>'
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
// The toString method.
|
||||
this.toString = function(){
|
||||
return arr.join('');
|
||||
}
|
||||
}
|
||||
});
|
116
modules/todo/Todo.php
Normal file
116
modules/todo/Todo.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
class todo extends Module {
|
||||
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
const TODO_FILE = 'db/todoist.xml';
|
||||
private $token;
|
||||
private $project_name;
|
||||
private $project_id;
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
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:'.$params['y'].'; left :'.$params['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;
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$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){
|
||||
foreach ($updated as $what=>$withWhat){
|
||||
if(in_array($what, self::$paramsList)){
|
||||
call_user_func(array(get_class(), "set".ucfirst($what)), $withWhat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
modules/todo/ajax/saveTodoist.php
Normal file
21
modules/todo/ajax/saveTodoist.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?
|
||||
|
||||
$xmla = simplexml_load_file('../db/todoist.xml');
|
||||
|
||||
if(isset($_POST['token'])){
|
||||
|
||||
$token = trim($_POST['token']);
|
||||
|
||||
|
||||
|
||||
$xmla->addChild("token", $token);
|
||||
|
||||
|
||||
|
||||
$xmla->asXML('../db/todoist.xml');
|
||||
|
||||
|
||||
|
||||
echo "ok";
|
||||
|
||||
}else if(isset($_POST['name']) && isset($_POST['id'])){
|
23
modules/todo/css/todo.css
Normal file
23
modules/todo/css/todo.css
Normal file
@@ -0,0 +1,23 @@
|
||||
#todo {padding:5px;width:350px;-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;border: 1px solid rgba(0,0,0,0.3);
|
||||
-webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
|
||||
-moz-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
|
||||
overflow:hidden;}
|
||||
|
||||
#todo ul{list-style:none;}
|
||||
#todo ul li{white-space : nowrap; padding-left:16px;}
|
||||
#todo ul li div.puce{width: 16px; height: 16px; background:url(../../../images/interface/ui-icons_888888_256x240.png) -32px -48px no-repeat; display:inline-block;}
|
||||
|
||||
|
||||
|
||||
.ui-resizable { position: relative;}
|
||||
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; background-position: -80px -224px;background-image: url(../../../images/interface/ui-icons_888888_256x240.png);}
|
||||
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
||||
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
|
||||
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
|
||||
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
|
||||
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
|
||||
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
||||
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
||||
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
||||
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
|
4
modules/todo/db/todoist.xml
Normal file
4
modules/todo/db/todoist.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<todo>
|
||||
|
||||
</todo>
|
18
modules/todo/includes/getProjectsList.php
Normal file
18
modules/todo/includes/getProjectsList.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?
|
||||
|
||||
$xmla = simplexml_load_file('../db/todoist.xml');
|
||||
|
||||
if($xmla->token== '' || $xmla->token == null)
|
||||
|
||||
header('Location: install-todoist.php');
|
||||
|
||||
if($xmla->name == '' || $xmla->name == null):?>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<style>
|
||||
.selectableProject{text-decoration:underline; color:blue; cursor:pointer;}
|
||||
</style>
|
||||
<title>Todoist : getProjects</title>
|
12
modules/todo/includes/getUncompletedTasks.php
Normal file
12
modules/todo/includes/getUncompletedTasks.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?
|
||||
|
||||
$xmla = simplexml_load_file('../db/todoist.xml');
|
||||
|
||||
if($xmla->token== '' || $xmla->token == null)
|
||||
|
||||
header('Location: ./');
|
||||
|
||||
if($xmla->id != '' || $xmla->id != null):
|
||||
|
||||
$token = $xmla->token;
|
||||
|
25
modules/todo/includes/install-todoist.php
Normal file
25
modules/todo/includes/install-todoist.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?
|
||||
$xmla = simplexml_load_file('../db/todoist.xml');
|
||||
if($xmla->token == '' || $xmla->token == null):?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Todoist : Login</title>
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../js/index.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<fieldset>
|
||||
<input type="text" name="email" id="email"/><br/>
|
||||
<input type="password" name="password" id="password"/>
|
||||
<span id="loginBtn">Cliquez ici pour vous identifier</span>
|
||||
<div id="error"></div>
|
||||
<span id="todoistRegister">ou <a href="http://todoist.com/Users/showRegister">Cliquez ici</a> pour vous créer un compte (ainsi qu'un projet ;))</span>
|
||||
</fieldset>
|
||||
</body>
|
||||
</html>
|
||||
<?
|
||||
else:
|
||||
header('Location: getProjectsList.php');
|
||||
endif;
|
||||
|
6
modules/todo/js/getProjectsList.php
Normal file
6
modules/todo/js/getProjectsList.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?header('Content-type: application/javascript');
|
||||
|
||||
$token = $_GET['token'];
|
||||
|
||||
?>
|
||||
|
56
modules/todo/js/getUncompletedTasks.php
Normal file
56
modules/todo/js/getUncompletedTasks.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?header('Content-type: application/javascript');
|
||||
$token = $_GET['token'];
|
||||
$id = $_GET['id'];
|
||||
?>
|
||||
|
||||
function cbfunc(o){
|
||||
|
||||
$('#results').append('<ul id="uncompletedList"><ul>');
|
||||
|
||||
for(var i in o)
|
||||
|
||||
{
|
||||
|
||||
$('#uncompletedList').append('<li id="'+o[i].id+'">'+o[i].content+' - '+o[i].date_string+' <img src="images/interface/delete.png" class="deleteTask" id="delete-'+o[i].id+'"/> <img src="images/interface/complete.png" class="completeTask" id="complete-'+o[i].id+'"/> </li>');
|
||||
|
||||
}
|
||||
|
||||
$('#uncompletedList li').prepend('<div class="puce"></div>');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function cbfunc2(o){
|
||||
|
||||
$('#uncompletedList').append('<li id="'+o.id+'">'+o.content+' - '+o.date_string+' <img src="images/interface/delete.png" id="delete-'+o.id+'"/> <img src="images/interface/complete.png" class="completeTask" id="complete-'+o.id+'"/> </li>');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#todo').resizable();
|
||||
$('#todo').draggable();
|
||||
$('#todo').append('<div id="results"></div><img src="images/interface/add.png" id="showNewTask"/><fieldset id="newTaskFieldset" style="display:none; width:200px;"><input type="text" name="newtask" id="newtask"/> <select id="priority"><option id="1" value="1">1</option><option id="2" value="2">2</option><option id="3" value="3">3</option><option id="4" value="4">4</option></select> <br/><input type="text" name="date_string" id="date_string"/> <img src="images/interface/add.png" id="addTask"/></fieldset>');
|
||||
|
||||
var token = "<?=$token?>";
|
||||
|
||||
var project_id = "<?=$id?>";
|
||||
|
||||
var script = document.createElement('script');
|
||||
|
||||
script.type = 'text/javascript';
|
||||
|
||||
script.src = 'https://todoist.com/API/getUncompletedItems?project_id='+project_id+'&token='+token+'&format=json&callback=cbfunc';
|
||||
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
|
||||
|
||||
|
||||
$('#showNewTask').click(function(){
|
||||
|
||||
$('#newTaskFieldset').toggle();
|
||||
|
||||
});
|
||||
|
21
modules/todo/js/index.js
Normal file
21
modules/todo/js/index.js
Normal file
@@ -0,0 +1,21 @@
|
||||
function cbfunc(o){
|
||||
|
||||
var token = o.api_token;
|
||||
|
||||
if(token == undefined){
|
||||
|
||||
$('#error').html('Identification erronnée');
|
||||
|
||||
}else{
|
||||
|
||||
$.post('../ajax/saveTodoist.php', {token: token}, function(data){
|
||||
$('body').append('<a href="getProjectsList.php">Etape suivante</a>');
|
||||
if(data=="ok"){
|
||||
location.reload();
|
||||
}else{
|
||||
alert(data);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
0
modules/todo/js/todo.js
Normal file
0
modules/todo/js/todo.js
Normal file
104
modules/weather/Weather.php
Normal file
104
modules/weather/Weather.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
class weather extends Module {
|
||||
|
||||
protected $moduleName;
|
||||
protected $moduleTitle;
|
||||
protected $pathToModule;
|
||||
|
||||
protected static $paramsList = array(
|
||||
'visibility',
|
||||
'city',
|
||||
'x',
|
||||
'y'
|
||||
);
|
||||
|
||||
public $params = array();
|
||||
|
||||
public function __construct($params){
|
||||
$this->moduleName = get_class();
|
||||
$this->pathToModule = 'modules/'.$this->moduleName.'/';
|
||||
$this->setParams($params);
|
||||
$ville = $params['city'];
|
||||
include $this->pathToModule.'includes/GoogleMeteo.php';
|
||||
echo '<script type="text/javascript" src="'.$this->pathToModule.'js/'.$this->moduleName.'.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="'.$this->pathToModule.'css/'.$this->moduleName.'.css">';
|
||||
echo '<div id="weather" style="left:'.$params['x'].'; top:'.$params['y'].';">
|
||||
'.$city.'<br/>
|
||||
<div class="weatherpic"></div>
|
||||
<strong>'.$present_weather.'</strong><br/>
|
||||
'.$future_weather1.'<br/>
|
||||
'.$future_weather2.'
|
||||
</div>';
|
||||
}
|
||||
|
||||
private function setParams($params){
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
public static function start($params){
|
||||
$weather = new weather($params);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Modifie la ville
|
||||
* @param String $city la ville.
|
||||
* @return String "ok" ou message d'erreur (effectue aussi l'enregistrement en XML)
|
||||
*/
|
||||
public function setCity($city){
|
||||
// Saving the position and z-index of the note:
|
||||
$xmla = simplexml_load_file('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
$path = $xmla->xpath("//item[@id='weather']");
|
||||
$path[0]->city = $city;
|
||||
|
||||
$xmla->asXML('../'.AccueilModules::CONFIG_FILE);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
modules/weather/css/neige.css
Normal file
1
modules/weather/css/neige.css
Normal file
@@ -0,0 +1 @@
|
||||
#weather .weatherpic{float:left; background:url(../images/weather/pluie.png) top left no-repeat; width:53px; height:53px; margin-right:10px;}
|
1
modules/weather/css/nuage.css
Normal file
1
modules/weather/css/nuage.css
Normal file
@@ -0,0 +1 @@
|
||||
#weather .weatherpic{float:left; background:url(../images/weather/nuage.png) top left no-repeat; width:53px; height:53px; margin-right:10px;}
|
1
modules/weather/css/peunuage.css
Normal file
1
modules/weather/css/peunuage.css
Normal file
@@ -0,0 +1 @@
|
||||
#weather .weatherpic{float:left; background:url(../images/weather/peu-nuageux.png) top left no-repeat; width:53px; height:53px; margin-right:10px;}
|
1
modules/weather/css/pluie.css
Normal file
1
modules/weather/css/pluie.css
Normal file
@@ -0,0 +1 @@
|
||||
#weather .weatherpic{float:left; background:url(../images/weather/pluie.png) top left no-repeat; width:53px; height:53px; margin-right:10px;}
|
1
modules/weather/css/soleil.css
Normal file
1
modules/weather/css/soleil.css
Normal file
@@ -0,0 +1 @@
|
||||
#weather .weatherpic{float:left; background:url(../images/weather/soleil.png) top left no-repeat; width:53px; height:53px; margin-right:10px;}
|
6
modules/weather/css/weather.css
Normal file
6
modules/weather/css/weather.css
Normal file
@@ -0,0 +1,6 @@
|
||||
#weather {position:absolute; top:10px; left: 100px;padding:5px;-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;border: 1px solid rgba(0,0,0,0.3);
|
||||
-webkit-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);
|
||||
-moz-box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.15);}
|
||||
|
||||
#city-submit{cursor:pointer;}
|
38
modules/weather/includes/GoogleMeteo.php
Normal file
38
modules/weather/includes/GoogleMeteo.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
require('class/GoogleWeather.class.php');
|
||||
|
||||
//ça récupère un truc du style : http://www.google.com/ig/api?weather=paris&hl=fr
|
||||
if($ville != '' || $ville != null){
|
||||
$gweather = new GoogleWeatherAPI($ville,'fr');
|
||||
|
||||
if($gweather->isFound()) {
|
||||
$city = $gweather->getCity();
|
||||
$currentTemp = $gweather->getCurrent();
|
||||
$forecastTemp = $gweather->getForecast();
|
||||
|
||||
$present_weather = 'Actuellement : '.$currentTemp['temp_c'].'°C - '.$currentTemp['condition'];
|
||||
$i=0;
|
||||
foreach($forecastTemp as $temp) {
|
||||
${'future_weather'.$i} = $temp['day_of_week'].' : '.$temp['low'].'°C | '.$temp['high'].'°C - '.$temp['condition'];
|
||||
$i++;
|
||||
}
|
||||
|
||||
if(strpos(strtolower($present_weather),"soleil") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/soleil.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"nuage") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/nuage.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"peu nuageux") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/peunuage.css">
|
||||
<?}
|
||||
if((strpos(strtolower($present_weather),"pluie") !== false) || (strpos(strtolower($present_weather),"averse") !== false)) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/pluie.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"neige") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="modules/weather/css/neige.css">
|
||||
<?}
|
||||
}else{ $present_weather = 'Ville non trouvé : '.$city; }
|
||||
}else
|
||||
$present_weather = 'Ville non renseignée';
|
||||
|
26
modules/weather/includes/meteo.php
Normal file
26
modules/weather/includes/meteo.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
if ($weather = simplexml_load_file('http://www.my-meteo.fr/meteo+rss+paris.html')){
|
||||
$present_weather = $weather->channel->item[0]->title;
|
||||
$future_weather1 = $weather->channel->item[1]->title;
|
||||
$future_weather2 = $weather->channel->item[2]->title;
|
||||
if(strpos(strtolower($present_weather),"soleil") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/soleil.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"nuage") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/nuage.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"peu nuageux") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/peunuage.css">
|
||||
<?}
|
||||
if((strpos(strtolower($present_weather),"pluie") !== false) || (strpos(strtolower($present_weather),"averse") !== false)) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/pluie.css">
|
||||
<?}
|
||||
if(strpos(strtolower($present_weather),"neige") !== false) {?>
|
||||
<link rel="stylesheet" type="text/css" href="css/neige.css">
|
||||
<?}
|
||||
}
|
||||
else
|
||||
{
|
||||
die ('Flux RSS non trouvé');
|
||||
}
|
||||
?>
|
30
modules/weather/js/weather.js
Normal file
30
modules/weather/js/weather.js
Normal file
@@ -0,0 +1,30 @@
|
||||
$(document).ready(function(){
|
||||
$('body').append('<a href="#city" id="city-menu"><img src="images/interface/weather.png" /></a><div style="display:none;"><div id="city"></div></div>');
|
||||
$('#menu-bar').prepend($('#city-menu'));
|
||||
$('#city').append('<h3>Quelle ville pour la meteo ?</h3><br/><input type="text" id="cityChoice" name="cityChoice"/><span id="city-submit" class="green-button">Enregistrer</span>');
|
||||
$('#city-menu').fancybox({
|
||||
'zoomSpeedIn' : 600,
|
||||
'zoomSpeedOut' : 500,
|
||||
'easingIn' : 'easeOutBack',
|
||||
'easingOut' : 'easeInBack',
|
||||
'hideOnContentClick': false,
|
||||
'padding' : 15
|
||||
});
|
||||
$('#city-submit').live('click', function(){
|
||||
var ville = $('#cityChoice').val();
|
||||
if(ville != '' || ville != null){
|
||||
$.get('ajax/update.php', {id:'weather', city: ville}, function(msg){
|
||||
location.reload();
|
||||
});
|
||||
}else{
|
||||
$('#city').append('<span class="error">City can\'t be empty.</span>');
|
||||
}
|
||||
});
|
||||
|
||||
var tmp;
|
||||
|
||||
/* A helper function for converting a set of elements to draggables: */
|
||||
make_draggable($('#weather'));
|
||||
|
||||
|
||||
});
|
Reference in New Issue
Block a user