2 include_once $gfplugins.'webcalendar/www/includes/init.php';
4 if (($user != $login) && $is_nonuser_admin) {
5 load_user_layers ($user);
10 load_user_categories ();
12 $next = mktime ( 3, 0, 0, $thismonth + 1, 1, $thisyear );
13 $nextyear = date ( "Y", $next );
14 $nextmonth = date ( "m", $next );
15 //$nextdate = date ( "Ymd" );
17 $prev = mktime ( 3, 0, 0, $thismonth - 1, 1, $thisyear );
18 $prevyear = date ( "Y", $prev );
19 $prevmonth = date ( "m", $prev );
20 //$prevdate = date ( "Ymd" );
22 if ( ! empty ( $bold_days_in_year ) && $bold_days_in_year == 'Y' ) {
24 $startdate = sprintf ( "%04d%02d01", $prevyear, $prevmonth );
25 $enddate = sprintf ( "%04d%02d31", $nextyear, $nextmonth );
28 $startdate = sprintf ( "%04d%02d01", $thisyear, $thismonth );
29 $enddate = sprintf ( "%04d%02d31", $thisyear, $thismonth );
33 if ( $auto_refresh == "Y" && ! empty ( $auto_refresh_time ) ) {
34 $refresh = $auto_refresh_time * 60; // convert to seconds
35 $HeadX = "<meta http-equiv=\"refresh\" content=\"$refresh; url=month.php?$u_url" .
36 "year=$thisyear&month=$thismonth$caturl" .
37 ( ! empty ( $friendly ) ? "&friendly=1" : "") . "\" />\n";
39 $INC = array('js/popups.php');
40 print_header($INC,$HeadX);
42 /* Pre-Load the repeated events for quicker access */
43 $repeated_events = read_repeated_events (
44 ( ! empty ( $user ) && strlen ( $user ) ) ? $user : $login, $cat_id, $startdate );
46 /* Pre-load the non-repeating events for quicker access */
47 $events = read_events ( ( ! empty ( $user ) && strlen ( $user ) )
48 ? $user : $login, $startdate, $enddate, $cat_id );
50 if ( ! empty ( $cat_id ) )
51 $monthURL = "month.php?cat_id=$cat_id&";
53 $monthURL = 'month.php?';
54 display_small_month ( $prevmonth, $prevyear, true, true, "prevmonth",
56 display_small_month ( $nextmonth, $nextyear, true, true, "nextmonth",
60 <span class="date"><br /><?php
61 echo date_to_str ( sprintf ( "%04d%02d01", $thisyear, $thismonth ),
62 $DATE_FORMAT_MY, false, false );
64 <span class="user"><?php
65 if ( $single_user == "N" ) {
69 if ( $is_nonuser_admin ) {
70 echo "<br />-- " . translate("Admin mode") . " --";
72 if ( $is_assistant ) {
73 echo "<br />-- " . translate("Assistant mode") . " --";
77 if ( $categories_enabled == "Y" && (!$user || ($user == $login || $is_assistant ))) {
78 echo "<br /><br />\n";
79 print_category_menu('month',sprintf ( "%04d%02d01",$thisyear, $thismonth ),$cat_id );
84 <table class="main" style="clear:both;" cellspacing="0" cellpadding="0">
86 <?php if ( $WEEK_START == 0 ) { ?>
87 <th><?php etranslate("Sun")?></th>
89 <th><?php etranslate("Mon")?></th>
90 <th><?php etranslate("Tue")?></th>
91 <th><?php etranslate("Wed")?></th>
92 <th><?php etranslate("Thu")?></th>
93 <th><?php etranslate("Fri")?></th>
94 <th><?php etranslate("Sat")?></th>
95 <?php if ( $WEEK_START == 1 ) { ?>
96 <th><?php etranslate("Sun")?></th>
101 // We add 2 hours on to the time so that the switch to DST doesn't
102 // throw us off. So, all our dates are 2AM for that day.
103 //$sun = get_sunday_before ( $thisyear, $thismonth, 1 );
104 if ( $WEEK_START == 1 ) {
105 $wkstart = get_monday_before ( $thisyear, $thismonth, 1 );
107 $wkstart = get_sunday_before ( $thisyear, $thismonth, 1 );
109 // generate values for first day and last day of month
110 $monthstart = mktime ( 3, 0, 0, $thismonth, 1, $thisyear );
111 $monthend = mktime ( 3, 0, 0, $thismonth + 1, 0, $thisyear );
114 //echo "<p>sun = " . date ( "D, m-d-Y", $sun ) . "</p>\n";
115 //echo "<p>monthstart = " . date ( "D, m-d-Y", $monthstart ) . "</p>\n";
116 //echo "<p>monthend = " . date ( "D, m-d-Y", $monthend ) . "</p>\n";
118 // NOTE: if you make HTML changes to this table, make the same changes
119 // to the example table in pref.php.
120 for ( $i = $wkstart; date ( "Ymd", $i ) <= date ( "Ymd", $monthend );
121 $i += ( 24 * 3600 * 7 ) ) {
123 for ( $j = 0; $j < 7; $j++ ) {
124 $date = $i + ( $j * 24 * 3600 );
125 if ( date ( "Ymd", $date ) >= date ( "Ymd", $monthstart ) &&
126 date ( "Ymd", $date ) <= date ( "Ymd", $monthend ) ) {
127 $thiswday = date ( "w", $date );
128 $is_weekend = ( $thiswday == 0 || $thiswday == 6 );
129 if ( empty ( $WEEKENDBG ) ) {
134 if ( date ( "Ymd", $date ) == date ( "Ymd", $today ) ) {
138 if ( strlen ( $class ) ) {
143 if ( strlen ( $class ) ) {
144 echo " class=\"$class\"";
147 //echo date ( "D, m-d-Y H:i:s", $date ) . "<br />";
148 print_date_entries ( date ( "Ymd", $date ),
149 ( ! empty ( $user ) ) ? $user : $login, false );
152 print "<td> </td>\n";
160 if ( ! empty ( $eventinfo ) ) echo $eventinfo;
162 display_unapproved_events ( ( $is_assistant || $is_nonuser_admin ? $user : $login ) );
166 <a title="<?php etranslate("Generate printer-friendly version")?>"
167 class="printer" href="month.php?<?php
169 echo "year=$thisyear&month=$thismonth&";
171 if ( ! empty ( $user ) ) {
172 echo "user=$user&";
174 if ( ! empty ( $cat_id ) ) {
175 echo "cat_id=$cat_id&";
177 ?>friendly=1" target="cal_printer_friendly"
178 onmouseover="window.status = '<?php etranslate("Generate printer-friendly version")
179 ?>'">[<?php etranslate("Printer Friendly")?>]</a>