require("calendar-functions.php3"); commonHeader("Calendario del $month/$year"); if (empty($year)) $year=date("Y"); if (empty($month)) $month=date("m"); /* Reset some variables */ $date=01; $day=01; $off=0; /* Figure out how many days are in this month */ while (checkdate($month,$date,$year)): $date++; endwhile; /* Figure out what month it is, convert the number to words, and then create a table with days of the week headers */ echo "
| Domingo | "; echo "Lunes | "; echo "Martes | "; echo "Miércoles | "; echo "Jueves | "; echo "Viernes | "; echo "Sábado | "; /* Start the table data and make sure the number of days does not exceed the total for the month - $date will always be one more than the total number of days in the momth */ echo "||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| $day | "; $off = '01'; } elseif ($day == '01' and date('l', mktime(0,0,0,$month,$day,$year)) == 'Monday') { echo "$day | "; $off= '02'; } elseif ($day == '01' and date('l', mktime(0,0,0,$month,$day,$year)) == 'Tuesday') { echo "$day | "; $off= '03'; } elseif ($day == '01' and date('l', mktime(0,0,0,$month,$day,$year)) == 'Wednesday') { echo "$day | "; $off= '04'; } elseif ($day == '01' and date('l', mktime(0,0,0,$month,$day,$year)) == 'Thursday') { echo "$day | "; $off= '05'; } elseif ($day == '01' and date('l', mktime(0,0,0,$month,$day,$year)) == 'Friday') { echo "$day | "; $off= '06'; } elseif ($day =='01' and date('l', mktime(0,0,0,$month,$day,$year)) == 'Saturday') { echo "$day | "; $off= '07'; } else { echo "$day | "; } /* Increment the day and the cells to go before the end of the row and end the row when appropriate */ $day++; $off++; if ($off>7) { echo "|||||||||||||||||||||