74 lines
2.3 KiB
PHP
74 lines
2.3 KiB
PHP
<?php
|
|
/*
|
|
Author: Riccardo Di Dato
|
|
Creation Date: 14/gen/2016
|
|
*/
|
|
|
|
class HTMLHelper {
|
|
|
|
public static function generateAdminHead() {
|
|
echo '<div class="admin_head"><img alt="" src="'.GUIHandler::getImagesUrl()."admin/header.png".'"></div>';
|
|
}
|
|
|
|
public static function generateModelsTable(array $columnInfo, array $models, array $datatableOpts = array()) {
|
|
echo '<table>';
|
|
$colLabels = "<tr>";
|
|
foreach ($columnInfo as $col){
|
|
$colLabels.= '<th>'.$col["label"].'</th>';
|
|
}
|
|
$colLabels.= '</tr>';
|
|
echo '<thead>'.$colLabels.'</thead><tfoot>'.$colLabels.'</tfoot>';
|
|
if (sizeof($models)>0){
|
|
echo '<tbody>';
|
|
foreach ($models as $model){
|
|
echo '<tr>';
|
|
foreach ($columnInfo as $col){
|
|
$field = $col["field"];
|
|
echo '<td>'.$model->$field.'</td>';
|
|
}
|
|
echo '</tr>';
|
|
}
|
|
echo '<tbody>';
|
|
}
|
|
|
|
echo '</table>';
|
|
}
|
|
|
|
public static function getMeteoBlock(){
|
|
$config = GlobalVariables::get("config");
|
|
if(file_exists($config->files->meteoCache)){
|
|
$cont = file_get_contents($config->files->meteoCache);
|
|
$json = json_decode($cont);
|
|
|
|
$todayImgUrl = " https://openweathermap.org/img/w/".$json->list[0]->weather[0]->icon.".png";
|
|
$todayTemp = $json->list[0]->main->temp;
|
|
$todayMax = $json->list[0]->main->temp_max;
|
|
$todayMin = $json->list[0]->main->temp_min;
|
|
|
|
$tomorrowImgUrl = " https://openweathermap.org/img/w/".$json->list[1]->weather[0]->icon.".png";
|
|
$tomorrowTemp = $json->list[1]->main->temp;
|
|
$tomorrowMax = $json->list[1]->main->temp_max;
|
|
$tomorrowMin = $json->list[1]->main->temp_min;
|
|
|
|
|
|
?>
|
|
<div class="meteoTitle">Meteo Napoli</div>
|
|
<div class="meteo">
|
|
<div class="today">
|
|
<div class="day">Oggi</div>
|
|
<div class="image"><img src="<?php echo $todayImgUrl;?>" alt="" /><?php echo $todayTemp;?>°</div>
|
|
<div><span class="label">Max:</span> <?php echo $todayMax;?>°</div>
|
|
<div><span class="label">Min:</span> <?php echo $todayMin;?>°</div>
|
|
</div><div class="tomorrow">
|
|
<div class="day">Domani</div>
|
|
<div class="image"><img src="<?php echo $tomorrowImgUrl;?>" alt="" /><?php echo $tomorrowTemp;?>°</div>
|
|
<div><span class="label">Max:</span> <?php echo $tomorrowMax;?>°</div>
|
|
<div><span class="label">Min:</span> <?php echo $tomorrowMin;?>°</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|