6 * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
8 * Displays the day page (day view).
10 * @copyright © 2002-2005 The SquirrelMail Project Team
11 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 * @subpackage calendar
18 define('SM_PATH','../../');
20 /* Calender plugin required files. */
21 require_once(SM_PATH
. 'plugins/calendar/calendar_data.php');
22 require_once(SM_PATH
. 'plugins/calendar/functions.php');
24 /* SquirrelMail required files. */
25 require_once(SM_PATH
. 'include/validate.php');
26 require_once(SM_PATH
. 'functions/strings.php');
27 require_once(SM_PATH
. 'functions/date.php');
28 require_once(SM_PATH
. 'config/config.php');
29 require_once(SM_PATH
. 'functions/page_header.php');
30 require_once(SM_PATH
. 'include/load_prefs.php');
31 require_once(SM_PATH
. 'functions/html.php');
35 // undo rg = on effects
36 if (isset($month)) unset($month);
37 if (isset($year)) unset($year);
38 if (isset($day)) unset($day);
40 if (isset($_GET['year']) && is_numeric($_GET['year'])) {
41 $year = $_GET['year'];
43 elseif (isset($_POST['year']) && is_numeric($_POST['year'])) {
44 $year = $_POST['year'];
46 if (isset($_GET['month']) && is_numeric($_GET['month'])) {
47 $month = $_GET['month'];
49 elseif (isset($_POST['month']) && is_numeric($_POST['month'])) {
50 $month = $_POST['month'];
52 if (isset($_GET['day']) && is_numeric($_GET['day'])) {
55 elseif (isset($_POST['day']) && is_numeric($_POST['day'])) {
61 //displays head of day calendar view
62 function day_header() {
63 global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day,
64 $prev_date, $next_month, $next_day, $next_year, $next_date;
66 echo html_tag( 'tr', '', '', $color[0] ) . "\n".
67 html_tag( 'td', '', 'left' ) .
68 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n" .
71 "<a href=\"day.php?year=$prev_year&month=$prev_month&day=$prev_day\">< ".
72 date_intl('D',$prev_date)."</a>",
74 html_tag( 'th', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) ,
75 '', '', 'width="75%"' ) .
77 "<a href=\"day.php?year=$next_year&month=$next_month&day=$next_day\">".
78 date_intl('D',$next_date)." ></a>" ,
83 //events for specific day are inserted into "daily" array
84 function initialize_events() {
85 global $daily_events, $calendardata, $month, $day, $year;
87 for ($i=7;$i<23;$i++
){
89 $evntime = '0' . $i . '00';
93 $daily_events[$evntime] = 'empty';
96 $cdate = $month . $day . $year;
98 if (isset($calendardata[$cdate])){
99 while ( $calfoo = each($calendardata[$cdate])){
100 $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo['key']];
105 //main loop for displaying daily events
106 function display_events() {
107 global $daily_events, $month, $day, $year, $color;
109 ksort($daily_events,SORT_STRING
);
111 while ($calfoo = each($daily_events)){
118 $ehour = substr($calfoo['key'],0,2);
119 $eminute = substr($calfoo['key'],2,2);
120 if (!is_array($calfoo['value'])){
122 html_tag( 'td', $ehour . ':' . $eminute, 'left' ) .
123 html_tag( 'td', ' ', 'left' ) .
125 "<font size=\"-1\"><a href=\"event_create.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."\">".
126 _("ADD") . "</a></font>" ,
131 $calbar=$calfoo['value'];
132 if ($calbar['length']!=0){
133 $elength = '-'.date('H:i',mktime($ehour,$eminute+
$calbar['length'],0,1,1,0));
137 echo html_tag( 'tr', '', '', $color[$eo] ) .
138 html_tag( 'td', $ehour . ':' . $eminute . $elength, 'left' ) .
139 html_tag( 'td', '', 'left' ) . '[';
140 echo ($calbar['priority']==1) ?
"<font color=\"$color[1]\">$calbar[title]</font>" : "$calbar[title]";
141 echo"] $calbar[message] " .
143 "<font size=\"-1\"><nobr>\n" .
144 "<a href=\"event_edit.php?year=$year&month=$month&day=$day&hour=".substr($calfoo['key'],0,2)."&minute=".substr($calfoo['key'],2,2)."\">".
145 _("EDIT") . "</a> | \n" .
146 "<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\">" .
166 $prev_date = mktime(0, 0, 0, $month , $day - 1, $year);
167 $next_date = mktime(0, 0, 0, $month , $day +
1, $year);
168 $prev_day = date ('d',$prev_date);
169 $prev_month = date ('m',$prev_date);
170 $prev_year = date ('Y',$prev_date);
171 $next_day = date ('d',$next_date);
172 $next_month = date ('m',$next_date);
173 $next_year = date ('Y',$next_date);
175 $calself=basename($PHP_SELF);
177 $daily_events = array();
179 displayPageHeader($color, 'None');
186 </table
></td
></tr
></table
>