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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "scopeid")
    $pw_id = $paramValue;
  else if ($paramName == "baseid")
    $pa_id = $paramValue;
}

$dal = new DAL();

$sql = "SELECT PWO.id, OP.name AS 'Operation Name', OT.descr AS 'Operation Type', " .
       "PWO.starttime AS 'Start Time', PWO.op_duration AS Duration " .
       "FROM projectworkdayoperation PWO, operation OP " .
       "LEFT JOIN operationtype OT ON OT.id = OP.operationtype_id " .
       "WHERE PWO.projectworkday_id = $pw_id AND OP.id = PWO.operation_id " .
       "ORDER BY starttime " ;
$result = $dal->query($sql);

echo json_encode($result);

?>

