<?php

require_once($_SERVER['DOCUMENT_ROOT'] . '/sys/db.php');
 
foreach ($_POST as $paramName => $paramValue) {
}

$dal = new DAL();

$sql = "SELECT id as pw_id, start_time, end_time, break_dur, " .
       "duration, duration_lastupdate, observer_note " .
       "FROM projectworkday WHERE fieldwork_day = 1 ";
$projectworkday = $dal->query($sql);

foreach ($projectworkday as $pw) { 

  $fw_id = hexdec(uniqid());

  $sql = "INSERT INTO fieldworkday " .
         "(id, projectworkday_id, start_time, end_time, break_dur, " .
         "duration, duration_lastupdate, observernote) " .
         "VALUES " .
         "($fw_id, $pw->pw_id, '$pw->start_time', '$pw->end_time', " .
         "'$pw->break_dur', $pw->duration, '$pw->duration_lastupdate', " .
         "'$pw->observer_note') ";

  $result = $dal->query($sql);
}         

echo json_encode($result);

?>

