6 * Copyright (c) 2002-2003 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 define('SM_PATH','../../');
18 /* Calender plugin required files. */
19 require_once(SM_PATH
. 'plugins/calendar/calendar_data.php');
20 require_once(SM_PATH
. 'plugins/calendar/functions.php');
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');
32 if (isset($_GET['year'])) {
33 $year = $_GET['year'];
35 elseif (isset($_POST['year'])) {
36 $year = $_POST['year'];
38 if (isset($_GET['month'])) {
39 $month = $_GET['month'];
41 elseif (isset($_POST['month'])) {
42 $month = $_POST['month'];
44 if (isset($_GET['day'])) {
47 elseif (isset($_POST['day'])) {
53 //displays head of day calendar view
54 function day_header() {
55 global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day,
56 $prev_date, $next_month, $next_day, $next_year, $next_date;
58 echo html_tag( 'tr', '', '', $color[0] ) . "\n".
59 html_tag( 'td', '', 'left' ) .
60 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n" .
63 "<a href=\"day.php?year=$prev_year&month=$prev_month&day=$prev_day\">< ".
64 date_intl('D',$prev_date)."</a>",
66 html_tag( 'th', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) ,
67 '', '', 'width="75%"' ) .
69 "<a href=\"day.php?year=$next_year&month=$next_month&day=$next_day\">".
70 date_intl('D',$next_date)." ></a>" ,
75 //events for specific day are inserted into "daily" array
76 function initialize_events() {
77 global $daily_events, $calendardata, $month, $day, $year;
79 for ($i=7;$i<23;$i++
){
81 $evntime = '0' . $i . '00';
85 $daily_events[$evntime] = 'empty';
88 $cdate = $month . $day . $year;
90 if (isset($calendardata[$cdate])){
91 while ( $calfoo = each($calendardata[$cdate])){
92 $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
97 //main loop for displaying daily events
98 function display_events() {
99 global $daily_events, $month, $day, $year, $color;
101 ksort($daily_events,SORT_STRING
);
103 while ($calfoo = each($daily_events)){
110 $ehour = substr($calfoo['key'],0,2);
111 $eminute = substr($calfoo['key'],2,2);
112 if (!is_array($calfoo['value'])){
114 html_tag( 'td', $ehour . ':' . $eminute, 'left' ) .
115 html_tag( 'td', ' ', 'left' ) .
117 "<font size=\"-1\"><a href=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."\">".
118 _("ADD") . "</a></font>" ,
123 $calbar=$calfoo['value'];
124 if ($calbar['length']!=0){
125 $elength = '-'.date('H:i',mktime($ehour,$eminute+
$calbar['length'],0,1,1,0));
129 echo html_tag( 'tr', '', '', $color[$eo] ) .
130 html_tag( 'td', $ehour . ':' . $eminute . $elength, 'left' ) .
131 html_tag( 'td', '', 'left' ) . '[';
132 echo ($calbar['priority']==1) ?
"<font color=\"$color[1]\">$calbar[title]</font>" : "$calbar[title]";
133 echo"] $calbar[message] " .
135 "<font size=\"-1\"><nobr>\n" .
136 "<a href=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."&minute=".substr($calfoo['key'],2,2)."\">".
137 _("EDIT") . "</a> | \n" .
138 "<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\">" .
158 $prev_date = mktime(0, 0, 0, $month , $day - 1, $year);
159 $next_date = mktime(0, 0, 0, $month , $day +
1, $year);
160 $prev_day = date ('d',$prev_date);
161 $prev_month = date ('m',$prev_date);
162 $prev_year = date ('Y',$prev_date);
163 $next_day = date ('d',$next_date);
164 $next_month = date ('m',$next_date);
165 $next_year = date ('Y',$next_date);
167 $calself=basename($PHP_SELF);
169 $daily_events = array();
171 displayPageHeader($color, 'None');
178 </table
></td
></tr
></table
>