Hi every one
I am in webdeveloper.i created calendar using php.but did not work premonth function and nexmonth funtion for followind code and then how to create user event .user click the schedule date display schedule otherwise display no event message.
plz correct the following code.
urgent
<h1 class="title" style="float:left;">MyPlan</h1> 
</div>
<div id="unfinishedbussiness" >
<div style="float:left"></div>
<a href="<?php echo url_for("@make_note")?>">UnfinishedBussiness</a>
</div>
<div class="clear-both"></div>
<?php
$month = date('m', time());
$year = date('Y', time());
$calendar = getCalendar($month,$year);
function getCalendar($month,$year)
{
// Use the PHP time() function to find out the timestamp for the current time
$current_time = time();
// Get the first day of the month
$month_start = mktime(0,0,0,$month, 1, $year);
// Get the name of the month
$month_name = date('F', $month_start);
// Figure out which day of the week the month starts on.
$first_day = date('D', $month_start);
// Assign an offset to decide which number of day of the week the month starts on.
switch($first_day)
{
case "Sun":
$offset = 0;
break;
case "Mon":
$offset = 1;
break;
case "Tue":
$offset = 2;
break;
case "Wed":
$offset = 3;
break;
case "Thu":
$offset = 4;
break;
case "Fri":
$offset = 5;
break;
case "Sat":
$offset = 6;
break;
}
// determine how many days were in last month.
// Note: The cal_days_in_month() function returns the number of days in a month for the specified year and calendar.
if($month == 1)
$num_days_last = cal_days_in_month(CAL_GREGORIAN, 12, ($year -1));
else
$num_days_last = cal_days_in_month(CAL_GREGORIAN, ($month - 1), $year);
// determine how many days are in the this month.
$num_days_current = cal_days_in_month(CAL_GREGORIAN, $month, $year);
// Count through the days of the current month -- building an array
for($i = 0; $i < $num_days_current; $i++)
{
$num_days_array[] = $i+1;
}
// Count through the days of last month -- building an array
for($i = 0; $i < $num_days_last; $i++)
{
$num_days_last_array[] = '';
}
if($offset > 0){
$offset_correction = array_slice($num_days_last_array, -$offset, $offset);
$new_count = array_merge($offset_correction, $num_days_array);
$offset_count = count($offset_correction);
}
else
{
$new_count = $num_days_array;
}
// How many days do we now have?
$current_num = count($new_count);
// Our display is to be 35 cells so if we have less than that we need to dip into next month
if($current_num > 35)
{
$num_weeks = 6;
$outset = (42 - $current_num);
}
else if($current_num < 35)
{
$num_weeks = 5;
$outset = (35 - $current_num);
}
if($current_num == 35)
{
$num_weeks = 5;
$outset = 0;
}
// Outset Correction
for($i = 1; $i <= $outset; $i++)
{
$new_count[] = '';
}
// Now let's "chunk" the $new_count array
// into weeks. Each week has 7 days
// so we will array_chunk it into 7 days.
$weeks = array_chunk($new_count, 7);
// Start the output buffer so we can output our calendar nicely
ob_start();
$last_month = $month == 1 ? 12 : $month - 1;
$next_month = $month == 12 ? 1 : $month + 1;
// Build the heading portion of the calendar table
echo <<<EOS
<< Prev | $month_name $year | Next >> | ||||
S | M | T | W | T | F | S |
'.$day.' | '; else echo ''.$day.' | '; } echo '|||||
<?php echo @$calendar ?>
<?php echo date("d 'F 'y") ?>
<?php if($sf_user->hasFlash("notice_make_note")): ?>
" />
" />
" /><?php echo $sf_user->getFlash("notice_make_note") ?><?php echo $sf_user->setFlash("notice_make_note","") ?>
<?php endif?>
" method="post">
ADD NOTE
*Subject:
" />
<?php if (isset($error["subject"])) echo $error["subject"] ?>
*Date:
[DD]
<?php for ($i = 1; $i <= 31; $i++): ?>
<?php $display = $i < 10 ? "0" . $i : $i ?>
><?php echo $i ?>
<?php endfor; ?>
/
[MM]
<?php for ($i = 1; $i <= 12; $i++): ?>
<?php $display = $i < 10 ? "0" . $i : $i ?>
><?php echo $i ?>
<?php endfor; ?>
/
[YYYY]
<?php for ($i = date("Y"); $i < intval(date("Y"))+10; $i++): ?>
><?php echo $i ?>
<?php endfor; ?>
<?php if (isset($error["date"])) echo $error["date"] ?>
Time:
[Hour]
<?php for ($i=0;$i<24;$i++): ?>
<?php $display = $i < 10 ? "0" . $i : $i ?>
><?php echo $display ?>
<?php endfor ?>
:
[Minute]
<?php for ($i=0;$i<60;$i+=5): ?>
<?php $display = $i < 10 ? "0" . $i : $i ?>
><?php echo $display ?>
<?php endfor ?>
<?php if (isset($error["time"])) echo $error["time"] ?>
Place:
" />
Description:
<?php if (isset($note["description"])) echo $note["description"] ?>
[Clean Note]
" />