6 * Copyright (c) 2002-2004 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');
35 if (isset($_GET['year'])) {
36 $year = $_GET['year'];
38 elseif (isset($_POST['year'])) {
39 $year = $_POST['year'];
41 if (isset($_GET['month'])) {
42 $month = $_GET['month'];
44 elseif (isset($_POST['month'])) {
45 $month = $_POST['month'];
47 if (isset($_GET['day'])) {
50 elseif (isset($_POST['day'])) {
56 //displays head of day calendar view
57 function day_header() {
58 global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day,
59 $prev_date, $next_month, $next_day, $next_year, $next_date;
61 echo html_tag( 'tr', '', '', $color[0] ) . "\n".
62 html_tag( 'td', '', 'left' ) .
63 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n" .
66 "<a href=\"day.php?year=$prev_year&month=$prev_month&day=$prev_day\">< ".
67 date_intl('D',$prev_date)."</a>",
69 html_tag( 'th', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) ,
70 '', '', 'width="75%"' ) .
72 "<a href=\"day.php?year=$next_year&month=$next_month&day=$next_day\">".
73 date_intl('D',$next_date)." ></a>" ,
78 //events for specific day are inserted into "daily" array
79 function initialize_events() {
80 global $daily_events, $calendardata, $month, $day, $year;
82 for ($i=7;$i<23;$i++
){
84 $evntime = '0' . $i . '00';
88 $daily_events[$evntime] = 'empty';
91 $cdate = $month . $day . $year;
93 if (isset($calendardata[$cdate])){
94 while ( $calfoo = each($calendardata[$cdate])){
95 $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
100 //main loop for displaying daily events
101 function display_events() {
102 global $daily_events, $month, $day, $year, $color;
104 ksort($daily_events,SORT_STRING
);
106 while ($calfoo = each($daily_events)){
113 $ehour = substr($calfoo['key'],0,2);
114 $eminute = substr($calfoo['key'],2,2);
115 if (!is_array($calfoo['value'])){
117 html_tag( 'td', $ehour . ':' . $eminute, 'left' ) .
118 html_tag( 'td', ' ', 'left' ) .
120 "<font size=\"-1\"><a href=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."\">".
121 _("ADD") . "</a></font>" ,
126 $calbar=$calfoo['value'];
127 if ($calbar['length']!=0){
128 $elength = '-'.date('H:i',mktime($ehour,$eminute+
$calbar['length'],0,1,1,0));
132 echo html_tag( 'tr', '', '', $color[$eo] ) .
133 html_tag( 'td', $ehour . ':' . $eminute . $elength, 'left' ) .
134 html_tag( 'td', '', 'left' ) . '[';
135 echo ($calbar['priority']==1) ?
"<font color=\"$color[1]\">$calbar[title]</font>" : "$calbar[title]";
136 echo"] $calbar[message] " .
138 "<font size=\"-1\"><nobr>\n" .
139 "<a href=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."&minute=".substr($calfoo['key'],2,2)."\">".
140 _("EDIT") . "</a> | \n" .
141 "<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\">" .
161 $prev_date = mktime(0, 0, 0, $month , $day - 1, $year);
162 $next_date = mktime(0, 0, 0, $month , $day +
1, $year);
163 $prev_day = date ('d',$prev_date);
164 $prev_month = date ('m',$prev_date);
165 $prev_year = date ('Y',$prev_date);
166 $next_day = date ('d',$next_date);
167 $next_month = date ('m',$next_date);
168 $next_year = date ('Y',$next_date);
170 $calself=basename($PHP_SELF);
172 $daily_events = array();
174 displayPageHeader($color, 'None');
181 </table
></td
></tr
></table
>