* Licensed under the GNU GPL. For full terms see the file COPYING. * * Displays the main calendar page (month view). * * $Id$ */ require_once('calendar_data.php'); require_once('functions.php'); chdir('..'); require_once('../src/validate.php'); require_once('../functions/strings.php'); require_once('../functions/date.php'); require_once('../config/config.php'); require_once('../functions/page_header.php'); require_once('../src/load_prefs.php'); //display upper part of month calendar view function startcalendar() { global $year, $month, $day, $color; $prev_date = mktime(0, 0, 0, $month - 1, 1, $year); $act_date = mktime(0, 0, 0, $month, 1, $year); $next_date = mktime(0, 0, 0, $month + 1, 1, $year); $prev_month = date( 'm', $prev_date ); $next_month = date( 'm', $next_date); $prev_year = date( 'Y', $prev_date); $next_year = date( 'Y', $next_date ); echo "" . "" . ''. "\n". "\n". "\n" . "". "". ''. "'. "'. "'. "'. "'. "'. "'. ''; } //main logic for month view of calendar function drawmonthview() { global $year, $month, $day, $color, $calendardata, $todayis; $aday = 1 - date('w', mktime(0, 0, 0, $month, 1, $year)); $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year)); while ($aday <= $days_in_month) { echo ''; for ($j=1; $j<=7; $j++) { $cdate="$month"; ($aday<10)?$cdate=$cdate."0$aday":$cdate=$cdate."$aday"; $cdate=$cdate."$year"; if ( $aday <= $days_in_month && $aday > 0){ echo "\n"; $aday++; } echo ''; } } //end of monthly view and form to jump to any month and year function endcalendar() { global $year, $month, $day, $color; echo " \n". "
<< ".($year-1)."< " . date_intl( 'M', $prev_date). "" . date_intl( 'F Y', $act_date ) . "" . date_intl( 'M', $next_date) . " >".($year+1)." >>
" . _("Sunday") . '" . _("Monday") . '" . _("Tuesday") . '" . _("Wednesday") . '" . _("Thursday") . '" . _("Friday") . '" . _("Saturday") . '
\n" . "
"; echo(($cdate==$todayis) ? "[ " . _("TODAY") . " ] " : ""); echo "$aday
"; } else { echo "
\n". " "; } if (isset($calendardata[$cdate])){ $i=0; while ($calfoo = each($calendardata[$cdate])) { $calbar = $calendardata[$cdate][$calfoo[key]]; echo ($calbar[priority]==1) ? "$calbar[title]
\n" : "$calbar[title]
\n"; $i=$i+1; if($i==2){ break; } } } echo "\n
\n". "
\n". " \n". " \n". ' \n". "
\n". "
\n"; } if($month <= 0){ $month = date( 'm' ); } if($year <= 0){ $year = date( 'Y' ); } if($day <= 0){ $day = date( 'd' ); } $todayis = date( 'mdY' ); $calself=basename($PHP_SELF); displayPageHeader($color, 'None'); calendar_header(); readcalendardata(); startcalendar(); drawmonthview(); endcalendar(); ?>