hi there! want to incorporate a recuring schedule into the PHP calendar below. eg highlight every other weekend, every third Tuesday, every Monday, etc…
on the user side (when they set-up) I’d like to present them with a sample week, Sun thru Sat. then within each day they could specify “every, every other, every third, every fourth”, along with a “beginning when” for each. that should be enough info to pull this off right? surely this has been done before, and don’t want to reinvent the wheel. just asking for a reality check, and to be pointed in the right direction here.
off to my son’s “poetry slam” now, so many thanks in advance!
// gather info to draw calendar
$todays_date = date(“j”);
$todays_month = date(“n”);
$days_in_month = date (“t”, mktime(0,0,0,$_GET[‘month’],0,$_GET[‘year’]));
$first_day_of_month = date (“w”, mktime(0,0,0,$_GET[‘month’]-1,1,$_GET[‘year’]));
$first_day_of_month = $first_day_of_month + 1;
$count_boxes = 0;
$days_so_far = 0;
// fill before-month void of calendar
for ($i = 1; $i <= $first_day_of_month-1; $i++)
{
$days_so_far = $days_so_far + 1;
$count_boxes = $count_boxes + 1;
echo "<td width=\“100\” height=\“100\” class=\“beforedayboxes\”></td>
";
}
// process all active days of the month
for ($i = 1; $i <= $days_in_month; $i++)
{
$days_so_far = $days_so_far + 1;
$count_boxes = $count_boxes + 1;
// this bit checks to see if current box is today’s date,
// if so, it gets highlighted
IF ($_GET[‘month’] == $todays_month+1)
{
IF($i == $todays_date)
{$class = “highlighteddayboxes”;}
ELSE
{$class = “dayboxes”;}
}
ELSE
{
IF($i == 1)
{$class = “highlighteddayboxes”;}
ELSE
{$class = “dayboxes”;}
}
$link_month = $_GET['month'] - 1;
// write start of box
HERE I CHECK THE SCHEDULE AND HIGHLIGHT IN ACCORD *
// write end of box
echo "</td>
";
// after 7 boxes start a new row
IF(($count_boxes == 7) AND ($days_so_far != (($first_day_of_month-1) + $days_in_month)))
{
$count_boxes = 0;
echo "</TR><TR valign=\“top\”>
";
}
}
// fill after-month void of calendar
$extra_boxes = 7 - $count_boxes;
for ($i = 1; $i <= $extra_boxes; $i++)
{
echo "<td width=\“100\” height=\“100\” class=\“afterdayboxes\”></td>
";
}
?>
THANKS AGAIN !!