<?php
session_start();

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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selectid")
    $pwo_id = $paramValue;
}

$dal = new DAL();
$sql = "SELECT PWO.id,    PWO.projectworkday_id AS fkid, " .
       "OP.id AS name_id, OP.name AS name_id_text, " .
       "operationtype_id, '' AS operation_id_text, " .
       "starttime,        '' AS starttime_text, " .
       "breakduration,    '' AS breakduration_text, " .
       "stoptime,         '' AS stoptime_text, " .
       "note,             '' AS note_text " .
       "FROM projectworkdayoperation PWO, operation OP " .
       "WHERE PWO.id = $pwo_id AND OP.id = PWO.operation_id " .
       "LIMIT 1 ";
$result = $dal->query($sql);

$op_id = $result->name_id;
$pwo_id = $result->id;

$_SESSION['operation'] = $op_id;
$_SESSION['projectworkdayoperation'] = $pwo_id;
unset ($_SESSION['operationspatialunit']);


echo json_encode($result);

?>

