Fremhæve en eller flere datoer i kalender
Hej eksperter.Jeg har leget lidt med en kalender, og fundet en simpel færdiglavet på nettet. Problemet er lidt, at jeg ikke helt kan finde ud af, hvordan jeg skal markere bestemte datoer i kalenderen.
Forhåbentlig kan en af jer dygtige personer hjælpe mig med det.
Den fylder nok lidt, men jeg vedlægger lige koden her:
[code]
<?php
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<style>
td{
font-family:arial;
font-size:8pt;
text-align:center;
}
</style>
<title>inc_calendar</title>
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie3-2nav3-0">
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name=ProgId content=VisualStudio.HTML>
<meta name=Originator content="Microsoft Visual Studio .NET 7.1">
</head>
<body MS_POSITIONING="FlowLayout">
<?php
$Day = date("d");
$Month = isset($_REQUEST["Month"]) ? $_REQUEST["Month"] : "";
$Year = isset($_REQUEST["Year"]) ? $_REQUEST["Year"] : "";
if(empty($Month))
$Month=date("m");
if(empty($Year)){
$Year=date("y");
$Year='20'.$Year;
}
$MonthName = date("F", mktime(0, 0, 0, $Month, 1, $Year));
if($Month==1){
$LastMonth = 12;
$LastYear = $Year - 1;
}else{
$LastMonth = $Month - 1;
$LastYear = $Year;
}
if($Month==12){
$NextMonth = 1;
$NextYear = $Year + 1;
}else{
$NextMonth = $Month + 1;
$NextYear = $Year;
}
$DaysInMonth=cal_days_in_month(CAL_GREGORIAN,$Month,$Year);
$DaysInMonth++;
$ActualDaysInMonth=cal_days_in_month(CAL_GREGORIAN,$Month,$Year);
$DayName = date("D", mktime(0, 0, 0, $Month, 1, $Year));
$DayNameSingleLetter = substr($DayName, 0, 1);
$ActualMonth = date("m");
$ActualYear = '20'.date("y");
if($Month==$ActualMonth && $Year==$ActualYear)
$DayToday = date("d");
else
$DayToday = '';
$StartOnDay = 0;
if($DayName=='Mon'){
$StartOnDay=0;
}
if($DayName=='Tue'){
$StartOnDay=1;
}
if($DayName=='Wen'){
$StartOnDay=2;
}
if($DayName=='Thu'){
$StartOnDay=3;
}
if($DayName=='Fri'){
$StartOnDay=4;
}
if($DayName=='Sat'){
$StartOnDay=5;
}
if($DayName=='Sun'){
$StartOnDay=6;
}
$StartDone = 'no';
echo "<table cellpadding='0' cellspacing='0' border='0' style='table-
layout:fixed;width:700px;border:1px solid black;'>";
echo "<tr style='height:25px;font-weight:bold;padding-top:4px;'><td><img
src='navigation_first.png' onmouseover='this.src=\"Navigation_over_First.png\";'
onmouseout='this.src=\"navigation_out_first.png\";'
onclick='java script:location.href=\"/stemaxime/calendar.php?
&Month=$LastMonth&Year=$LastYear\";' style='cursor:pointer;'> </td><td
colspan='3'>$MonthName</td><td colspan='3'>$Year</td><td><img src='navigation_last.png'
onmouseover='this.src=\"navigation_over_last.png\";'
onmouseout='this.src=\"navigation_out_last.png\";'
onclick='java script:location.href=\"/stemaxime/calendar.php?Month=$NextMonth&Year=$NextYear\";'
style='cursor:pointer;'></td></tr>";
echo "<tr><td style='border-bottom:1px solid black;'> </td><td style='border-bottom:1px
solid black;'>Man</td><td style='border-bottom:1px solid black;'>Tirs</td><td style='border-
bottom:1px solid black;'>Ons</td><td style='border-bottom:1px solid black;'>Tors</td><td
style='border-bottom:1px solid black;'>Fre</td><td style='border-bottom:1px solid
black;'>Lør</td><td style='border-bottom:1px solid black;'>Søn</td></tr>";
$Counter = 0;
for($i=1;$i<$DaysInMonth;$i++){
if($i==$DayToday){
$DayColor='SteelBlue';
$DayTextColor='white';}
else{
$DayColor='lightsteelblue';
$DayTextColor='black';
}
if($Counter==0){
$WeekNumber = date("W", mktime(0, 0, 0, $Month, $i, $Year));
echo "<tr style='height:50px;'><td style='border-right:1px solid
black;background-color:gray;color:white;cursor:normal;'>$WeekNumber</td>";
}
if($StartDone=='no'){
for($x=0;$x<$StartOnDay;$x++){
echo "<td style='border-right:1px solid black;border-bottom:1px solid
black;background-color:silver;'> </td>";
$Counter=$StartOnDay;
}
}
if($Counter<6){
echo "<td style='border-right:1px solid black;border-bottom:1px solid
black;background-color:$DayColor;color:$DayTextColor;cursor:pointer;'
onmouseover='this.style.backgroundColor=\"orange\";this.style.color=\"white\";'
onmouseout='this.style.backgroundColor=\"$DayColor\";this.style.color=\"$DayTextColor\";'
title='$i/$Month/$Year'>$i</td>";
}else{
echo "<td style='border-bottom:1px solid black;background-
color:$DayColor;color:$DayTextColor;cursor:pointer;'
onmouseover='this.style.backgroundColor=\"orange\";this.style.color=\"white\";'
onmouseout='this.style.backgroundColor=\"$DayColor\";this.style.color=\"$DayTextColor\";'
title='$Month/$i/$Year'>$i</td>";
}
if($Counter==6){
echo "</tr>";
$Counter=0;
}else{
$Counter++;
}
if($i==$ActualDaysInMonth){
if($Counter>0){
for($y=$Counter;$y<7;$y++){
echo "<td style='border-right:0px solid black;border-bottom:1px
solid black;background-color:silver;'> </td>";
}
}
}
$StartDone='yes';
}
echo "</table>";
?>
</body>
</html>
[/code]
På forhånd tak.
