Location: PHPKode > projects > eCanteen > ecanteen/user/usercalendar-sdates3.php
<? 
//Copyright David Byrne 2007

//This file is part of eCanteen.

//    eCanteen is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.

//    eCanteen is distributed in the hope that it will be useful
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.

//    You should have received a copy of the GNU General Public License
//    along with eCanteen.  If not, see <http://www.gnu.org/licenses/>.
//*******************************************************
//*     ASP 101 Sample Code - http://www.asp101.com/    *
//*                                                     *
//*   This code is made available as a service to our   *
//*      visitors and is provided strictly for the      *
//*               purpose of illustration.              *
//*                                                     *
//*      http://www.asp101.com/samples/license.asp      *
//*                                                     *
//* Please direct all inquiries to hide@address.com *
//*******************************************************
//PrintOrderMenuLink($dateD,$minorID,$breakid,$Break,$minorName)
//{
//print "<a href=\"QuikMenu.php?date=".$dateD."&minor=".$minorID."&BreakID=".$breakid."&Break=".$Break."&minorname=".$minorName."\">".$Break." Order </a><BR/>";
//}

//CustID,TransactionID,BreakID,dDate,Itemstr,BreakName,MinorName
include("../include/constants.php");
session_start();
$objConnection1 = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
mysql_select_db(DB_NAME) or die( "Unable to select database");


$sqlstmt="SELECT minorcustomer.`CustomerID`, minorcustomer.`MajorCustomerExtract$` FROM minorcustomer WHERE (((minorcustomer.`CustomerID`)=".$_GET["minor"]."));";

$CheckMajor=mysql_query($sqlstmt);


