<?php
session_start();
include("../../connection.php");

echo '<?xml version="1.0" ?>';

/* Input to this file:

$_GET['year'];
$_GET['month'];
$_GET['day'];

*/

$startOfWeek = date("Y-m-d H:i:s",mktime(0,0,0,$_GET['month'],$_GET['day'],$_GET['year']));
$endOfWeek = date("Y-m-d H:i:s",strtotime($startOfWeek."+1 week"));

// You will typically make a db query like this:

$res = mysql_query("SELECT Calendar_Id,Description,StartDate,EndDate,Color from MINICLICK.CALENDAR where StartDate >= '$startOfWeek' and EndDate < '$endOfWeek' AND User_Id=".$_SESSION['user_id']."");
while($inf = mysql_fetch_array($res)){
	?>
	<item>
		<id><?php echo $inf["Calendar_Id"]; ?></id>
		<description><?php echo $inf["Description"]; ?></description>
		<eventStartDate><?php echo gmdate('D, d M Y H:i:s',strtotime($inf["StartDate"])) . ' GMT'; ?></eventStartDate>
		<eventEndDate><?php echo gmdate('D, d M Y H:i:s',strtotime($inf["EndDate"])) . ' GMT'; ?></eventEndDate>
		<bgColorCode><?php echo $inf["Color"]; ?></bgColorCode>
	</item>
	<?php
	
}
?>



