Exemple #1
0
}
$postvars["select"] = "*,owner";
$postvars["where"] = "range_from >= 2015-12-31";
$postvars["order_field"] = "range_from";
$postvars["order_direction"] = "-1";
$postvars["limit_by"] = "";
$params = array();
$params["apiHost"] = $apiHostname;
$params["userEmail"] = $apiUserEmail;
$params["userPassword"] = $apiUserPassword;
$Nanda3Service = new Nanda3APIObject($params);
$auth = $Nanda3Service->auth();
print "auth result:";
print_r($auth);
exit;
$response = $Nanda3Service->sendRequest("GET", "/timelog", $postvars);
$cont = json_decode($response['content']);
$records = $cont->result->timelog;
//print_r($records);
foreach ($records as $record) {
    $uid = "nl.urenoverzicht/Calendar/" . $record->id;
    $summary = $record->description;
    $description = "labels:";
    $dtstamp = str_replace(array("-", ":"), "", $record->range_from);
    $dtstart = str_replace(array("-", ":", "Z"), "", $record->range_from);
    $dtend = str_replace(array("-", ":", "Z"), "", $record->range_until);
    $sequence = "0";
    $output .= "BEGIN:VEVENT" . $LBC;
    $output .= "DTSTAMP:" . $dtstamp . $LBC;
    $output .= "UID:" . $uid . $LBC;
    $output .= "DTSTART;TZID=Europe/Amsterdam:" . $dtstart . $LBC;
$project_params["order_direction"] = "1";
print "<br><strong>Projects:</strong><br>";
$projects = $Nanda3Service->getProjects($project_params);
$projectHTML = processItemList($projects);
print "{$projectHTML}<br>";
print "<br><strong>Labels</strong>:<br>";
$label_params = array();
$label_params["namespace"] = "user";
$labels = $Nanda3Service->getLabels($label_params);
$labelsHTML = processItemList($labels);
print "{$labelsHTML}<br>";
print "<br><strong>Custom:</strong><br>";
$method = "GET";
$endpoint = "/timelog";
$custom_params = array();
$custom_params["select"] = "id";
$custom_params["where"] = "range_from >= 2015-12-31";
$custom_params["order_field"] = "range_from";
$custom_params["order_direction"] = "1";
$customQuery = $Nanda3Service->sendRequest($method, $endpoint, $custom_params);
$response_data = json_encode($customQuery["content"]);
$response = json_decode($response_data);
//print_r($customQuery);
foreach ($customQuery as $qv => $qq) {
    print "{$qv} - {$qq},br>";
}
$customHTML = processItemList($response);
print "{$customHTML}<br>";
?>

</body></html>