egroupware_official/calendar/index.php

181 lines
6.4 KiB
PHP
Raw Normal View History

2000-08-18 05:24:22 +02:00
<?php php_track_vars?>
<?php
/**************************************************************************\
* phpGroupWare - Calendar *
* http://www.phpgroupware.org *
* Based on Webcalendar by Craig Knudsen <cknudsen@radix.net> *
* http://www.radix.net/~cknudsen *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
if ($friendly) {
$phpgw_info["flags"]["noheader"] = True;
2000-08-18 05:24:22 +02:00
}
$phpgw_info["flags"]["currentapp"] = "calendar";
2000-08-18 05:24:22 +02:00
include("../header.inc.php");
if (strlen($date) > 0) {
$thisyear = substr($date, 0, 4);
$thismonth = substr($date, 4, 2);
$thisday = substr($date, 6, 2);
} else {
if ($day == 0)
$thisday = date("d");
else
$thisday = $day;
if ($month == 0)
$thismonth = date("m");
else
$thismonth = $month;
if ($year == 0)
$thisyear = date("Y");
else
$thisyear = $year;
}
$next = mktime(2,0,0,$thismonth + 1,1,$thisyear);
$nextyear = date("Y", $next);
$nextmonth = date("m", $next);
$nextdate = date("Ymd");
$prev = mktime(2,0,0,$thismonth - 1,1,$thisyear);
$prevyear = date("Y",$prev);
$prevmonth = date("m",$prev);
$prevdate = date("Ymd");
if ($friendly) {
2000-08-18 05:24:22 +02:00
echo "<body bgcolor=\"".$phpgw_info["theme"][bg_color]."\">";
$view = "month";
}
2000-08-18 05:24:22 +02:00
?>
<HEAD>
<STYLE TYPE="text/css">
<?php echo "$CCS_DEFS";?>
.tablecell {
width: 80px;
height: 80px;
}
</STYLE>
</HEAD>
2000-10-04 05:30:03 +02:00
<table border="0" width="100%">
<tr>
2000-08-18 05:24:22 +02:00
<?php
if (! $friendly) {
2000-10-04 05:30:03 +02:00
echo "<td align=\"left\">";
2000-08-18 05:24:22 +02:00
display_small_month($prevmonth,$prevyear,True);
}
?>
2000-10-04 05:30:03 +02:00
<td align="middle"><font size="+2" color="#000000"><B>
2000-08-18 05:24:22 +02:00
<?php
$m = mktime(2,0,0,$thismonth,1,$thisyear);
2000-09-07 22:49:55 +02:00
print lang(strftime("%B",$m)) . " " . $thisyear;
2000-08-18 05:24:22 +02:00
?>
2000-10-04 05:30:03 +02:00
</b></font>
<font color="#000000" size="+1">
2000-08-18 05:24:22 +02:00
<br>
<?php
echo $phpgw->common->display_fullname($phpgw_info["user"]["userid"],$phpgw_info["user"]["firstname"],$phpgw_info["user"]["lastname"]);
2000-08-18 05:24:22 +02:00
?>
2000-10-04 05:30:03 +02:00
</font></td>
2000-08-18 05:24:22 +02:00
<?php
if (! $friendly) {
2000-10-04 05:30:03 +02:00
echo "<td align=\"right\">";
2000-08-18 05:24:22 +02:00
display_small_month($nextmonth,$nextyear,True);
}
?>
2000-10-04 05:30:03 +02:00
</tr>
</table>
2000-08-18 05:24:22 +02:00
2000-10-04 05:30:03 +02:00
<table width="100%" border="0" bordercolor="#FFFFFF" cellspacing="2" cellpadding="2">
2000-08-18 05:24:22 +02:00
2000-10-04 05:30:03 +02:00
<tr>
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Sun"); ?></font></th>
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Mon"); ?></font></th>
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Tue"); ?></font></th>
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Wed"); ?></font></th>
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Thu"); ?></font></th>
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Fri"); ?></font></th>
<th width="14%" bgcolor="<?php echo $phpgw_info["theme"]["th_bg"]; ?>"><font color="<?php echo $phpgw_info["theme"]["th_text"]; ?>"><?php echo lang("Sat"); ?></font></th>
</tr>
2000-08-18 05:24:22 +02:00
<?php
/* Pre-Load the repeated events for quckier access */
$repeated_events = read_repeated_events();
// We add 2 hours on to the time so that the switch to DST doesn't
// throw us off. So, all our dates are 2AM for that day.
// $sun = get_sunday_before($thisyear,$thismonth,1) + 7200;
$sun = get_sunday_before($thisyear,$thismonth,1) + 7200;
// generate values for first day and last day of month
$monthstart = mktime(2,0,0,$thismonth,1,$thisyear);
$monthend = mktime(2,0,0,$thismonth + 1,0,$thisyear);
// debugging
//echo "<P>sun = " . date("D, m-d-Y", $sun) . "<BR>";
//echo "<P>monthstart = " . date("D, m-d-Y", $monthstart) . "<BR>";
//echo "<P>monthend = " . date("D, m-d-Y", $monthend) . "<BR>";
$today = mktime(2,0,0,date("m"),date("d"),date("Y"));
for ($i = $sun; date("Ymd",$i) <= date("Ymd",$monthend); $i += (24 * 3600 * 7) ) {
2000-10-04 22:45:39 +02:00
$cellcolor = $phpgw->nextmatchs->alternate_row_color($cellcolor);
2000-08-18 05:24:22 +02:00
2000-10-04 05:30:03 +02:00
echo "<tr>\n";
2000-08-18 05:24:22 +02:00
for ($j = 0; $j < 7; $j++) {
$date = $i + ($j * 24 * 3600);
if (date("Ymd",$date) >= date("Ymd",$monthstart) &&
2000-10-04 22:48:09 +02:00
date("Ymd",$date) <= date("Ymd",$monthend)) {
echo "<td valign=\"top\" width=\"75\" height=\"75\"";
2000-08-18 05:24:22 +02:00
if (date("Ymd",$date) == date("Ymd",$today)) {
2000-10-04 05:30:03 +02:00
echo " bgcolor=\"".$phpgw_info["theme"]["cal_today"]."\">";
2000-08-18 05:24:22 +02:00
} else {
2000-10-04 22:45:39 +02:00
echo " bgcolor=\"$cellcolor\">";
2000-08-18 05:24:22 +02:00
}
2000-09-29 07:38:24 +02:00
print_date_entries($date,$friendly,$phpgw_info["user"]["sessionid"]);
2000-09-29 07:38:24 +02:00
$thirsday=$i+24*3600*4;
if ($phpgw_info["user"]["preferences"]["weekdaystarts"] == "Sunday" && $j == 0) {
2000-10-04 05:30:03 +02:00
echo "<font size=\"-2\"><a href=\"".$phpgw->link("week.php","date=".date("Ymd",$date))."\">week " .(int)((date("z",$thirsday)+7)/7) . "</a></font>";
2000-09-29 07:38:24 +02:00
}
if ($phpgw_info["user"]["preferences"]["weekdaystarts"] == "Monday" && $j == 1) {
2000-10-04 05:30:03 +02:00
echo "<font size=\"-2\"><a href=\"".$phpgw->link("week.php","date=" . date("Ymd",$date)) . "\">week " . (int)((date("z",$thirsday)+7)/7) . "</a></font>";
2000-09-29 07:38:24 +02:00
}
2000-10-04 05:30:03 +02:00
echo "</td>\n";
2000-08-18 05:24:22 +02:00
} else {
2000-10-04 05:30:03 +02:00
echo "<td></td>\n";
2000-08-18 05:24:22 +02:00
}
}
2000-10-04 05:30:03 +02:00
print "</tr>\n";
2000-08-18 05:24:22 +02:00
}
?>
2000-10-04 05:30:03 +02:00
</table>
<p>
<p>
2000-08-18 05:24:22 +02:00
<?php
if (! $friendly) {
$param = "";
if ($thisyear)
$param .= "year=$thisyear&month=$thismonth&";
2000-10-04 05:30:03 +02:00
$param .= "friendly=1";
echo "<a href=\"".$phpgw->link($PHP_SELF,$param)."\" target=\"cal_printer_friendly\" onMouseOver=\"window.status='"
.lang("Generate printer-friendly version")."'>[" . lang("Printer Friendly") . "]</a>";
$phpgw->common->phpgw_footer();
2000-08-18 05:24:22 +02:00
}
2000-09-28 02:17:13 +02:00
?>