6 * Copyright (c) 2002-2005 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 * @subpackage calendar
19 define('SM_PATH','../../');
21 /* Calender plugin required files. */
22 require_once(SM_PATH
. 'plugins/calendar/calendar_data.php');
23 require_once(SM_PATH
. 'plugins/calendar/functions.php');
25 /* SquirrelMail required files. */
26 require_once(SM_PATH
. 'include/validate.php');
27 require_once(SM_PATH
. 'functions/strings.php');
28 require_once(SM_PATH
. 'functions/date.php');
29 require_once(SM_PATH
. 'config/config.php');
30 require_once(SM_PATH
. 'functions/page_header.php');
31 require_once(SM_PATH
. 'include/load_prefs.php');
32 require_once(SM_PATH
. 'functions/html.php');
36 // undo rg = on effects
37 if (isset($month)) unset($month);
38 if (isset($year)) unset($year);
39 if (isset($day)) unset($day);
41 if (isset($_GET['year']) && is_numeric($_GET['year'])) {
42 $year = $_GET['year'];
44 elseif (isset($_POST['year']) && is_numeric($_POST['year'])) {
45 $year = $_POST['year'];
47 if (isset($_GET['month']) && is_numeric($_GET['month'])) {
48 $month = $_GET['month'];
50 elseif (isset($_POST['month']) && is_numeric($_POST['month'])) {
51 $month = $_POST['month'];
53 if (isset($_GET['day']) && is_numeric($_GET['day'])) {
56 elseif (isset($_POST['day']) && is_numeric($_POST['day'])) {
62 //displays head of day calendar view
63 function day_header() {
64 global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day,
65 $prev_date, $next_month, $next_day, $next_year, $next_date;
67 echo html_tag( 'tr', '', '', $color[0] ) . "\n".
68 html_tag( 'td', '', 'left' ) .
69 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n" .
72 "<a href=\"day.php?year=$prev_year&month=$prev_month&day=$prev_day\">< ".
73 date_intl('D',$prev_date)."</a>",
75 html_tag( 'th', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) ,
76 '', '', 'width="75%"' ) .
78 "<a href=\"day.php?year=$next_year&month=$next_month&day=$next_day\">".
79 date_intl('D',$next_date)." ></a>" ,
84 //events for specific day are inserted into "daily" array
85 function initialize_events() {
86 global $daily_events, $calendardata, $month, $day, $year;
88 for ($i=7;$i<23;$i++
){
90 $evntime = '0' . $i . '00';
94 $daily_events[$evntime] = 'empty';
97 $cdate = $month . $day . $year;
99 if (isset($calendardata[$cdate])){
100 while ( $calfoo = each($calendardata[$cdate])){
101 $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
106 //main loop for displaying daily events
107 function display_events() {
108 global $daily_events, $month, $day, $year, $color;
110 ksort($daily_events,SORT_STRING
);
112 while ($calfoo = each($daily_events)){
119 $ehour = substr($calfoo['key'],0,2);
120 $eminute = substr($calfoo['key'],2,2);
121 if (!is_array($calfoo['value'])){
123 html_tag( 'td', $ehour . ':' . $eminute, 'left' ) .
124 html_tag( 'td', ' ', 'left' ) .
126 "<font size=\"-1\"><a href=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."\">".
127 _("ADD") . "</a></font>" ,
132 $calbar=$calfoo['value'];
133 if ($calbar['length']!=0){
134 $elength = '-'.date('H:i',mktime($ehour,$eminute+
$calbar['length'],0,1,1,0));
138 echo html_tag( 'tr', '', '', $color[$eo] ) .
139 html_tag( 'td', $ehour . ':' . $eminute . $elength, 'left' ) .
140 html_tag( 'td', '', 'left' ) . '[';
141 echo ($calbar['priority']==1) ?
"<font color=\"$color[1]\">$calbar[title]</font>" : "$calbar[title]";
142 echo"] $calbar[message] " .
144 "<font size=\"-1\"><nobr>\n" .
145 "<a href=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."&minute=".substr($calfoo['key'],2,2)."\">".
146 _("EDIT") . "</a> | \n" .
147 "<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\">" .
167 $prev_date = mktime(0, 0, 0, $month , $day - 1, $year);
168 $next_date = mktime(0, 0, 0, $month , $day +
1, $year);
169 $prev_day = date ('d',$prev_date);
170 $prev_month = date ('m',$prev_date);
171 $prev_year = date ('Y',$prev_date);
172 $next_day = date ('d',$next_date);
173 $next_month = date ('m',$next_date);
174 $next_year = date ('Y',$next_date);
176 $calself=basename($PHP_SELF);
178 $daily_events = array();
180 displayPageHeader($color, 'None');
187 </table
></td
></tr
></table
>