<?php

################################################
## Robert Schrenk, 2007, phPIMap              ##
## This code is distributed under the GNU/GPL ##
################################################
if (phPIMap != "ok") {
    die("Direct access to this location is not allowed");
}
$id = RetrieveVar("id", "0111");
$item = $GLOBALS["restree"]["contact"][$id];
if ($id == "" or $item == "") {
    append("Sorry, a Contact with this ID does not exist!");
} else {
    $fields = $GLOBALS["fields"];
    $tpl = file_get_contents(designroot . "/display/item.contact.html");
    $tpl = replaceFields($tpl, "contact", $item);
    append($tpl);
}
     append("<table border=\"0\" width=\"100%\">\n");
     for ($i = 0; $i < count($selection); $i++) {
         $item = $selection[$i];
         append("<tr>");
         append("<td width=\"20%\">" . readableTS($item["from"], "date") . "</td>");
         append("<td width=\"20%\">von " . readableTS($item["from"], "time") . "<br />bis " . readableTS($item["to"], "time") . "</td>");
         append("<td>" . $item["summary"] . "</td>");
         append("</tr>");
     }
     append("</table>");
     break;
 case "day":
     append("<h1>Termine am " . readableTS($_SESSION["calorientation"], "date") . "</h1>");
     $base_tpl = file_get_contents(designroot . "/display/item.calendar.list.html");
     for ($i = 0; $i < count($selection); $i++) {
         append(replaceFields($base_tpl, "calendar", $selection[$i]));
     }
     /*
     append("<table border=\"0\" width=\"100%\">\n");
     for($i=0;$i<count($selection);$i++){
          $item = $selection[$i];
          append("<tr>");
          append("<td width=\"20%\">".readableTS($item["from"],"date")."</td>");
          append("<td width=\"20%\">von ".readableTS($item["from"],"time")."<br />bis ".
                    readableTS($item["to"],"time")."</td>");
          append("<td>".$item["summary"]."</td>");
          append("</tr>");
     }
     append("</table>");
     */
     break;
<?php

################################################
## Robert Schrenk, 2007, phPIMap              ##
## This code is distributed under the GNU/GPL ##
################################################
if (phPIMap != "ok") {
    die("Direct access to this location is not allowed");
}
$id = RetrieveVar("id", "0111");
$item = $GLOBALS["restree"]["todo"][$id];
if ($id == "" or $item == "") {
    append("<h1>Anstehende Aufgaben</h1>");
    $selection = $GLOBALS["restree"]["todo"];
    //$selection = filterResources($GLOBALS["restree"]["todo"],"due",TimeStamp(0),">",null);
    $selection = sortResources($selection, null, "due", "ASC");
    for ($i = 0; $i < count($selection); $i++) {
        $item = $selection[$i];
        append("<li><a href=\"?module=todo&id=" . $item[internalid] . "\">" . $item["summary"] . "</a></li>");
    }
} else {
    $tpl = file_get_contents(designroot . "/display/item.todo.html");
    $tpl = replaceFields($tpl, "todo", $item);
    append($tpl);
}