<?php
/*
* Armin Randjbar-Daemi <www.omnistream.co.uk>
* armin.randjbar AT gmail.com
*
* GNU General Public License <opensource.org/licenses/gpl-license.html>
* Demo: http://www.omnistream.co.uk/calendar/
* last modified: march 2008 <ver 1.0>
*/
require_once ('Calendar.Class.php');
$Calendar = new Calendar();
//Check if the month and year values exist
if (isset($_GET['m'],$_GET['y'])) {
$month = intval($_GET['m']);
$year = intval($_GET['y']);
$Calendar->Calendar_OtherMonth($year,$month);
} else {
$gyear = date ('Y');
$gmonth = date ('n');
$gday = date ('j');
$ThisMonth = $Calendar->Calendar_ThisMonth($gyear,$gmonth,$gday);
$year = $ThisMonth[0];
$month = $ThisMonth[1];
}
//generate "next" and "prev" links
if ($month!='12') {
$next_month = "y=".$year;
$next_month .= "&m=";
$next_month .= $month+1;
} else {
$next_month = "y=";
$next_month .= $year+1;
$next_month .= "&m=1";
}
if ($month!='1') {
$prev_month = "y=".$year;
$prev_month .= "&m=";
$prev_month .= $month-1 ;
} else {
$prev_month = "y=";
$prev_month .= $year-1;
$prev_month .= "&m=12";
}
?>
<table style="width:350px;height:230px;" border="0" cellpadding="0" cellspacing="1" dir="rtl">
<tr onmouseover="hidetask();">
<td class="calendar-head">
<span>
<a href="<?php echo $_SERVER['PHP_SELF']."?".$prev_month; ?>">ÙØ¨ÙÛ</a>
</span>
</td>
<td colspan="5" class="calendar-head" style="width:248px;text-align:center;">
<span>
<?php echo $Calendar->shamsi_month_year; ?>
</span>
</td>
<td class="calendar-head">
<span>
<a href="<?php echo $_SERVER['PHP_SELF']."?".$next_month; ?>">بعدÛ</a>
</span>
</td>
</tr><tr>
<td class="calendar-head">
<span>Ø´ÙØ¨Ù</span>
</td>
<td class="calendar-head">
<span>ÙÙØ´ÙبÙ</span>
</td>
<td class="calendar-head">
<span>Ø¯ÙØ´ÙبÙ</span>
</td>
<td class="calendar-head">
<span>سÙâØ´ÙØ¨Ù</span>
</td>
<td class="calendar-head">
<span>ÚÙØ§Ø±Ø´ÙبÙ</span>
</td>
<td class="calendar-head">
<span>Ù¾ÙØ¬Ø´ÙبÙ</span>
</td>
<td class="calendar-head">
<span>جÙ
عÙ</span>
</td>
</tr>
<?php
if($Calendar->month_first_day == 6)
$startdate = -$Calendar->month_first_day + 6;
else
$startdate = -$Calendar->month_first_day - 1;
//Figure out how many rows we need.
$numrows = ceil (($Calendar->month_total_days + $Calendar->month_first_day + 1) / 7);
//Let's make an appropriate number of rows...
for ($k = 1; $k <= $numrows; $k++)
{
?><tr><?php
//Use 7 columns (for 7 days)...
for ($i = 0; $i < 7; $i++)
{
$startdate++;
$event = NULL;
$this_day = $year."-".$month."-".$startdate;
if ($EventsMatrix!=NULL && in_array($this_day,$EventsMatrix['day'],TRUE)) $event=" event";
if (($startdate <= 0) || ($startdate > $Calendar->month_total_days))
{
//If we have a blank day in the calendar.
?><td></td>
<?php
} elseif ($this_day == $Calendar->today) {
?><td class="calendar-today<?php echo $event; ?>"<?php if($event!=NULL) echo " onmouseover=\"checkfortasks('".$this_day."',event);\""; ?>><?php echo farsinum($startdate); ?></td><?php
} else {
?><td class="calendar-body<?php echo $event; ?>"<?php if($event!=NULL) echo " onmouseover=\"checkfortasks('".$this_day."',event);\""; ?>><?php echo farsinum($startdate); ?></td><?php
}
}
?></tr><?php
}
?>
</table>