3 function calendar($year,$month, $days, $ref_template, $font_size) {
5 $firstday = mktime(0,0,0,$month,1,$year);
6 $dayofmonth = date('t',$firstday);
12 for($i = 0; $i < 7; $i++) {
14 $dayofweek = date('w', mktime(0, 0, 0, $month, $day_count, $year));
15 $dayofweek = $dayofweek - 1;
16 if($dayofweek == -1) $dayofweek = 6;
18 if($dayofweek == $i) {
20 $week[$num][$i] = $day_count;
35 for($i = 0; $i < 7; $i++) {
37 $week[$num][$i] = $day_count;
40 if($day_count > $dayofmonth) break;
44 if($day_count > $dayofmonth) break;
48 echo '<table align="center" border=1>';
50 for($i = 0; $i < count($week); $i++) {
54 for($j = 0; $j < 7; $j++) {
56 if(!empty($week[$i][$j])) {
58 $fstr='<font size="+'.$font_size.'">'.$str.'</font>';
59 if (!empty($days[$year.$month.sprintf('%02d',$str)])) {
60 $href=sprintf($ref_template,$days[$year.$month.sprintf('%02d',$str)]);
61 if($j == 5 || $j == 6) {
62 echo '<td align="right" bgcolor="mediumaquamarine"><a href='.$href.'><font color=red>'.$fstr.'</font></a></td>';
64 echo '<td align="right" bgcolor="mediumaquamarine"><a href='.$href.'>'.$fstr.'</a></td>';
67 if($j == 5 || $j == 6) {
68 echo '<td align="right"><font color=red>'.$fstr.'</font></td>';
70 echo '<td align="right">'.$fstr.'</td>';
75 else echo '<td> </td>';