There was a problem when passing arrays to the decode header. From
[squirrelmail.git] / plugins / calendar / day.php
CommitLineData
d61a01d4 1<?php
2/*
3 * day.php
4 *
5 * Copyright (c) 2001 Michal Szczotka <michal@tuxy.org>
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
7 *
8 * Displays the day page (day view).
9 *
2c85de8f 10 * $Id$
d61a01d4 11 */
12
13require_once('calendar_data.php');
14require_once('functions.php');
15chdir('..');
16require_once('../src/validate.php');
17require_once('../functions/strings.php');
18require_once('../functions/date.php');
19require_once('../config/config.php');
20require_once('../functions/page_header.php');
21require_once('../src/load_prefs.php');
22
23//displays head of day calendar view
24function day_header() {
25 global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day,
26 $prev_date, $next_month, $next_day, $next_year, $next_date;
27
28 echo " <TR BGCOLOR=\"$color[0]\"><TD>" .
29 " <TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">\n" .
34d86c16 30 " <TR><TH WIDTH=\"5%\" ALIGN=LEFT><A HREF=\"day.php?year=$prev_year&month=$prev_month&day=$prev_day\">&lt;&nbsp;".
d61a01d4 31 date_intl('D',$prev_date)."</A></TH>\n" .
34d86c16 32 " <TH WIDTH=\"75%\">" .
d61a01d4 33 date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year)) . "</TH>\n" .
34 " <TH ALIGN=RIGHT><A HREF=\"day.php?year=$next_year&month=$next_month&day=$next_day\">".
35 date_intl('D',$next_date)."&nbsp;&gt;</A></TH></TR>\n";
36}
37
38//events for specific day are inserted into "daily" array
39function initialize_events() {
40 global $daily_events, $calendardata, $month, $day, $year;
41
42 for ($i=7;$i<23;$i++){
43 if ($i<10){
44 $evntime = '0' . $i . '00';
45 } else {
46 $evntime = $i . '00';
47 }
48 $daily_events[$evntime] = 'empty';
49 }
50
51 $cdate = $month . $day . $year;
52
53 if (isset($calendardata[$cdate])){
54 while ( $calfoo = each($calendardata[$cdate])){
88cb1b4d 55 $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
d61a01d4 56 }
57 }
58}
59
60//main loop for displaying daily events
61function display_events() {
62 global $daily_events, $month, $day, $year, $color;
63
64 ksort($daily_events,SORT_STRING);
65 $eo=0;
66 while ($calfoo = each($daily_events)){
67 if ($eo==0){
68 $eo=4;
69 } else {
70 $eo=0;
71 }
72
88cb1b4d 73 $ehour = substr($calfoo['key'],0,2);
74 $eminute = substr($calfoo['key'],2,2);
75 if (!is_array($calfoo['value'])){
d61a01d4 76 echo " <TR BGCOLOR=\"$color[$eo]\"><TD>$ehour:$eminute</TD>\n" .
34d86c16 77 " <TD>&nbsp;</TD>\n" .
88cb1b4d 78 " <TD ALIGN=CENTER><FONT SIZE=-1><A HREF=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."\">".
d61a01d4 79 _("ADD") . "</A></FONT></TD></TR>\n";
80 } else {
88cb1b4d 81 $calbar=$calfoo['value'];
82 if ($calbar['length']!=0){
83 $elength = '-'.date('H:i',mktime($ehour,$eminute+$calbar['length'],0,1,1,0));
d61a01d4 84 } else {
85 $elength='';
86 }
87 echo " <TR BGCOLOR=\"$color[$eo]\"><TD>$ehour:$eminute$elength</TD>\n" .
34d86c16 88 " <TD>[";
88cb1b4d 89 echo ($calbar['priority']==1) ? "<FONT COLOR=\"$color[1]\">$calbar[title]</FONT>" : "$calbar[title]";
d61a01d4 90 echo"] $calbar[message]&nbsp;</TD>\n" .
91 " <TD ALIGN=CENTER><FONT SIZE=-1><nobr>\n" .
88cb1b4d 92 "<A HREF=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."&minute=".substr($calfoo['key'],2,2)."\">".
d61a01d4 93 _("EDIT") . "</A>&nbsp;|&nbsp;\n" .
88cb1b4d 94 "<A HREF=\"event_delete.php?dyear=$year&dmonth=$month&dday=$day&dhour=".substr($calfoo['key'],0,2)."&dminute=".substr($calfoo['key'],2,2)."&year=$year&month=$month&day=$day\">" .
d61a01d4 95 _("DEL") . '</A>' .
96 " </nobr></FONT></TD></TR>\n";
97 }
d61a01d4 98}
99
100
101}
102
103if ($month <= 0){
104 $month = date( 'm');
105}
106if ($year <= 0){
107 $year = date( 'Y');
108}
109if ($day <= 0){
110 $day = date( 'd');
111}
112
113$prev_date = mktime(0, 0, 0, $month , $day - 1, $year);
114$next_date = mktime(0, 0, 0, $month , $day + 1, $year);
115$prev_day = date ('d',$prev_date);
116$prev_month = date ('m',$prev_date);
117$prev_year = date ('Y',$prev_date);
118$next_day = date ('d',$next_date);
119$next_month = date ('m',$next_date);
120$next_year = date ('Y',$next_date);
121
122$calself=basename($PHP_SELF);
123
124$daily_events = array();
125
126displayPageHeader($color, 'None');
127calendar_header();
128readcalendardata();
129day_header();
130initialize_events();
131display_events();
d61a01d4 132?>
133</table></td></tr></table>
34d86c16 134</body></html>