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).
15 define('SM_PATH','../../');
17 /* Calender plugin required files. */
18 require_once(SM_PATH
. 'plugins/calendar/calendar_data.php');
19 require_once(SM_PATH
. 'plugins/calendar/functions.php');
21 /* SquirrelMail required files. */
22 require_once(SM_PATH
. 'include/validate.php');
23 require_once(SM_PATH
. 'functions/strings.php');
24 require_once(SM_PATH
. 'functions/date.php');
25 require_once(SM_PATH
. 'config/config.php');
26 require_once(SM_PATH
. 'functions/page_header.php');
27 require_once(SM_PATH
. 'include/load_prefs.php');
28 require_once(SM_PATH
. 'functions/html.php');
30 //displays head of day calendar view
31 function day_header() {
32 global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day,
33 $prev_date, $next_month, $next_day, $next_year, $next_date;
35 echo html_tag( 'tr', '', '', $color[0] ) . "\n".
36 html_tag( 'td', '', 'left' ) .
37 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n" .
40 "<a href=\"day.php?year=$prev_year&month=$prev_month&day=$prev_day\">< ".
41 date_intl('D',$prev_date)."</a>",
43 html_tag( 'th', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) ,
44 '', '', 'width="75%"' ) .
46 "<a href=\"day.php?year=$next_year&month=$next_month&day=$next_day\">".
47 date_intl('D',$next_date)." ></a>" ,
52 //events for specific day are inserted into "daily" array
53 function initialize_events() {
54 global $daily_events, $calendardata, $month, $day, $year;
56 for ($i=7;$i<23;$i++
){
58 $evntime = '0' . $i . '00';
62 $daily_events[$evntime] = 'empty';
65 $cdate = $month . $day . $year;
67 if (isset($calendardata[$cdate])){
68 while ( $calfoo = each($calendardata[$cdate])){
69 $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
74 //main loop for displaying daily events
75 function display_events() {
76 global $daily_events, $month, $day, $year, $color;
78 ksort($daily_events,SORT_STRING
);
80 while ($calfoo = each($daily_events)){
87 $ehour = substr($calfoo['key'],0,2);
88 $eminute = substr($calfoo['key'],2,2);
89 if (!is_array($calfoo['value'])){
91 html_tag( 'td', $ehour . ':' . $eminute, 'left' ) .
92 html_tag( 'td', ' ', 'left' ) .
94 "<font size=\"-1\"><a href=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."\">".
95 _("ADD") . "</a></font>" ,
100 $calbar=$calfoo['value'];
101 if ($calbar['length']!=0){
102 $elength = '-'.date('H:i',mktime($ehour,$eminute+
$calbar['length'],0,1,1,0));
106 echo html_tag( 'tr', '', '', $color[$eo] ) .
107 html_tag( 'td', $ehour . ':' . $eminute . $elength, 'left' ) .
108 html_tag( 'td', '', 'left' ) . '[';
109 echo ($calbar['priority']==1) ?
"<font color=\"$color[1]\">$calbar[title]</font>" : "$calbar[title]";
110 echo"] $calbar[message] " .
112 "<font size=\"-1\"><nobr>\n" .
113 "<a href=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."&minute=".substr($calfoo['key'],2,2)."\">".
114 _("EDIT") . "</a> | \n" .
115 "<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\">" .
135 $prev_date = mktime(0, 0, 0, $month , $day - 1, $year);
136 $next_date = mktime(0, 0, 0, $month , $day +
1, $year);
137 $prev_day = date ('d',$prev_date);
138 $prev_month = date ('m',$prev_date);
139 $prev_year = date ('Y',$prev_date);
140 $next_day = date ('d',$next_date);
141 $next_month = date ('m',$next_date);
142 $next_year = date ('Y',$next_date);
144 $calself=basename($PHP_SELF);
146 $daily_events = array();
148 displayPageHeader($color, 'None');
155 </table
></td
></tr
></table
>