-
Notifications
You must be signed in to change notification settings - Fork 0
/
small_calendar.php
71 lines (63 loc) · 2.41 KB
/
small_calendar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
$monthNames = Array("January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December");
?>
<?php
if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("m");
if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y");
?>
<?php
$cMonth = $_REQUEST["month"];
$cYear = $_REQUEST["year"];
$prev_year = $cYear;
$next_year = $cYear;
$prev_month = $cMonth-1;
$next_month = $cMonth+1;
if ($prev_month == 0 ) {
$prev_month = 12;
$prev_year = $cYear - 1;
}
if ($next_month == 13 ) {
$next_month = 1;
$next_year = $cYear + 1;
}
?>
<table width="200">
<tr>
<td align="center">
<table width="100%" border="0" cellpadding="2" cellspacing="2" style='font-size:12px;'>
<tr align="center">
<td colspan="7" bgcolor="#999999" style="color:#FFFFFF;border-radius:3px;"><strong><?php echo $monthNames[$cMonth-1].' '.$cYear; ?></strong></td>
</tr>
<tr>
<td align="center" bgcolor="#999999" style="color:#FFFFFF;border-radius:3px;"><strong>S</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF;border-radius:3px;"><strong>M</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF;border-radius:3px;"><strong>T</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF;border-radius:3px;"><strong>W</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF;border-radius:3px;"><strong>T</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF;border-radius:3px;"><strong>F</strong></td>
<td align="center" bgcolor="#999999" style="color:#FFFFFF;border-radius:3px;"><strong>S</strong></td>
</tr>
<?php
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
for ($i=0; $i<($maxday+$startday); $i++) {
if(($i % 7) == 0 ) echo "<tr>";
if($i < $startday) echo "<td></td>";
else {
$asdf = ($i - $startday + 1);
if ($asdf == date('d') && $cMonth == date('m')) $more = " style='color:blue;padding:2px;background-color:#AAA;'"; else $more = " style='color:blue;'";
?>
<td align='center' valign='middle' height='20px'>
<a href='##' onclick='ShowActionDate(<?php echo $asdf; ?>,<?php echo $_REQUEST["month"]; ?>,<?php echo $_REQUEST["year"]; ?>);return false;' <?php echo $more; ?>><?php echo $asdf; ?></a>
</td><?php
}
if(($i % 7) == 6 ) echo "</tr>";
}
?>
</table>
</td>
</tr>
</table>