Example #1
0
print "<!-- \nstartTime: {$startTime}\nendTime: {$endTime}\nstartDate: {$date}\nnumDays: {$numDays}\nuser: {$username}\nevents: " . count($events) . "\nrevents: " . count($revents) . " -->\n";
$numEvents = 0;
for ($i = $startTime; date("Ymd", $i) <= date("Ymd", $endTime) && $numEvents < $maxEvents; $i += 24 * 3600) {
    $d = date("Ymd", $i);
    $entries = get_entries($username, $d);
    $rentries = get_repeating_entries($username, $d);
    print "<!-- {$d} " . count($entries) . "/" . count($rentries) . " -->\n";
    if (count($entries) > 0 || count($rentries) > 0) {
        print "<!-- XXX -->\n";
        print "<dt>" . date_to_str($d) . "</dt>\n<dd>";
        for ($j = 0; $j < count($entries) && $numEvents < $maxEvents; $j++) {
            print_upcoming_event($entries[$j]);
            $numEvents++;
        }
        for ($j = 0; $j < count($rentries) && $numEvents < $maxEvents; $j++) {
            print_upcoming_event($rentries[$j]);
            $numEvents++;
        }
        print "</dd>\n";
    }
}
print "</dl>\n";
print "</body>\n</html>";
// Print the details of an upcoming event
function print_upcoming_event($e)
{
    global $display_link, $link_target, $server_url;
    if ($display_link && !empty($server_url)) {
        print "<a title\"" . htmlentities($e['cal_name']) . "\" href=\"" . $server_url . "view_entry.php?id=" . $e['cal_id'] . "&amp;date=" . $e['cal_date'] . "\"";
        if (!empty($link_target)) {
            print " target=\"{$link_target}\"";
$endDateYmd = date('Ymd', $endDate);
for ($i = $startDate; date('Ymd', $i) <= $endDateYmd && $numEvents < $maxEvents; $i += ONE_DAY) {
    $d = date('Ymd', $i);
    $entries = get_entries($d, $get_unapproved);
    $rentries = get_repeating_entries($username, $d, $get_unapproved);
    $ev = combine_and_sort_events($entries, $rentries);
    $tentries = get_tasks($d, $get_unapproved);
    $ev = combine_and_sort_events($ev, $tentries);
    $ev_cnt = count($ev);
    echo "<!-- {$d} " . count($ev) . " -->\n";
    if ($ev_cnt > 0) {
        echo "<!-- XXX -->\n";
        //print "<dt>" . date_to_str ( $d,  translate ( '__month__ __dd__' ), true, true ) . "</dt>\n<dd>";
        echo '<dt>' . date_to_str($d) . "</dt>\n<dd>";
        for ($j = 0; $j < $ev_cnt && $numEvents < $maxEvents; $j++) {
            print_upcoming_event($ev[$j], $d);
            $numEvents++;
        }
        echo "</dd>\n";
    }
}
echo "</dl>\n";
if ($showMore) {
    echo '<center><i><a href="' . $title_more_url . '"> . . . ' . translate('more') . '</a></i></center>';
}
?>
</div>
<?php 
echo $eventinfo;
if (!empty($PHP_SELF) && preg_match($name_of_this_file, $PHP_SELF)) {
    echo "</body>\n</html>";