6
* Copyright (c) 2002-2006 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
4
* Displays the main calendar page (month view).
13
* $Id: calendar.php,v 1.13.2.8 2006/02/03 22:27:52 jervfors Exp $
6
* @copyright © 2002-2006 The SquirrelMail Project Team
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
8
* @version $Id: calendar.php,v 1.13.2.9 2006/05/06 07:52:17 tokul Exp $
10
* @subpackage calendar
15
14
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
16
/* 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');
17
include_once(SM_PATH . 'include/validate.php');
18
/* load date_intl() */
19
include_once(SM_PATH . 'functions/date.php');
21
/* Calendar plugin required files. */
22
include_once(SM_PATH . 'plugins/calendar/calendar_data.php');
23
include_once(SM_PATH . 'plugins/calendar/functions.php');
32
if (isset($_GET['month']) && is_numeric($_GET['month'])) {
33
$month = $_GET['month'];
35
if (isset($_GET['year']) && is_numeric($_GET['year'])) {
36
$year = $_GET['year'];
38
if (isset($_POST['year']) && is_numeric($_POST['year'])) {
39
$year = $_POST['year'];
41
if (isset($_POST['month']) && is_numeric($_POST['month'])) {
42
$month = $_POST['month'];
26
if (! sqgetGlobalVar('month',$month,SQ_FORM) || ! is_numeric($month)) {
29
if (! sqgetGlobalVar('year',$year,SQ_FORM) || ! is_numeric($year)) {
46
//display upper part of month calendar view
35
* display upper part of month calendar view
47
39
function startcalendar() {
48
global $year, $month, $day, $color;
40
global $year, $month, $color;
50
42
$prev_date = mktime(0, 0, 0, $month - 1, 1, $year);
51
43
$act_date = mktime(0, 0, 0, $month, 1, $year);
89
81
'', $color[0] ) ."\n";
92
//main logic for month view of calendar
85
* main logic for month view of calendar
93
89
function drawmonthview() {
94
global $year, $month, $day, $color, $calendardata, $todayis;
90
global $year, $month, $color, $calendardata, $todayis;
96
92
$aday = 1 - date('w', mktime(0, 0, 0, $month, 1, $year));
97
93
$days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
104
100
if ( $aday <= $days_in_month && $aday > 0){
105
101
echo html_tag( 'td', '', 'left', $color[4], 'height="50" valign="top"' ) ."\n".
106
102
html_tag( 'div', '', 'right' );
107
echo(($cdate==$todayis) ? "<font size=-1 color=$color[1]>[ " . _("TODAY") . " ] " : "<font size=-1>");
103
echo(($cdate==$todayis) ? '<font size="-1" color="'.$color[1].'">[ ' . _("TODAY") . " ] " : '<font size="-1">');
108
104
echo "<a href=day.php?year=$year&month=$month&day=";
109
105
echo(($aday<10) ? "0" : "");
110
106
echo "$aday>$aday</a></font></div>";
117
113
while ($calfoo = each($calendardata[$cdate])) {
118
114
$calbar = $calendardata[$cdate][$calfoo['key']];
119
$title = '['. $calfoo['key']. '] ' .$calbar['message'];
120
echo ($calbar['priority']==1) ? "<a href=\"#\" style=\"text-decoration:none; color: $color[1]\" title=\"$title\">$calbar[title]</a><br>\n" : "<a href=\"#\" style=\"text-decoration:none; color: $color[6]\" title=\"$title\">$calbar[title]</a><br>\n";
115
// FIXME: how to display multiline task
116
$title = '['. $calfoo['key']. '] ' .
117
str_replace(array("\r","\n"),array(' ',' '),htmlspecialchars($calbar['message']));
118
// FIXME: link to nowhere
119
echo "<a href=\"#\" style=\"text-decoration:none; color: "
120
.($calbar['priority']==1 ? $color[1] : $color[6])
121
."\" title=\"$title\">".htmlspecialchars($calbar['title'])."</a><br />\n";
134
//end of monthly view and form to jump to any month and year
136
* end of monthly view and form to jump to any month and year
135
140
function endcalendar() {
136
141
global $year, $month, $day, $color;
138
143
echo html_tag( 'tr' ) ."\n" .
139
144
html_tag( 'td', '', 'left', '', 'colspan="7"' ) ."\n" .
140
" <FORM NAME=caljump ACTION=\"calendar.php\" METHOD=POST>\n".
141
" <SELECT NAME=\"year\">\n";
145
" <form name=\"caljump\" action=\"calendar.php\" method=\"post\">\n".
146
" <select name=\"year\">\n";
142
147
select_option_year($year);
144
" <SELECT NAME=\"month\">\n";
149
" <select name=\"month\">\n";
145
150
select_option_month($month);
147
' <INPUT TYPE=SUBMIT VALUE="' . _("Go") . "\">\n".
150
"</TABLE></TD></TR></TABLE>\n";
152
' <input type="submit" value="' . _("Go") . "\" />\n".
155
"</table></td></tr></table>\n";