if (mysql_result($CheckMajor,0,"MajorCustomerExtract$")==$_SESSION['CustomerID'])
{
  $sql="SELECT `SiteID`, `Site`, `Site Number`, `WelcomeMessage`,`WebMasterContact`, `WebMasterEmail`, `AdminContact`, `AdminEmail`, `Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday` FROM `siteid` WHERE (((`SiteID`)=".$_SESSION['SiteID']."));";
  $rs=mysql_query($sql);

  $nondaysString="";	
  if (mysql_result($rs,0,"Sunday")!=True)
  {
    $nondaysString=$nondaysString."1,";	
  }
if (mysql_result($rs,0,"Monday")!=True)
{
 $nondaysString=$nondaysString."2,";	
}
if (mysql_result($rs,0,"Tuesday")!=True)
{
 $nondaysString=$nondaysString."3,";	
}
if (mysql_result($rs,0,"Wednesday")!=True)
{
 $nondaysString=$nondaysString."4,";	
}
if (mysql_result($rs,0,"Thursday")!=True)
{
 $nondaysString=$nondaysString."5,";	
}
if (mysql_result($rs,0,"Friday")!=True)
{
 $nondaysString=$nondaysString."6,";	
}
if (mysql_result($rs,0,"Saturday")!=True)
{
 $nondaysString=$nondaysString."7,";	
}

$nondaysString=substr($nondaysString, 0, strlen($nondaysString)-1); 





$file_name="usercalendar-sdates3.php";
//HTML print functions
function PrintDelModButtons($minorID,$TransactionID,$breakid,$dateD,$ItemStr,$breakshortname,$minorName)
{

          print "<button id=\"DelClick-".$TransactionID."\" name=\"delorders\" alt=\"Delete Order\" onclick=\"DelOrders(".$minorID.",".$TransactionID.",".$breakid.",'".$dateD."','".$ItemStr."',1,'".$breakshortname."','".$minorName."')\">".$breakshortname."-</button>";
                              print "<button id=\"DelClick-".$TransactionID."\" name=\"delorders\" alt=\"Delete Order\" onclick=\"DelOrders(".$minorID.",".$TransactionID.",".$breakid.",'".$dateD."','".$ItemStr."',2,'".$breakshortname."','".$minorName."')\">".$breakshortname."*</button>";
}

function PrintBreakOrderSelect($itemstr)

{
				$CostTotal=0;
       	$OrderArray=explode("*",$itemstr);
				
				print "<select name=\"test\" size=\"3\" style=\"width:130\" >";

        for ($x=0; $x<=count($OrderArray); $x=$x+1)
        {
					
          $LineArray=explode("/",$OrderArray[$x]);
          print "<option value=".$LineArray[1].">".$LineArray[0]."</option>";
			

        }
        print "</select><br/>";

}






//End HTML printing functions



function GetDaysInMonth($iMonth,$iYear)
{
  $function_ret = date('t',mktime(0,0,0,$iMonth,1,$iYear)); // This is to calculate number of days in a month
  return $function_ret;
} 

function SubtractOneMonth($iMonth,$iYear)
{
     $function_ret = date('n', mktime(0,0,0,($iMonth-1),28,$iYear));
		 if ($function_ret<10)
		 {
		   $function_ret="0".$function_ret;
		 }

  
  return $function_ret;
} 

function leftcheckyear($iMonth,$iYear)

{
if ($iMonth=="1")
{
	$function_ret = intval($iYear-1);
}else{ 
  $function_ret = $iYear;  
}
return $function_ret;
}

function rightcheckyear($iMonth,$iYear)

{
if ($iMonth=="12")
{
	$function_ret = intval($iYear+1);
}else{ 
  $function_ret = $iYear;  
}
return $function_ret;
}






function GetWeekdayMonthStartsOn($iMonth,$iYear)
{

    $function_ret= date('w',mktime(0,0,0,$iMonth,1,$iYear)); // This will calculate the week day of the first day of the month
  
  return $function_ret;
} 

function AddOneMonth($iMonth,$iYear)
{
   $function_ret = date('n', mktime(0,0,0,($iMonth+1),28,$iYear));         // NEXT month of year (1-12)
  if ($function_ret<10)
		 {
		   $function_ret="0".$function_ret;
		 }
  
  return $function_ret;
} 

// ***End Function Declaration***




// Get selected date.  There are two ways to do this.
// First check if we were passed a full date in RQS("date").
// If so use it, if not look for seperate variables, putting them togeter into a date.
// Lastly check if the date is valid...if not use today

$iMonth=date('n',time());
$iDay=date('d',time());
$iYear=date('Y',time());

 if($_GET['date'] != "")
 {
    list($iYear,$iMonth,$iDay)=explode("-",$_GET["date"]);
    if (checkdate($iMonth,$iDay,$iYear))
    {
        //not much
    }else{
		        
    }           
 }elseif ($_GET["day"] != ""){
     $iMonth=$_GET["month"];        
     $iDay=$_GET["day"];  
     $iYear=$_GET["year"];    
 }else{
         
 } 
 
//Sunday=1,Monday=2,Tuesday=3,Wednesday=4,Thursday=5,Friday=6,Saturday=7

 
$nondays = explode(",", $nondaysString);



 
  
//Now we've got the date.  Now get Days in the choosen month and the day of the week it starts on.
$iDIM=GetDaysInMonth($iMonth,$iYear);
$iDOW=GetWeekdayMonthStartsOn($iMonth,$iYear)+1;
$datestr=$iYear."-".$iMonth."-".$iDay;
$FromDateStr=$iYear."-".$iMonth."-01";
$ToDateStr=$iYear."-".$iMonth."-".$iDIM;


?>
<script language="javascript" type="text/javascript">

function disableAllFormControls() {
 for (var i=0; i<document.forms.length; i++) {
  for (var j=0; j<document.forms[i].elements.length; j++) {
    document.forms[i].elements[j].disabled=true;
  }
 }
}




function DelOrders(CustID,TransactionID,BreakID,dDate,Itemstr,elSource,BreakName,MinorName)
{



var decision=confirm(TransactionID+" - delete this Order?");


//window.alert(answer);
if (decision==true)
{
	disableAllFormControls()
	document.getElementById('DelClick-'+TransactionID).disabled=true;
	window.open('DelOrders.php?CustID='+CustID+'&BreakID='+BreakID+'&dDate='+dDate+'&TransactionID='+TransactionID+'&elSource='+elSource+'&Itemstr='+Itemstr+'&MinorName='+MinorName+'&BreakName='+BreakName);
	//,'CP','width=1,height=1,menubar=no');
    if (elSource==1)
    {        	
	    //window.location.href = unescape(window.location.href);
	}else{
	    			//window.location.href='QuikMenu.php?date='+dDate+'&minor='+CustID+'&BreakID='+BreakID+'&Itemstr='+Itemstr+'&Break='+BreakName+'&minorname='+MinorName
	}
	//var xtest=displayIncidents(SCHEDID,0);
	//,'CP','width=1,height=1,menubar=no'
}else{
}


}

</script>
<?

//session_start();
//$objConnection1 = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
//mysql_select_db(DB_NAME) or die( "Unable to select database");


$sqlstmt="SELECT break.`BreakShortName`, break.`SortOrder`, Transactions.`TransactionID`, Transactions.`TargetDate`, Transactions.`WithdrawalAmount`, transactions.`TransactionDescription`, transactions.`minorAccountID`, break.`BreakID`, break.`break`, break.`BreakShortName`, break.`OrderCloseTime`, break.`~SiteID$`, transactions.`TransactionNumber` FROM transactions RIGHT JOIN Break ON transactions.`BreakID` = break.`BreakID` WHERE (((transactions.`TargetDate`)>='".$FromDateStr."' And (transactions.`TargetDate`)<='".$ToDateStr."') AND ((transactions.`minorAccountID`)=".$_GET["minor"].") AND ((break.`~SiteID$`)=".$_SESSION['SiteID'].") AND ((transactions.`TransactionNumber`)=1)) ORDER BY break.`SortOrder`;";   
//echo $sqlstmt   ;
//echo "<br>";

$objRecordset1=mysql_query($sqlstmt);

$objRecordset1num=mysql_numrows($objRecordset1);
  

for ($ux=0; $ux<=31; $ux=$ux+1)
{
  for ($uy=0; $uy<=5; $uy=$uy+1)
  {
    $userOrders[$ux][2][$uy]=0;
  }
}

$OrdersFound=false;

$i=0;

if (!($objRecordset1num==0))
{

  $OrdersFound=true;
  while ($i < $objRecordset1num) 
  {
    $TargetDate=mysql_result($objRecordset1,$i,"TargetDate");
		$breakid=mysql_result($objRecordset1,$i,"BreakID");
		$TransactionDescription=mysql_result($objRecordset1,$i,"TransactionDescription");
		$TransactionID=mysql_result($objRecordset1,$i,"TransactionID");
		$SortOrder=mysql_result($objRecordset1,$i,"SortOrder");
		list($TargetDateD,$TargetDateT)=explode(" ",$TargetDate);
		list($TYear,$TMonth,$TDay)=explode("-",$TargetDateD);
		if ($TDay<10 && strlen($TDay)==2)
		{
			$TDay=substr($TDay, -1); 
		}
    $userOrders[$TDay][0][$SortOrder]=$breakid;
    $userOrders[$TDay][1][$SortOrder]=$TransactionDescription;
    $userOrders[$TDay][2][$SortOrder]=$TransactionID;

		$i++;
  } 
} 

mysql_connect(DB_SERVER,DB_USER,DB_PASS);
mysql_select_db(DB_NAME) or die( "Unable to select database");

$sqlstmt="SELECT break.`BreakID`,break.`break`,break.`BreakShortName`,break.`SortOrder`,break.`OrderCloseTime`,break.`Minutes`,break.`~SiteID$` FROM break WHERE (((break.`SortOrder`)>0) AND ((break.`~SiteID$`)=".$_SESSION['SiteID'].")) ORDER BY break.`SortOrder`;";

//echo $sqlstmt;

$SiteBreaks=mysql_query($sqlstmt);

$SiteBreaksnum=mysql_numrows($SiteBreaks);

$query="SELECT specialdate.`specialdateID`,specialdate.`specialdateDescr`,specialdate.`specialdateFrom`,specialdate.`specialdateTo`,specialdate.`Active_L2`,specialdate.`~SiteID$` FROM specialdate WHERE (((specialdate.`specialdateFrom`)>='".$FromDateStr."' And (specialdate.`specialdateFrom`)<='".$ToDateStr."') AND ((specialdate.`~SiteID$`)=".$_SESSION['SiteID'].")) OR (((specialdate.`specialdateTo`)>='".$FromDateStr."' And (specialdate.`specialdateTo`)<='".$ToDateStr."') AND ((specialdate.`~SiteID$`)=".$_SESSION['SiteID'].")) ORDER BY specialdate.`specialdateDescr`;";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

//include('top1.php');

?>

<!-- Outer Table is simply to get the pretty border-->
<TABLE BORDER=10  width="98%" height="85%" CELLSPACING=0 CELLPADDING=0>
		<TR>
			<TD>
				<TABLE width="100%" height="100%" BORDER=1 CELLSPACING=0 CELLPADDING=1 BGCOLOR=#99CCFF>
	<TR>
		<TD BGCOLOR=#000099 ALIGN="center" COLSPAN=7>
			<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
				<TR>
					<TD ALIGN="right"><A HREF=<? echo $file_name?>?date=<? echo leftcheckyear($iMonth,$iYear)."-".SubtractOneMonth($iMonth,$iYear)."-".$iDay."&minor=".$_GET["minor"]."&minorname=".urlencode($_GET["minorname"]);?>><FONT COLOR=#FFFF00 SIZE="-1">&lt;&lt;</FONT></A></TD>
					<TD ALIGN="center"><FONT COLOR=#FFFF00><B><? echo $_GET["minorname"]." ".date('F',mktime(0,0,0,$iMonth,1,$iYear))." ".$iYear;?></B></FONT> <button id="Return2Cal" onclick="window.location.href='../index.php';return true;" style="width: 190px">Return to Main Menu</button></TD>
					<TD ALIGN="left"><A HREF=<? echo $file_name?>?date=<? echo rightcheckyear($iMonth,$iYear) ."-".AddOneMonth($iMonth,$iYear)."-".$iDay."&minor=".$_GET["minor"]."&minorname=".urlencode($_GET["minorname"]);?>><FONT COLOR=#FFFF00 SIZE="-1">&gt;&gt;</FONT></A></TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD ALIGN="center" BGCOLOR=#0000CC><FONT COLOR=#FFFF00><B>Sun</B></FONT><BR><IMG SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0></TD>
		<TD ALIGN="center" BGCOLOR=#0000CC><FONT COLOR=#FFFF00><B>Mon</B></FONT><BR><IMG SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0></TD>
		<TD ALIGN="center" BGCOLOR=#0000CC><FONT COLOR=#FFFF00><B>Tue</B></FONT><BR><IMG SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0></TD>
		<TD ALIGN="center" BGCOLOR=#0000CC><FONT COLOR=#FFFF00><B>Wed</B></FONT><BR><IMG SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0></TD>
		<TD ALIGN="center" BGCOLOR=#0000CC><FONT COLOR=#FFFF00><B>Thu</B></FONT><BR><IMG SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0></TD>
		<TD ALIGN="center" BGCOLOR=#0000CC><FONT COLOR=#FFFF00><B>Fri</B></FONT><BR><IMG SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0></TD>
		<TD ALIGN="center" BGCOLOR=#0000CC><FONT COLOR=#FFFF00><B>Sat</B></FONT><BR><IMG SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0></TD>
	</TR>
<?
// Write spacer cells at beginning of first row if month doesn't start on a Sunday.
if ($iDOW!=1)
{

  print "\t"."<TR>"."\r\n";
  $iPosition=1;
  while($iPosition<$iDOW)
  {

    print "\t"."\t"."<TD>&nbsp;</TD>"."\r\n";
    $iPosition=$iPosition+1;
  } 
} 


// Write days of month in proper day slots
$iCurrent=1;
$iPosition=$iDOW;

while($iCurrent<=$iDIM)


	{
	$ArrayiCurrent=$iCurrent;
	if ($iMonth<10 && strlen($iMonth)==1 )
		{
			$iMonth="0".$iMonth;
		}
	if ($iCurrent<10 && strlen($iCurrent)==1)
		{
			$iCurrent="0".$iCurrent;
		}


// If we're at the beginning of a row then write TR
  if ($iPosition==1)
  {

    print "\t"."<TR>"."\r\n";
  } 


// If the day we're writing is the selected day then highlight it somehow.
  $specialdateStr="";
  $DateActive=true;
	$i=0;
	$thisdate=$iYear."-".$iMonth."-".$iCurrent;
	while ($i < $num) {
		$Active_L2=mysql_result($result,$i,"Active_L2");
		$specialdateFrom=mysql_result($result,$i,"specialdateFrom");
		$specialdateTo=mysql_result($result,$i,"specialdateTo");
		$specialdateDescr=mysql_result($result,$i,"specialdateDescr");
		list($Fromdate,$FromTime)=explode(" ",$specialdateFrom);
		list($Todate,$ToTime)=explode(" ",$specialdateTo);
		if ($thisdate>=$Fromdate && $thisdate<=$Todate)
    {
        $specialdateStr=$specialdateStr."<br>".$specialdateDescr;
        $DateActive=$Active_L2;
    } 
		$i++;
	}
	//if Sunday or Saturday or inactive day for canteen, then print day only
	if (in_array($iPosition, $nondays) || $DateActive==false) 
	
	//if ($iPosition==7 || $iPosition==1 || $iPosition==2 || $DateActive==false)
  {
  	if ($iCurrent==$iDay)
 		 {
   		 print "\t"."\t"."<TD align=\"center\" valign=\"top\" BGCOLOR=#00FFFF width=\"4%\"  height=\"15%\"><FONT SIZE=\"-1\"><B>".$iCurrent."</B></FONT><br>".$specialdateStr."</td>"."\r\n";
 		 }
  	  else
 		 {
      //$iMonth,$iYear
				print "\t"."\t"."<TD align=\"center\" valign=\"top\" width=\"4%\"  height=\"15%\"><A HREF=\"./".$file_name."?date=".$iYear ."-".$iMonth."-".$iCurrent."&minor=".$_GET["minor"]."&minorname=".$_GET["minorname"]."\"><FONT SIZE=\"-1\">".$iCurrent."</FONT></A><br>".$specialdateStr."</td>";
    
  		} 
	}else{
		if ($iCurrent==$iDay)
  		{
   		 print "\t"."\t"."<TD align=\"center\" valign=\"top\" BGCOLOR=#00FFFF width=\"4%\"  height=\"15%\"><FONT SIZE=\"-1\"><B>".$iCurrent."</B></FONT><br>";

  		}
   		else
  		{
      //$iMonth,$iYear
				print "\t"."\t"."<TD align=\"center\" valign=\"top\" width=\"4%\"  height=\"15%\"><A HREF=\"./".$file_name."?date=".$iYear ."-".$iMonth."-".$iCurrent."&minor=".$_GET["minor"]."&minorname=".$_GET["minorname"]."\"><FONT SIZE=\"-1\">".$iCurrent."</FONT></A><br>";
    
  		}
		$i=0;
			while ($i < $SiteBreaksnum) 
				{
					$breakid=mysql_result($SiteBreaks,$i,"BreakID");
					$break=mysql_result($SiteBreaks,$i,"Break");
					$sortorder=mysql_result($SiteBreaks,$i,"SortOrder");
					$breakshortname=mysql_result($SiteBreaks,$i,"BreakShortName");
					$orderclosetime=mysql_result($SiteBreaks,$i,"OrderCloseTime");
					list($CloseDate,$CloseTime)=explode(" ",$orderclosetime);
					//if ($userOrders[$iCurrent][2][("SortOrder")]>0)
					if ($userOrders[$ArrayiCurrent][2][$sortorder]>0)
					{
					
      			print $breakshortname.":".$userOrders[$ArrayiCurrent][2][$sortorder];
						//CustID,TransactionID,BreakID,dDate,Itemstr,BreakName,MinorName
						if ($ArrayiCurrent>date("j") && $iMonth==date("m"))
							{
								PrintDelModButtons($_GET["minor"],$userOrders[$ArrayiCurrent][2][$sortorder],$breakid,$iYear."-".$iMonth."-".$iCurrent,$userOrders[$ArrayiCurrent][1][$sortorder],$breakshortname,$_GET["minorname"]);
							
										
							}else if ($iMonth>date("m")){
			PrintDelModButtons($_GET["minor"],$userOrders[$ArrayiCurrent][2][$sortorder],$breakid,$iYear."-".$iMonth."-".$iCurrent,$userOrders[$ArrayiCurrent][1][$sortorder],$breakshortname,$_GET["minorname"]);			
							}
							else if ($ArrayiCurrent==date("j") && time()<=strtotime($CloseTime) && $iMonth==date("m"))
							{
							PrintDelModButtons($_GET["minor"],$userOrders[$ArrayiCurrent][2][$sortorder],$breakid,$iYear."-".$iMonth."-".$iCurrent,$userOrders[$ArrayiCurrent][1][$sortorder],$breakshortname,$_GET["minorname"]);
							
							}
							print "<BR/>";	
							//print $userOrders[$ArrayiCurrent][1][$sortorder];	
							
							//print "<BR/>";
							//print $ArrayiCurrent." ".$sortorder;
							PrintBreakOrderSelect($userOrders[$ArrayiCurrent][1][$sortorder]);	
							print "<BR/>";	
					}else{
							list($CloseDate,$CloseTime)=explode(" ",$orderclosetime);
							if ($ArrayiCurrent>date("j") && $iMonth==date("m"))
							{
							print "<a href=\"QuikMenu.php?date=".$iYear."-".$iMonth."-".$iCurrent."&minor=".$_GET["minor"]."&BreakID=".$breakid."&Break=".$break."&minorname=".$_GET["minorname"]."\">".$break." Order </a><BR/>";
							}else if ($iMonth>date("m")){
									print "<a href=\"QuikMenu.php?date=".$iYear."-".$iMonth."-".$iCurrent."&minor=".$_GET["minor"]."&BreakID=".$breakid."&Break=".$break."&minorname=".$_GET["minorname"]."\">".$break." Order </a><BR/>";			
							}else if ($iYear>date("Y")){
									print "<a href=\"QuikMenu.php?date=".$iYear."-".$iMonth."-".$iCurrent."&minor=".$_GET["minor"]."&BreakID=".$breakid."&Break=".$break."&minorname=".$_GET["minorname"]."\">".$break." Order </a><BR/>";			
							}
							else if ($ArrayiCurrent==date("j") && time()<=strtotime($CloseTime) && $iMonth==date("m"))
							{
							print "<a href=\"QuikMenu.php?date=".$iYear."-".$iMonth."-".$iCurrent."&minor=".$_GET["minor"]."&BreakID=".$breakid."&Break=".$break."&minorname=".$_GET["minorname"]."\">".$break." Order </a><BR/>";
							}
     					//PrintOrderMenuLink($iYear."-".iMonth."-".$iCurrent,$_GET["minor"],$breakid,$break,$_GET["minorname"]);
							print "<BR/>";
					}
					$i++;
				}
				print $specialdateStr."</td>"."\r\n";

	}
// If we're at the endof a row then write /TR
  if ($iPosition==7)
  {

    print "\t"."</TR>"."\r\n";
    $iPosition=0;
  } 


// Increment variables
  $iCurrent=$iCurrent+1;
  $iPosition=$iPosition+1;
} 

// Write spacer cells at end of last row if month doesn't end on a Saturday.
if ($iPosition!=1)
{

  while($iPosition<=7)
  {

    print "\t"."\t"."<TD>&nbsp;</TD>"."\r\n";
    $iPosition=$iPosition+1;
  } 
  print "\t"."</TR>"."\r\n";
} 

?>
</TABLE>
</TD>
</TR>
</TABLE>

<BR>

<table border=0 cellspacing=0 cellpadding=0>
		<tr>
			<td align="center">
				<form action=<? echo $file_name;?> method="get" id="usercalendar">
				<input type="hidden" name="minor" value="<? echo $_GET["minor"];?>" />
					<table border="1" cellpadding="0" cellspacing="2" width="188">
						<tr>
<td>
<select name="month">
<? 

$c_month[1]="January";
$c_month[2]="February";
$c_month[3]="March";
$c_month[4]="April";
$c_month[5]="May";
$c_month[6]="June";
$c_month[7]="July";
$c_month[8]="August";
$c_month[9]="September";
$c_month[10]="October";
$c_month[11]="November";
$c_month[12]="December";

for ($zz=1; $zz<=12; $zz=$zz+1)
{
?>
<option value=<?   echo $zz;?><?   if (strftime("%m",time())==$zz)
  {
    print " selected";
  } ?>><?   echo $c_month[$zz];?></option><? 

}
//zz
?>
</select></td>
<td><select name="day">
<? 
for ($c_day=1; $c_day<=31; $c_day=$c_day+1)
{
?>
<option value=<?   echo $c_day;?><?   if ($Day[time()]==$c_day)
  {
    print " selected";
  } ?>><?   echo $c_day;?></option><? 

}
//c_day
?>
</select></td>
<td><select name="year">
<? 
for ($c_year=strftime("%Y",time())-2; $c_year<=strftime("%Y",time())+2; $c_year=$c_year+1)
{
?>
<option value=<?   echo $c_year;?><?   if (strftime("%Y",time())==$c_year)
  {
    print " selected";
  } ?>><?   echo $c_year;?></option><? 

}
//c_year

?>
								</select></td>
							<td><input type="submit" value="Goto Date"></td>
						</tr>
						<tr><td><input name="minor" value=<?echo urlencode($_GET["minor"])?> type="hidden"/>
						<input name="minorname" value="<?echo urldecode($_GET["minorname"])?>" type="hidden"/></td></tr>
					</table>
				</form>
			</td>
		</tr>
	</table>
<?
}
?>

Return current item: eCanteen