';
/* table headings */
$headings = array('Sun','Mon','Tues','Wed','Thurs','Fri','Sat');
$calendar.= ''.implode(' ',$headings).' ';
/* days and weeks vars now ... */
$running_day = date('w',mktime(0,0,0,$month,1,$year));
$days_in_month = date('t',mktime(0,0,0,$month,1,$year));
$days_in_this_week = 1;
$day_counter = 0;
$dates_array = array();
/* row for week one */
$calendar.= '';
/* print "blank" days until the first of the current week */
for($x = 0; $x < $running_day; $x++):
$calendar.= ' ';
$days_in_this_week++;
endfor;
/* keep going with days.... */
for($list_day = 1; $list_day <= $days_in_month; $list_day++):
//---------------------------------------------------------------Main function area-------------------------------------------------------------
if($list_day < $day){ // previous date is off.................
$calendar.= '';
/* add in the day number */
$calendar.= ' ';
/* add in the day number */
$calendar.= '';
//$calendar.= '';
//$calendar.= ' ';
if($running_day == 6):
$calendar.= ' ';
if(($day_counter+1) != $days_in_month):
$calendar.= '';
endif;
$running_day = -1;
$days_in_this_week = 0;
endif;
$days_in_this_week++; $running_day++; $day_counter++;
endfor;
/* finish the rest of the days in the week */
if($days_in_this_week < 8):
for($x = 1; $x <= (8 - $days_in_this_week); $x++):
$calendar.= ' ';
endfor;
endif;
/* final row */
$calendar.= ' ';
/* end the table */
$calendar.= '';
/* all done, return result */
return $calendar;
}
if($_GET['nxt_m'] != ''){ $date_month = $_GET['nxt_m']; }
if($_GET['nxt_y'] != ''){ $date_year = $_GET['nxt_y']; }
/* sample usages */
echo '
'.$list_day.'
';
/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/
$dt = "$year-$month-$list_day";
$dt = strtotime($dt);
$snt = is_task($uid,$dt);
if($snt != '0'){
//$calendar.= '';
$calendar.= is_task_list($uid,$dt);
if($snt >= 5){ $calendar.= 'more'; }
}
}else{
$str_date = "$list_day/$month/$year";
//$str_date = "$list_day/$month/$year&nm=$month&ny=$year";
/* if this is today then change the background color..... */
if($day == $list_day){ $cls = 'bgcolor="#fcedea"'; }else{ $cls = ''; }
$calendar.= '';
/** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/
$dt = "$year-$month-$list_day";
$dt = strtotime($dt);
$snt = is_task($uid,$dt);
if($snt != '0'){
//$calendar.= '';
$calendar.= is_task_list($uid,$dt);
if($snt >= 5){ $calendar.= 'more'; }
}
//$calendar.= '
';
}
//-----------------------------------------------------------------------------------------------------------------------------------------------
$calendar.= '';
echo draw_calendar($user_id,$date_month,$date_year);
echo "
";
echo '';
echo '';
?>