$endDate = mktime(23, 59, 59, $thismonth, $thisday + $numDays, $thisyear);
    // If 'showEvents=0' is in URL, then just include tasks in list
    $show_events = getGetValue('showEvents', "[01]", true);
    $tasks_only = $show_events == '0';
    if ($tasks_only) {
        $repeated_events = $events = array();
    } else {
        /* Pre-Load the repeated events for quckier access */
        $repeated_events = read_repeated_events($username, $startDate, $endDate, $cat_id);
        /* Pre-load the non-repeating events for quicker access */
        $events = read_events($username, $startDate, $endDate, $cat_id);
    }
    // Pre-load tasks for quicker access */
    if (empty($DISPLAY_TASKS_IN_GRID) || $DISPLAY_TASKS_IN_GRID == 'Y' || $showTasks) {
        /* Pre-load tasks for quicker access */
        $tasks = read_tasks($username, $endDate, $cat_id);
    }
}
// Determine if this script is being called directly, or via an include.
if (empty($PHP_SELF) && !empty($_SERVER) && !empty($_SERVER['PHP_SELF'])) {
    $PHP_SELF = $_SERVER['PHP_SELF'];
}
// If called directly print  header stuff.
if (!empty($PHP_SELF) && preg_match($name_of_this_file, $PHP_SELF)) {
    // Print header without custom header and no style sheet.
    echo send_doctype(generate_application_name());
    ?>
<!-- This style sheet is here mostly to make it easier for others
     to customize the appearance of the page.
     In the not too distant future, the admin UI will allow configuration
     of the stylesheet elements on this page.
Example #2
0
if ($BOLD_DAYS_IN_YEAR == 'Y') {
    $boldDays = true;
    $startdate = mktime(0, 0, 0, $prevmonth, 0, $prevyear);
    $enddate = mktime(23, 59, 59, $nextmonth + 1, 0, $nextyear);
} else {
    $boldDays = false;
    $startdate = mktime(0, 0, 0, $thismonth, 0, $thisyear);
    $enddate = mktime(23, 59, 59, $thismonth + 1, 0, $thisyear);
}
/* Pre-Load the repeated events for quicker access */
$repeated_events = read_repeated_events(!empty($user) && strlen($user) ? $user : $login, $startdate, $enddate, $cat_id);
/* Pre-load the non-repeating events for quicker access */
$events = read_events(!empty($user) && strlen($user) ? $user : $login, $startdate, $enddate, $cat_id);
if ($DISPLAY_TASKS_IN_GRID == 'Y') {
    /* Pre-load tasks for quicker access */
    $tasks = read_tasks(!empty($user) && strlen($user) && $is_assistant ? $user : $login, $enddate, $cat_id);
}
$tableWidth = '100%';
$monthURL = 'month.php?' . (!empty($cat_id) ? 'cat_id=' . $cat_id . '&amp;' : '');
$nextMonth1 = $nextMonth2 = $prevMonth1 = $prevMonth2 = '';
$printerStr = $smallTasks = $unapprovedStr = '';
if (empty($DISPLAY_TASKS) || $DISPLAY_TASKS == 'N' && $DISPLAY_SM_MONTH != 'N') {
    $nextMonth1 = display_small_month($nextmonth, $nextyear, true, true, 'nextmonth', $monthURL);
    $prevMonth1 = display_small_month($prevmonth, $prevyear, true, true, 'prevmonth', $monthURL);
}
if ($DISPLAY_TASKS == 'Y' && $friendly != 1) {
    if ($DISPLAY_SM_MONTH != 'N') {
        $nextMonth2 = display_small_month($nextmonth, $nextyear, true, false, 'nextmonth', $monthURL) . '<br />';
        $prevMonth2 = display_small_month($prevmonth, $prevyear, true, false, 'prevmonth', $monthURL) . '<br />';
    } else {
        $nextMonth2 = $prevMonth2 = '<br /><br /><br /><br />';
$enddateTS = $startdateTS + $DAYS_IN_ADVANCE * 86400;
$startdate = date('Ymd', $startdateTS);
$enddate = date('Ymd', $enddateTS);
// Now read all the repeating events (for all users).
$repeated_events = query_events('', true, 'AND ( wer.cal_end >= ' . $startdate . ' OR wer.cal_end IS NULL ) ');
$repcnt = count($repeated_events);
// Read non-repeating events (for all users).
if ($debug) {
    echo "Checking for events from date {$startdate} to date {$enddate}.<br />\n";
}
$events = read_events('', $startdateTS, $enddateTS);
$eventcnt = count($events);
if ($debug) {
    echo "Checking for tasks from date {$startdate} to date {$enddate}.<br />\n";
}
$tasks = read_tasks('', $enddateTS);
$taskcnt = count($tasks);
if ($debug) {
    echo 'Found ' . 0 + $eventcnt + $taskcnt + $repcnt . " events in time range.<br />\n";
}
$is_task = false;
for ($d = 0; $d < $DAYS_IN_ADVANCE; $d++) {
    $dateTS = time() + $d * 86400;
    $date = date('Ymd', $dateTS);
    // Get non-repeating events for this date.
    // An event will be included one time for each participant.
    $ev = get_entries($date);
    // Keep track of duplicates.
    $completed_ids = array();
    $evcnt = count($ev);
    for ($i = 0; $i < $evcnt; $i++) {