<html>
<head>
<title>Calendar Demo </title>
<style type="text/css">
table tr td.other-months{
background-color:#bfbfbf;
text-align:center;
color:#333333;
}
table tr td.current_month{
color:#2b9f22;
text-align:center;
}
table tr td.reminder{
background-color:#ee2bf0;
color:#FFFFFF;
cursor:pointer;
}
table tr td.holiday{
background-color:#090da1;
color:#FFFFFF;
cursor:pointer;
}
</style>
</head>
<body>
<p id="title"></p>
<?php
include('class.calendar.php');
$month = isset($_GET['month'])?$_GET['month']: 01;
$year = isset($_GET['year'])?$_GET['year']:2000;
$cal= new calendar();
/*
Marked Dates should be in the format ("Y-m-d")
Type will be printed as the class and the tittle will be printed as the rel
*/
$marked = array(
'2011-06-01'=>array('title'=>'firstday','type'=>'reminder'),
'2011-06-05'=>array('title'=>'Normal day','type'=>'holiday'),
'2011-06-20'=>array('title'=>'Yester day','type'=>'reminder'),
'2011-06-21'=>array('title'=>'My day','type'=>'reminder'),
'2011-06-08'=>array('title'=>'fun day','type'=>'reminder'),
'2011-06-26'=>array('title'=>'hurrrrrray!!! a holiday','type'=>'holiday')
);
// Set marked dates Optional
$cal->setMarkedDates($marked);
// Set month and year to display Mandatory
$cal->setDate($month,$year);
// print current details
$cal->setcurrentDetails();
// Print calendar Table
try{
$cal->writeCalander();
}catch(Exception $ex){
echo $ex->getMessage();
}
?>
<hr />
<form action="" method="get">
<select name="month">
<?php
for($i=1;$i<=12; $i++){
if($i==$_GET['month']){
echo "<option selected='selected' value='$i'>{$cal->monthPrefix[$i-1]}</option>";
}else{
echo "<option value='$i'>{$cal->monthPrefix[$i-1]}</option>";
}
}
?>
</select>
<select name="year">
<?php
for($i=2000;$i<=2020; $i++){
if($i==$_GET['year']){
echo "<option selected='selected' value='$i'>$i</option>";
}else{
echo "<option value='$i'>$i</option>";
}
}
?>
</select>
<input type="submit" value="go" />
</form>
</body>
</html>
|