3 // This page is intended to be used as a server-side include
5 // (Such as an intranet home page or something.)
6 // As such, no login is required. Instead, the login id is either
7 // passed in the URL "week_ssi.php?login=cknudsen". Unless, of course,
8 // we are in single-user mode, where no login info is needed.
9 // If no login info is passed, we check for the last login used.
11 $user = "__none__"; // don't let user specify in URL
13 if ( strlen ( $login ) == 0 ) {
14 if ( $single_user == "Y" ) {
15 $login = $user = $single_user_login;
16 } else if ( strlen ( $webcalendar_login ) > 0 ) {
17 $login = $user = $webcalendar_login;
19 echo "<span style=\"color:#FF0000; font-weight:bold;\">Error:</span><span style=\"color:#FF0000;\"> No calendar user specified.</span>";
24 include "includes/config.php";
25 include "includes/php-dbi.php";
26 include "includes/functions.php";
27 include "includes/$user_inc";
28 include "includes/connect.php";
30 load_global_settings ();
31 load_user_preferences ();
36 include "includes/translate.php";
39 $today = time() + ($TZ_OFFSET * 60 * 60);
41 if ( ! empty ( $date ) && ! empty ( $date ) ) {
42 $thisyear = substr ( $date, 0, 4 );
43 $thismonth = substr ( $date, 4, 2 );
44 $thisday = substr ( $date, 6, 2 );
46 if ( empty ( $month ) || $month == 0 )
47 $thismonth = date("m", $today);
50 if ( empty ( $year ) || $year == 0 )
51 $thisyear = date("Y", $today);
54 if ( empty ( $day ) || $day == 0 )
55 $thisday = date("d", $today);
60 $next = mktime ( 3, 0, 0, $thismonth, $thisday + 7, $thisyear );
61 $prev = mktime ( 3, 0, 0, $thismonth, $thisday - 7, $thisyear );
63 // We add 2 hours on to the time so that the switch to DST doesn't
64 // throw us off. So, all our dates are 2AM for that day.
65 if ( $WEEK_START == 1 )
66 $wkstart = get_monday_before ( $thisyear, $thismonth, $thisday );
68 $wkstart = get_sunday_before ( $thisyear, $thismonth, $thisday );
69 $wkend = $wkstart + ( 3600 * 24 * 6 );
70 $startdate = date ( "Ymd", $wkstart );
71 $enddate = date ( "Ymd", $wkend );
73 /* Pre-Load the repeated events for quckier access */
74 $repeated_events = read_repeated_events ( $login, "", $startdate );
76 /* Pre-load the non-repeating events for quicker access */
77 $events = read_events ( $login, $startdate, $enddate );
79 for ( $i = 0; $i < 7; $i++ ) {
80 $days[$i] = $wkstart + ( 24 * 3600 ) * $i;
81 $weekdays[$i] = weekday_short_name ( ( $i + $WEEK_START ) % 7 );
82 $header[$i] = $weekdays[$i] . "<br />" .
83 month_short_name ( date ( "m", $days[$i] ) - 1 ) .
84 " " . date ( "d", $days[$i] );
90 <table style="border-width:0px; width:100%;" cellspacing="0" cellpadding="0">
91 <tr><td style="background-color:<?php echo $TABLEBG?>;">
92 <table style="border-width:0px; width:100%;" cellspacing="1" cellpadding="2">
96 for ( $d = 0; $d < 7; $d++ ) {
97 if ( date ( "Ymd", $days[$d] ) == date ( "Ymd", $today ) )
98 $color = $TODAYCELLBG;
101 echo "<th style=\"width:13%; background-color:$color;\">$header[$d]</th>";
108 $first_hour = $WORK_DAY_START_HOUR - $TZ_OFFSET;
109 $last_hour = $WORK_DAY_END_HOUR + $TZ_OFFSET;
110 $untimed_found = false;
111 for ( $d = 0; $d < 7; $d++ ) {
112 $date = date ( "Ymd", $days[$d] );
114 print "<td style=\"vertical-align:top; width:75px; height:75px;";
115 if ( $date == date ( "Ymd" ) )
116 echo " background-color:$TODAYCELLBG;\">";
118 echo " background-color:$CELLBG;\">";
120 print_date_entries ( $date, $login, true, true );