Version avec modules séparés !
This commit is contained in:
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
Reference in New Issue
Block a user