File source

<?php
class WeatherScreen extends Screen
  protected 
$id "weather";
  protected 
$i 0;
  protected 
$weather;

  function 
__construct($weatherSource){
    
$this->weather $weatherSource;
    
$this->touchPush("return_btn"0,0,160,160);
  }

  function 
activate($params){
    if(
$params["return"]){
        
$this->returnTo $params["return"];
    }
  }

  function 
renderField($title$img$data$top=0){
    
$black imagecolorallocate($img000);
    
$white imagecolorallocate($img255255255);
    
$w $data;
    
imageline($img11$top+49160$top+49$black);
    
$icon = @imagecreatefrompng("icons/".$w["icon"].".png");
    if(
$icon){
        
pasteCenter($img$icon37$top+24);
        
imagedestroy($icon);
    }
    
imagettftext($img20065$top+30$black"./arialbd.ttf"number_format($w["temp"],1)."°C");
    
imagettftext($img8060$top+45$black"./arial.ttf"$w["text"]);
    
imagefilledrectangle($img0$top+110$top+49$black);
    
imagettfcenter($img89010$top+25$white"./arial.ttf"$title);

  }


  function 
render(){
    if(
$this->touched("return_btn") && $this->returnTo){
        return 
$this->screen($this->returnTo);
    }
    
$data $this->weather->getData();
    
$img screen();
    
$this->renderField("teraz"$img$data0);
    
$this->renderField("dnes"$img$this->weather->getData(0), 50);
    
$this->renderField("zajtra"$img$this->weather->getData(1), 100);
    return 
$this->image($img);
  }
}