/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /************************************************************ * PHP Calendar by Scott Richardson, ScanOnline June 2002 * ************************************************************/ //date sent to calendar } else{ $WorkDate = $_REQUEST['CurrentMonth']; } //page that called the calendar $ParentPage = ""; } else{ $ParentPage = $_REQUEST["ParentPage"]; } $InThisMonth = 0; $CurrentDate = GetStartingPoint($DaysLastMonth); //Head echo "<html><head></head>"; //Body echo "<body topmargin='100' leftmargin='100' marginheight='100' marginwidth='100'>"; echo "<table bgcolor='B0C4DE' height='100%' width='100%' border='1'><tr>"; echo "<td colspan='7' height='8%' align='center' >"; echo "<table height='100%' width='100%' border='0'><tr>"; echo "<td align='left'><b><font size='2'><a href='http://localhost/calendar/cal.php?CurrentMonth=".$PrevMonth."&ParentPage=".$ParentPage."'>Mês<br>Anterior</a></font></b></td>"; echo "<td align='center'>"; echo "<td align='right'><b><font size='2'><a href='http://localhost/calendar/cal.php?CurrentMonth=".$NextMonth."&ParentPage=".$ParentPage."'>Próximo<br>Mês</a></font></b></td></tr></table>"; echo "</td></tr>"; echo "<td height='8%' align='center' valign='top' width='15%' bgcolor='B0C4DE'><font size='4'><b>Su</b></font></td>"; echo "<td align='center' valign='top' width='14%' bgcolor='B0C4DE'><font size='4'><b>Mo</b></font></td>"; echo "<td align='center' valign='top' width='14%' bgcolor='B0C4DE'><font size='4'><b>Tu</b></font></td>"; echo "<td align='center' valign='top' width='14%' bgcolor='B0C4DE'><font size='4'><b>We</b></font></td>"; echo "<td align='center' valign='top' width='14%' bgcolor='B0C4DE'><font size='4'><b>Th</b></font></td>"; echo "<td align='center' valign='top' width='14%' bgcolor='B0C4DE'><font size='4'><b>Fr</b></font></td>"; echo "<td align='center' valign='top' width='15%' bgcolor='B0C4DE'><font size='4'><b>Sa</b></font></td></tr>"; for($x=1;$x<7;$x++){ echo "<tr>"; for($i=1;$i<8;$i++){ echo "<td align='left' valign='top' height='14%' "; if($InThisMonth==0){ echo "bgcolor='#D3D3D3'>"; echo $CurrentDate++; } else{ echo "bgcolor='FFFACD'>"; } else{ echo "bgcolor='#FFFFFF'>"; } if( $ParentPage ){ echo "<a href='".$ParentPage."?CalendarDate=".GetThisDate($CurrentDate)."'>".$CurrentDate++."</a>"; } else{ echo $CurrentDate++; } } echo "</td>"; if( $InThisMonth == 0 && $CurrentDate > $DaysLastMonth ){ $CurrentDate = 1; $InThisMonth = 1; } elseif($InThisMonth == 1 && $CurrentDate > $DaysThisMonth ){ $CurrentDate = 1; $InThisMonth = 0; } } echo "</tr>"; } echo "</table></body></html>"; function DaysInMonth($dt) { } function GetStartingPoint($DLM){ $mday = $today['mday']; $mday-=1; case "Sunday": $CD = 1; $GLOBALS["InThisMonth"] = 1; break; case "Monday": $CD = $DLM; break; case "Tuesday": $CD = $DLM-1; break; case "Wednesday": $CD = $DLM-2; break; case "Thursday": $CD = $DLM-3; break; case "Friday": $CD = $DLM-4; break; case "Saturday": $CD = $DLM-5; } return $CD; } function GetThisDate($SelectedDay){ $mon = $today['mon']; $myear = $today['year']; } ?>