You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

News.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. class news extends Module
  3. {
  4. protected $moduleTitle = 'Google News';
  5. protected $paramsList = array(
  6. 'visibility',
  7. 'x',
  8. 'y'
  9. );
  10. public function __construct($params)
  11. {
  12. parent::__construct(__CLASS__, $params);
  13. }
  14. public function build()
  15. {
  16. echo '<script type="text/javascript" src="' . $this->pathToModule . 'js/' . $this->moduleName . '.js"></script>
  17. <link rel="stylesheet" href="' . $this->pathToModule . 'css/' . $this->moduleName . '.css" type="text/css" />';
  18. echo '<script type="text/javascript" src="http://www.google.com/jsapi"></script>
  19. <div id="news" style="top:' . $this->getParam('y') . '; left: ' . $this->getParam('x') . ';"></div>
  20. <script type="text/javascript">
  21. google.load("elements", "1", {packages : ["newsshow"]});
  22. function onLoad() {
  23. var options = {
  24. "format" : "300x250",
  25. "language" : "fr",
  26. "linkTarget" : "_blank"
  27. }
  28. // Load it using all of the defaults.
  29. var content = document.getElementById(\'news\');
  30. var newsShow = new google.elements.NewsShow(content, options);
  31. make_draggable($(\'#news\'));
  32. }
  33. google.setOnLoadCallback(onLoad);
  34. </script>';
  35. }
  36. }