2010-09-15 16:55:54 +02:00
|
|
|
<?php
|
2010-09-20 11:40:27 +02:00
|
|
|
class blogs extends Module {
|
|
|
|
|
|
|
|
protected static $paramsList = array(
|
|
|
|
'visibility',
|
|
|
|
'x',
|
|
|
|
'y'
|
|
|
|
);
|
|
|
|
public $params = array();
|
2010-09-15 16:55:54 +02:00
|
|
|
|
|
|
|
public function __construct($params){
|
|
|
|
$this->setParams($params);
|
|
|
|
require('blogs_last_post.php');
|
2010-09-20 16:39:08 +02:00
|
|
|
echo '<script type="text/javascript" src="js/jquery.blogs.js"></script>
|
|
|
|
<div id="blogs" style="top:'.$params['y'].'; left :'.$params['x'].';"></div>';
|
2010-09-17 15:38:57 +02:00
|
|
|
echo '<a href="#blogLinksManager" id="blog-links-manager"><img src="images/interface/blogs_edit.png" /></a>';
|
2010-09-15 16:55:54 +02:00
|
|
|
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)
|
2010-09-15 17:55:18 +02:00
|
|
|
echo '<li>'.$link['url'].' <img src="images/interface/delete.png" id="link-'.$link['name'].'"/></li>';
|
2010-09-15 16:55:54 +02:00
|
|
|
echo '</ul>
|
|
|
|
<h4>Insert Site feed</h4>
|
|
|
|
<form action="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);
|
|
|
|
}
|
2010-09-20 11:40:27 +02:00
|
|
|
|
2010-09-20 16:39:08 +02:00
|
|
|
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";
|
|
|
|
}
|
2010-09-20 11:40:27 +02:00
|
|
|
|
2010-09-20 16:39:08 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2010-09-20 11:40:27 +02:00
|
|
|
}
|
2010-09-20 16:39:08 +02:00
|
|
|
|
|
|
|
|
2010-09-15 16:55:54 +02:00
|
|
|
}
|