Accueil/modules/news/News.php

41 lines
1.3 KiB
PHP

<?php
class news extends Module
{
protected $moduleTitle = 'Google News';
protected $paramsList = array(
'visibility',
'x',
'y'
);
public function __construct($params)
{
parent::__construct(__CLASS__, $params);
}
public function build()
{
echo '<script type="text/javascript" src="' . $this->pathToModule . 'js/' . $this->moduleName . '.js"></script>
<link rel="stylesheet" href="' . $this->pathToModule . 'css/' . $this->moduleName . '.css" type="text/css" />';
echo '<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<div id="news" style="top:' . $this->getParam('y') . '; left: ' . $this->getParam('x') . ';"></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>';
}
}