Accueil/modules/weather/Weather.php

34 lines
963 B
PHP

<?php
class weather extends Module
{
protected $moduleTitle = 'Météo';
protected $paramsList = array(
'visibility',
'city',
'x',
'y'
);
public function __construct($params){
parent::__construct(__CLASS__, $params);
}
public function build(){
$ville = $this->getParam('city');
$future_weather = [];
include $this->pathToModule.'includes/GoogleMeteo.php';
if (!empty($present_weather)) {
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:'.$this->getParam("x").'; top:'.$this->getParam("y").';">
'.$ville.'<br/>
<div class="weatherpic"></div>
<strong>'.$present_weather.'</strong><br/>
'.implode('<br/>', $future_weather).'
</div>';
}
}
}