<?php

require_once($_SERVER['DOCUMENT_ROOT'] . '/sys/db.php');

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "summaryid")
    $lw_id = $paramValue;
}    
 
$dal = new DAL();
    $sql = "SELECT WE.id as id,  start_time AS Time, CL.name AS Cloud, " .
           "AT.descr AS Atmosphere, temperature AS Temperature, " .
           "humidity AS Humidity, LI.descr AS Lighting, " .
           "PR.descr AS Precipitation " .
           "FROM weather WE, cloudcover CL, atmosphere AT, " .
           "precipitation PR, lighting LI " .
           "WHERE WE.loginworkday_id = $lw_id AND WE.active = 1 " .
           "AND WE.cloudcover_id = CL.id AND WE.atmosphere_id = AT.id " . 
           "AND WE.precipitation_id = PR.id AND LI.id = WE.lighting_id " .
           "ORDER BY WE.start_time DESC ";
$result = $dal->query($sql);

echo json_encode($result);

?>

