+++ /dev/null
-<?php
-
-function calendar($year,$month, $days, $ref_template, $font_size) {
-
- $firstday = mktime(0,0,0,$month,1,$year);
- $dayofmonth = date('t',$firstday);
-
- $day_count = 1;
-
- $num = 0;
-
- for($i = 0; $i < 7; $i++) {
-
- $dayofweek = date('w', mktime(0, 0, 0, $month, $day_count, $year));
- $dayofweek = $dayofweek - 1;
- if($dayofweek == -1) $dayofweek = 6;
-
- if($dayofweek == $i) {
-
- $week[$num][$i] = $day_count;
- $day_count++;
-
- } else {
-
- $week[$num][$i] = "";
-
- }
- }
-
-
- while(true) {
-
- $num++;
-
- for($i = 0; $i < 7; $i++) {
-
- $week[$num][$i] = $day_count;
- $day_count++;
-
- if($day_count > $dayofmonth) break;
-
- }
-
- if($day_count > $dayofmonth) break;
-
- }
-
- echo '<table align="center" border=1>';
-
- for($i = 0; $i < count($week); $i++) {
-
- echo '<tr>';
-
- for($j = 0; $j < 7; $j++) {
-
- if(!empty($week[$i][$j])) {
- $str = $week[$i][$j];
- $fstr='<font size="+'.$font_size.'">'.$str.'</font>';
- if (!empty($days[$year.$month.sprintf('%02d',$str)])) {
- $href=sprintf($ref_template,$days[$year.$month.sprintf('%02d',$str)]);
- if($j == 5 || $j == 6) {
- echo '<td align="right" bgcolor="mediumaquamarine"><a href='.$href.'><font color=red>'.$fstr.'</font></a></td>';
- } else {
- echo '<td align="right" bgcolor="mediumaquamarine"><a href='.$href.'>'.$fstr.'</a></td>';
- }
- } else {
- if($j == 5 || $j == 6) {
- echo '<td align="right"><font color=red>'.$fstr.'</font></td>';
- } else {
- echo '<td align="right">'.$fstr.'</td>';
- }
- }
- }
-
- else echo '<td> </td>';
-
- }
-
- echo '</tr>';
-
- }
-
- echo '</table>';
-
-}
-
-?>
\ No newline at end of file