easyYr
php framework for fetching weather data from yr.no

Documentation: yrLayout.class.php

Class for displaying weather information on web.

<?php
class yrLayout {
  
/*
  Functions for displaying yr.no weather data in HTML.
  */
  
  // Directory where images are found.
  
public $imgDir='img/';
  
  public function 
__construct()
  }
  
  public function 
yrbar() {
    
/*
    Displays the yr bar.
    Returns (string): HTML.
    */
    
  
public function yrCredit($yrData)
    
/*
    Displays linked text crediting yr.no for the data.
    $yrData (object): yrData object.
    Returns (string): HTML.
    */
   
  
public function today($yrData)
    
/*
    Displays weather forecast for today.
    $yrData (object): yrData object.
    Returns (string): HTML. Returns null if $yrData does not contain any weather info for today.
    
    NOTE: Late in the day, data from yr.no DOES NOT CONTAIN ANY DATA FROM CURRENT DAY!
    */

  
public function tomorrow($yrData)
    
/*
    Displays weather forecast for tomorrow.
    $yrData (object): yrData object.
    Returns (string): HTML. Returns null if $yrData does not contain any weather info for tomorrow.
    */
    
  
public function daysAhead($yrData$days)
    
/*
    Displays forecast for a day ahead.
    $yrData (object): yrData object.
    $days (int): Day ahead, i.e. 0 = today, 1 = tomorrow, 2 = day after tomorrow.
    Returns (string): HTML. Returns null if $yrData does not contain any weather info for this day.
    */
    
  
public function all($yrData)
    
/*
    Displays entire forecast.
    $yrData (object): yrData object.
    Returns (string): HTML.
    */
    
  
public function day($yrData$date)
    
/*
    Displays weather forecast for a specific day.
    $yrData (object): yrData object.
    $date (integer): Unix timestamp. Can be any time from 00:00 to 23:59 on the day in question.
    Returns (string): HTML. Returns null if $yrData does not contain any weather info for today.
    */
    
  
private function formatOutput($yrData$from$to)
    
/*
    Formats weather forecast for one specific day.
    $from, $to (int): Unix timestamps for start/end of day.
    $form (bool): If true, uses forms for layout (in stead of divs).
    Returns (string): HTML. Returns empty string if $yrData does not contain any weather data from
    today.
    */
    
  
private function formatOne($yrDataDay)
    
/*
    Formats one of the (up to four) weather forecasts found in one day.
    $yrDataDay (string): A single forecast
    Returns (string): HTML.
    */
}
?>