2 include_once $gfplugins.'webcalendar/www/includes/init.php';
3 send_no_cache_header ();
5 if (($user != $login) && $is_nonuser_admin)
6 load_user_layers ($user);
10 load_user_categories ();
13 $next = mktime ( 2, 0, 0, $thismonth, $thisday + 7, $thisyear );
14 $prev = mktime ( 2, 0, 0, $thismonth, $thisday - 7, $thisyear );
16 // We add 2 hours on to the time so that the switch to DST doesn't
17 // throw us off. So, all our dates are 2AM for that day.
18 if ( $WEEK_START == 1 )
19 $wkstart = get_monday_before ( $thisyear, $thismonth, $thisday );
21 $wkstart = get_sunday_before ( $thisyear, $thismonth, $thisday );
22 $wkend = $wkstart + ( 3600 * 24 * 6 );
24 $startdate = date ( "Ymd", $wkstart );
25 $enddate = date ( "Ymd", $wkend );
27 if ( $DISPLAY_WEEKENDS == "N" ) {
28 if ( $WEEK_START == 1 ) {
41 if ( $auto_refresh == "Y" && ! empty ( $auto_refresh_time ) ) {
42 $refresh = $auto_refresh_time * 60; // convert to seconds
43 $HeadX = "<meta http-equiv=\"refresh\" content=\"$refresh; url=week_details.php?$u_url" .
44 "date=$startdate$caturl\" />\n";
46 $INC = array('js/popups.php');
47 print_header($INC,$HeadX);
49 /* Pre-Load the repeated events for quckier access */
50 $repeated_events = read_repeated_events ( strlen ( $user ) ? $user : $login, $cat_id, $startdate );
52 /* Pre-load the non-repeating events for quicker access */
53 $events = read_events ( strlen ( $user ) ? $user : $login, $startdate, $enddate, $cat_id );
55 for ( $i = 0; $i < 7; $i++ ) {
56 $days[$i] = $wkstart + ( 24 * 3600 ) * $i;
57 $weekdays[$i] = weekday_short_name ( ( $i + $WEEK_START ) % 7 );
58 $header[$i] = $weekdays[$i] . " " .
59 date_to_str ( date ( "Ymd", $days[$i] ), $DATE_FORMAT_MD, false );
64 <a title="Previous" class="prev" href="week_details.php?<?php echo $u_url; ?>date=<?php echo date("Ymd", $prev ) . $caturl;?>"><img src="leftarrow.gif" alt="Previous" /></a>
65 <a title="Next" class="next" href="week_details.php?<?php echo $u_url;?>date=<?php echo date ("Ymd", $next ) . $caturl;?>"><img src="rightarrow.gif" alt="Next" /></a>
66 <span class="date"><?php
67 echo date_to_str ( date ( "Ymd", $wkstart ), "", false ) .
68 " - " .
69 date_to_str ( date ( "Ymd", $wkend ), "", false );
72 if ( $GLOBALS["DISPLAY_WEEKNUMBER"] == "Y" ) {
73 echo "<br />\n<span class=\"weeknumber\">(" .
74 translate("Week") . " " . week_number ( $wkstart ) . ")</span>";
77 <span class="user"><?php
78 if ( $single_user == "N" ) {
79 echo "<br />$user_fullname\n";
81 if ( $is_nonuser_admin )
82 echo "<br />-- " . translate("Admin mode") . " --";
84 echo "<br />-- " . translate("Assistant mode") . " --";
87 if ( $categories_enabled == "Y" ) {
88 echo "<br /><br />\n";
89 print_category_menu('week', sprintf ( "%04d%02d%02d",$thisyear, $thismonth, $thisday ), $cat_id );
94 <table class="main" cellspacing="0" cellpadding="0">
96 $untimed_found = false;
97 for ( $d = 0; $d < 7; $d++ ) {
98 $date = date ( "Ymd", $days[$d] );
99 $thiswday = date ( "w", $days[$d] );
100 $is_weekend = ( $thiswday == 0 || $thiswday == 6 );
103 if ( $date == date ( "Ymd", $today ) ) {
104 echo " class=\"today\">";
105 } elseif ( $is_weekend ) {
106 echo " class=\"weekend\">";
113 translate("New Entry") . "\" href=\"edit_entry.php?" .
115 date ( "Ymd", $days[$d] ) . "\"><img src=\"new.gif\" class=\"new\" alt=\"" .
116 translate("New Entry") . "\" /></a>\n";
119 $header[$d] . "\" href=\"day.php?" .
121 date("Ymd", $days[$d] ) . "$caturl\">" .
122 $header[$d] . "</a></th>\n</tr>\n";
125 if ( $date == date ( "Ymd", $today ) ) {
126 echo " class=\"today\">";
127 } elseif ( $is_weekend ) {
128 echo " class=\"weekend\">";
133 print_det_date_entries ( $date, $user, true );
141 <?php if ( ! empty ( $eventinfo ) ) echo $eventinfo; ?>
143 <a title="<?php etranslate("Generate printer-friendly version")?>" class="printer" href="week_details.php?<?php
146 echo "year=$thisyear&month=$thismonth&day=$thisday";
148 echo $caturl . "&";
149 ?>friendly=1" target="cal_printer_friendly"
150 onmouseover="window.status = '<?php etranslate("Generate printer-friendly version")?>'">[<?php
151 etranslate("Printer Friendly")
154 <?php print_trailer(); ?>
158 // Print the HTML for one day's events in detailed view.
161 // $date - date (not used)
162 // $time - time (in HHMMSS format)
163 // $name - event name
164 // $description - long description of event
165 // $status - event status
166 // $pri - event priority
167 // $access - event access
168 // $event_owner - user associated with this event
169 function print_detailed_entry ( $id, $date, $time, $duration,
170 $name, $description, $status,
171 $pri, $access, $event_owner ) {
172 global $eventinfo, $login, $user, $TZ_OFFSET;
177 if ( $login != $event_owner && strlen ( $event_owner ) ) {
178 $class = "layerentry";
181 if ( $status == "W" ) $class = "unapprovedentry";
184 if ( $pri == 3 ) echo "<strong>";
185 $divname = "eventinfo-$id-$key";
188 translate("View this entry") . "\" class=\"$class\" href=\"view_entry.php?id=$id&date=$date";
189 if ( strlen ( $user ) > 0 )
190 echo "&user=" . $user;
191 echo "\" onmouseover=\"window.status='" .
192 translate("View this entry") . "'; return true;\" onmouseout=\"window.status=''; return true;\">";
193 echo "<img src=\"circle.gif\" class=\"bullet\" alt=\"view icon\" />";
195 if ( $login != $event_owner && strlen ( $event_owner ) ) {
196 if ($layers) foreach ($layers as $layer) {
197 if($layer['cal_layeruser'] == $event_owner) {
198 echo("<span style=\"color:#" . $layer['cal_color'] . ";\">");
204 $my_time = $time + ( $TZ_OFFSET * 10000 );
206 if ( $GLOBALS["TIME_FORMAT"] == "24" ) {
207 printf ( "%02d:%02d", $my_time / 10000, ( $my_time / 100 ) % 100 );
209 $h = ( (int) ( $my_time / 10000 ) ) % 12;
210 if ( $h == 0 ) $h = 12;
212 $m = ( $my_time / 100 ) % 100;
214 printf ( ":%02d", $m );
217 echo ( (int) ( $my_time / 10000 ) ) < 12 ? translate("am") : translate("pm");
219 $timestr = display_time ( $time );
220 if ( $duration > 0 ) {
222 $h = (int) ( $time / 10000 );
223 $m = ( $time / 100 ) % 100;
230 $end_time = sprintf ( "%02d%02d00", $h, $m );
231 $timestr .= " - " . display_time ( $end_time );
232 echo " - " .display_time ( $end_time ). "";
233 echo "» ";
235 echo "» ";
238 if ( $login != $user && $access == 'R' && strlen ( $user ) ) {
239 $PN = "(" . translate("Private") . ")"; $PD = "(" . translate("Private") . ")";
240 } elseif ( $login != $event_owner && $access == 'R' && strlen ( $event_owner ) ) {
241 $PN = "(" . translate("Private") . ")";$PD ="(" . translate("Private") . ")";
242 } elseif ( $login != $event_owner && strlen ( $event_owner ) ) {
243 $PN = htmlspecialchars ( $name ) ."</span>";
244 $PD = activate_urls ( htmlspecialchars ( $description ) );
246 $PN = htmlspecialchars ( $name );
247 $PD = activate_urls ( htmlspecialchars ( $description ) );
251 if ( $pri == 3 ) echo "</strong>";
252 # Only display description if it is different than the event name.
259 // Print all the calendar entries for the specified user for the
260 // specified date. If we are displaying data from someone other than
261 // the logged in user, then check the access permission of the entry.
263 // $date - date in YYYYMMDD format
265 // $is_ssi - is this being called from week_ssi.php?
266 function print_det_date_entries ( $date, $user, $ssi ) {
267 global $events, $readonly, $is_admin;
269 $year = substr ( $date, 0, 4 );
270 $month = substr ( $date, 4, 2 );
271 $day = substr ( $date, 6, 2 );
273 $dateu = mktime ( 2, 0, 0, $month, $day, $year );
275 // get all the repeating events for this date and store in array $rep
276 $rep = get_repeating_entries ( $user, $date );
279 // get all the non-repeating events for this date and store in $ev
280 $ev = get_entries ( $user, $date );
282 for ( $i = 0; $i < count ( $ev ); $i++ ) {
283 // print out any repeating events that are before this one...
284 while ( $cur_rep < count ( $rep ) &&
285 $rep[$cur_rep]['cal_time'] < $ev[$i]['cal_time'] ) {
286 if ( $GLOBALS["DISPLAY_UNAPPROVED"] != "N" ||
287 $rep[$cur_rep]['cal_status'] == 'A' )
288 print_detailed_entry ( $rep[$cur_rep]['cal_id'],
289 $date, $rep[$cur_rep]['cal_time'], $rep[$cur_rep]['cal_duration'],
290 $rep[$cur_rep]['cal_name'], $rep[$cur_rep]['cal_description'],
291 $rep[$cur_rep]['cal_status'], $rep[$cur_rep]['cal_priority'],
292 $rep[$cur_rep]['cal_access'], $rep[$cur_rep]['cal_login'] );
295 if ( $GLOBALS["DISPLAY_UNAPPROVED"] != "N" ||
296 $ev[$i]['cal_status'] == 'A' )
297 print_detailed_entry ( $ev[$i]['cal_id'],
298 $date, $ev[$i]['cal_time'], $ev[$i]['cal_duration'],
299 $ev[$i]['cal_name'], $ev[$i]['cal_description'],
300 $ev[$i]['cal_status'], $ev[$i]['cal_priority'],
301 $ev[$i]['cal_access'], $ev[$i]['cal_login'] );
303 // print out any remaining repeating events
304 while ( $cur_rep < count ( $rep ) ) {
305 if ( $GLOBALS["DISPLAY_UNAPPROVED"] != "N" ||
306 $rep[$cur_rep]['cal_status'] == 'A' )
307 print_detailed_entry ( $rep[$cur_rep]['cal_id'],
308 $date, $rep[$cur_rep]['cal_time'], $rep[$cur_rep]['cal_duration'],
309 $rep[$cur_rep]['cal_name'], $rep[$cur_rep]['cal_description'],
310 $rep[$cur_rep]['cal_status'], $rep[$cur_rep]['cal_priority'],
311 $rep[$cur_rep]['cal_access'], $rep[$cur_rep]['cal_login'] );