6 * Copyright (c) 2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
11 * Displays the day page (day view).
16 require_once('calendar_data.php');
17 require_once('functions.php');
20 define('SM_PATH','../');
22 /* SquirrelMail required files. */
23 require_once(SM_PATH
. 'include/validate.php');
24 require_once(SM_PATH
. 'functions/strings.php');
25 require_once(SM_PATH
. 'functions/date.php');
26 require_once(SM_PATH
. 'config/config.php');
27 require_once(SM_PATH
. 'functions/page_header.php');
28 require_once(SM_PATH
. 'include/load_prefs.php');
29 require_once(SM_PATH
. 'functions/html.php');
31 //displays head of day calendar view
32 function day_header() {
33 global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day,
34 $prev_date, $next_month, $next_day, $next_year, $next_date;
36 echo html_tag( 'tr', '', '', $color[0] ) . "\n".
37 html_tag( 'td', '', 'left' ) .
38 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n" .
41 "<a href=\"day.php?year=$prev_year&month=$prev_month&day=$prev_day\">< ".
42 date_intl('D',$prev_date)."</a>",
44 html_tag( 'th', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) ,
45 '', '', 'width="75%"' ) .
47 "<a href=\"day.php?year=$next_year&month=$next_month&day=$next_day\">".
48 date_intl('D',$next_date)." ></a>" ,
53 //events for specific day are inserted into "daily" array
54 function initialize_events() {
55 global $daily_events, $calendardata, $month, $day, $year;
57 for ($i=7;$i<23;$i++
){
59 $evntime = '0' . $i . '00';
63 $daily_events[$evntime] = 'empty';
66 $cdate = $month . $day . $year;
68 if (isset($calendardata[$cdate])){
69 while ( $calfoo = each($calendardata[$cdate])){
70 $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
75 //main loop for displaying daily events
76 function display_events() {
77 global $daily_events, $month, $day, $year, $color;
79 ksort($daily_events,SORT_STRING
);
81 while ($calfoo = each($daily_events)){
88 $ehour = substr($calfoo['key'],0,2);
89 $eminute = substr($calfoo['key'],2,2);
90 if (!is_array($calfoo['value'])){
92 html_tag( 'td', $ehour . ':' . $eminute, 'left' ) .
93 html_tag( 'td', ' ', 'left' ) .
95 "<font size=\"-1\"><a href=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."\">".
96 _("ADD") . "</a></font>" ,
101 $calbar=$calfoo['value'];
102 if ($calbar['length']!=0){
103 $elength = '-'.date('H:i',mktime($ehour,$eminute+
$calbar['length'],0,1,1,0));
107 echo html_tag( 'tr', '', '', $color[$eo] ) .
108 html_tag( 'td', $ehour . ':' . $eminute . $elength, 'left' ) .
109 html_tag( 'td', '', 'left' ) . '[';
110 echo ($calbar['priority']==1) ?
"<font color=\"$color[1]\">$calbar[title]</font>" : "$calbar[title]";
111 echo"] $calbar[message] " .
113 "<font size=\"-1\"><nobr>\n" .
114 "<a href=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."&minute=".substr($calfoo['key'],2,2)."\">".
115 _("EDIT") . "</a> | \n" .
116 "<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\">" .
136 $prev_date = mktime(0, 0, 0, $month , $day - 1, $year);
137 $next_date = mktime(0, 0, 0, $month , $day +
1, $year);
138 $prev_day = date ('d',$prev_date);
139 $prev_month = date ('m',$prev_date);
140 $prev_year = date ('Y',$prev_date);
141 $next_day = date ('d',$next_date);
142 $next_month = date ('m',$next_date);
143 $next_year = date ('Y',$next_date);
145 $calself=basename($PHP_SELF);
147 $daily_events = array();
149 displayPageHeader($color, 'None');
156 </table
></td
></tr
></table
>