<?
require "functions.inc";
$month = $_POST["nmonth"];
$year = $_POST["nyear"];
if(!$month && !$year)
{
$month = date("n");
$year = date("Y");
$j = "j";
}
if(!$j)
{
$j = "x";
}
if(!$b)
{
$b = "x";
}
if(!$a)
{
$a = "x";
}
if($month < 10 && substr($month,0,1) != 0)
{
$month = "0".$month;
}
$daysLeft = numberOfDays($month,$year);
$xday = 1;
$bump = setBump($month,$year);
echo "<html>";
echo "<head>";
echo "<title></title>";
echo "<link rel='stylesheet' href='main.css' type='text/css' />";
echo "<link rel='stylesheet' href='calendar.css' type='text/css' />";
echo "<script type='text/javascript'>";
echo "<!--\n";
echo "function update(m,y,nm,ny)";
echo "{";
echo " m.value = nm;";
echo " y.value = ny;";
echo " document.forms[0].submit();";
echo "}\n";
echo "-->";
echo "</script>";
echo "</head>";
echo "<body>";
echo "<form action='index.php' method='post'>";
echo "<input type='hidden' name='nmonth' value='".$month."' />";
echo "<input type='hidden' name='nyear' value='".$year."' />";
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
if ($show) {
echo "<tr valign='top'>";
echo "<td class='text'><select name='month' class='pulldown'>";
for($i=1;$i<13;$i++)
{
if(date("n") == $i)
{
echo "<option value='".$i."' selected>".getMonth($i)."</option>";
}
else
{
echo "<option value='".$i."'>".getMonth($i)."</option>";
}
}
echo "</select>";
echo "<br /><br />";
echo "<select name='year' class='pulldown'>";
$currentYear=date("Y");
$nextYear=$currentYear+1;
echo "<option selected value='".$currentYear."'>".$currentYear."</option>";
echo "<option value='".$nextYear."'>".$nextYear."</option>";
echo "</select>";
echo "<br /><br />";
echo "<input type='checkbox' name='j' value='j'";
if($j == "j")
{
echo " checked";
}
echo "/>journal entries";
echo "<br />";
echo "<input type='checkbox' name='b' value='b'";
if($b == "b")
{
echo " checked";
}
echo "/>birthdays";
echo "<br />";
echo "<input type='checkbox' name='a' value='a'";
if($a == "a")
{
echo " checked";
}
echo "/>anniversaries";
echo "<br />";
echo "<input type='checkbox' name='h' value='h'";
if($h)
{
echo " checked";
}
echo " />holidays";
echo "<br />";
echo "<br />";
echo "<a href='#' onclick='submit();' class='cal'>update list</a>";
echo "<br />";
echo "<a href='#' class='cal' onclick=\"window.open('dtl.php?t=m&y=".$year."&m=".$month."', 'p_table', 'fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width=375,height=500,left=10,top=10');\">read the whole month</a>";
echo "<br />";
echo "<br />";
echo "<input type='button' value='show' onclick='update(nmonth,nyear,month.value,year.value);' />";
echo "<br />";
echo "<br />";
echo "<b><u>key</u></b>";
echo "<br />";
echo "journal entries<br />";
echo "<div class='birthday'>birthdays</div>";
echo "<div class='anniversary'>anniversaries</div>";
echo "<div class='holiday'>holidays</div>";
echo "<img src='../template/clear_dot.gif' width='120' height='1' border='0' alt='' />";
echo "</td>";
}
echo "<td cellpadding=\"0\" cellspacing=\"0\" valign=\"middle\" class='text'>";
if ($show) { $modified_url = str_replace("?show=1","",$REQUEST_URI); echo "<a href=\"".$modified_url."\"><img src=\"hide.jpg\" border=\"0\"></a>"; }
else { echo "<a href=\"".$REQUEST_URI."?show=1\"><img src=\"show.jpg\" border=\"0\"></a>"; }
echo "</td>";
echo "<td class='text'>";
echo "<table border='1' cellpadding='0' cellspacing='0'>";
echo "<tr valign='center'>";
echo "<td colspan='7'>";
echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
echo "<tr>";
echo "<td>";
if($year==2002&&$month==7)
{
echo " ";
}
else
{
echo " « <a href='#' class='cal' onclick='update(nmonth,nyear,";
if($month==1)
{
echo "12,".($year-1);
}
else
{
echo ($month-1).",".$year;
}
echo ");'>previous month</a>";
}
echo "</td>";
echo "<td align='center' class='month'>".getMonth($month)." - ".$year."</td>";
echo "<td align='right'>";
echo "<a href='#' class='cal' onclick='update(nmonth,nyear,";
if($month == 12)
{
echo "1,".($year + 1);
}
else
{
echo ($month + 1).",".$year;
}
echo ");'>next month</a> » ";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "<tr valign='top'>";
for($k=0;$k<7;$k++){
echo "<td class='week'>".$day[$k]."</td>";
}
echo "</tr>";
$thisDay = date("j");
$thisYear = date("Y");
$thisMonth = date("n");
$done = "false";
while($daysLeft>0){
echo "<tr valign='top'>";
for($l=0;$l<7;$l++)
{
if($bump>0)
{
echo "<td> </td>";
$bump--;
}
else
{
if($daysLeft>0)
{
if($thisDay == $xday && $year == $thisYear && $month == $thisMonth)
{
echo "<td class='today'>".$xday."<br />";
}
else
{
echo "<td class='days'>".$xday."<br />";
}
print_todays_stuff($month,$xday,$year,$j,$b,$a);
if($h)
{
$te = getDaysEvents($month,$xday,$year);
for($i=0;$i<count($te);$i++)
{
echo "<div class='holiday'>".$te[$i]."</div>";
}
echo "</td>";
}
$daysLeft--;
$xday++;
}
else
{
echo "<td> </td>";
}
}
}
echo "</tr>";
}
echo "</table>";
echo "<img src='../template/clear_dot.gif' width='606' height='1' border='0' alt='' />";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</form>";
echo "</body>";
echo "</html>";
?>