<?php include_once('loadme.php'); $year = date("Y"); $month = date("F"); $day = date("j"); $week_day = date("w"); $total_days = date("t"); $num_weeks = ceil($total_days / 7); $start_date = strtotime($month . ' 01 ' . $year . ' 00:00:00'); $end_date = strtotime($month . ' ' . $total_days . ' ' . $year . ' 23:59:59'); $cmonth_week_day = date("w", $start_date); $events = $db->execute("select * from events where `sctive`='y' and `date` >= '" . $start_date . "' and `date` <= '" . $end_date . "' order by `date` desc"); foreach ($events as $n => $v) { $days[date('j', $v['Date'])] = $v; } ?> <table width="170" height="140" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td height="25" align="center" valign="middle" bgcolor="#e0e0e0" class="calendar_title"><strong><?php echo $month . " " . $year; ?></strong></td> </tr> <tr valign="top"> <td bgcolor="#f0f0f0"><table width="100%" height="115" border="0" cellpadding="1" cellspacing="2"> <tr valign="middle" align="center"> <td>Su</td> <td>Mo</td> <td>Tu</td> <td>We</td> <td>Th</td> <td>Fr</td> <td>Sa</td> </tr> <tr valign="middle" align="center"> <?php if ($cmonth_week_day > 0) { ?> <td colspan="<?php echo $cmonth_week_day; ?>"> </td> <?php } for ($i = 1; $i != $total_days + 1; $i++) { $this_weekday = date("w", strtotime($month . " " . $i . " " . $year)); if ($this_weekday == 0 && $cmonth_week_day > 0) { ?> <tr valign="middle" align="center"> <?php } ?> <td<?php if ($i == $day) echo ' style="font-weight: bold; border: 1px solid #000066"'; ?>><?php if (isset($days[$i])) { echo '<a href="javascript:eventInfo(' . strtotime($month . " " . $i . " " . $year . " 00:00:00") . ');" class="calendar_link">' . $i . '</a>'; } else { echo $i; } ?></td> <?php if ($this_weekday == 6) { ?> </tr> <?php } } ?> </table></td> </tr> </table>