2
/********************************************************
3
include/display_monthly_calendar.inc
5
(C)Copyright 2003 Ryo Chijiiwa <Ryo@IlohaMail.org>
7
This file is part of IlohaMail, and released under GPL.
8
See COPYING, or http://www.fsf.org/copyleft/gpl.html
11
Display monthly calendar
16
********************************************************/
18
//full english months, for generating date string (excessive?)
19
$eng_month_a = array("January", "February", "March", "April", "May", "June", "July",
20
"August", "September", "October", "November", "December");
22
//generate string for first day of month
23
$month_str = $eng_month_a[$month-1];
24
$date_str = "1 $month_str $year";
26
//convert string to timestamp
27
$time = strtotime($date_str);
29
//day of week month starts on
30
$dow = date("w", $time);
32
//number of days in month
33
$num_days = date("t", $time);
36
$heading = $lang_datetime["monthyear"];
37
$heading = str_replace("%m", $lang_months[$month], $heading);
38
$heading = str_replace("%y", $year, $heading);
40
if (($month < 10) && (strlen($month)==1)) $mon_str = "0".$month;
41
else $mon_str = $month;
45
<table width="80%" border="0">
47
<td width="15%" align="center"><a href=<?php echo "calendar.php?user=$user&month=$month&year=$prev_year"?>><<</a></td>
48
<td width="15%" align="center"><a href=<?php echo "calendar.php?user=$user&month=$prev_month&year=".($month==1?$prev_year:$year)?>><</a></td>
49
<td width="40%" align="center"><h2><?php echo $heading?></h2></td>
50
<td width="15%" align="center"><a href=<?php echo "calendar.php?user=$user&month=$next_month&year=".($month==12?$next_year:$year)?>>></a></td>
51
<td width="15%" align="center"><a href=<?php echo "calendar.php?user=$user&month=$month&year=$next_year"?>>>></a></td>
55
echo "<span class=mainLight><b>".$heading."</b></span>";
57
<table border="0" cellspacing="1" cellpadding="3" bgcolor="<?php echo $my_colors["main_head_bg"]?>">
60
for ($x = 0; $x<7; $x++){
61
echo "<td valign=\"top\" align=\"center\" bgcolor=\"".$my_colors["main_hilite"]."\" width=\"14%\">";
62
echo $lang_datetime["dsow_short"][$x];
69
for ($x = 0; $x < $dow; $x++){
70
echo "<td valign=\"top\" bgcolor=\"".$my_colors["main_hilite"]."\" width=\"14%\">";
74
for ($x = 1; $x <= $num_days; $x++){
75
if (($x < 10) && (strlen($x)==1)) $day_str = "0".$x;
78
$disp_date = $year.$mon_str.$day_str;
79
$url = "calendar.php?user=$user&date=$disp_date";
81
if ($dow==0) echo "<tr>";
82
echo "<td valign=\"top\" bgcolor=\"".$my_colors["main_bg"]."\" width=\"14%\">";
83
echo "<a href=\"$url\">".($disp_date==$date?"<b>":"")."$x".($disp_date==$date?"<b>":"")."</a>";
85
//showCell($x, $my_colors["main_bg"]);
86
if ($dow==6) echo "</tr>\n";
87
$dow = ($dow + 1) % 7;
90
for ($x = $dow; $x < 7; $x++){
91
echo "<td valign=\"top\" bgcolor=\"".$my_colors["main_hilite"]."\" width=\"14%\">";