X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fcalendar%2Fcalendar.php;h=098ef0004caaf62474f7cfcc4ab75aeb6f56d8b2;hb=5f75494fd15729f94af3122e10802686656418ed;hp=1c03cb6f6ee1139c0452572b6bf197373eb470bd;hpb=2c85de8f66702a488ea0c371f2576963c593d64d;p=squirrelmail.git diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index 1c03cb6f..098ef000 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -1,25 +1,52 @@ - * Licensed under the GNU GPL. For full terms see the file COPYING. + * Originally contrubuted by Michal Szczotka * - * Displays the main calendar page (month view). + * Displays the main calendar page (month view). * * $Id$ + * @package plugins + * @subpackage calendar */ -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'); +/** +*/ +define('SM_PATH','../../'); + +/* Calender plugin required files. */ +require_once(SM_PATH . 'plugins/calendar/calendar_data.php'); +require_once(SM_PATH . 'plugins/calendar/functions.php'); + +/* SquirrelMail required files. */ +require_once(SM_PATH . 'include/validate.php'); +require_once(SM_PATH . 'functions/strings.php'); +require_once(SM_PATH . 'functions/date.php'); +require_once(SM_PATH . 'config/config.php'); +require_once(SM_PATH . 'functions/page_header.php'); +require_once(SM_PATH . 'include/load_prefs.php'); +require_once(SM_PATH . 'functions/html.php'); + +/* get globals */ + +if (isset($_GET['month'])) { + $month = $_GET['month']; +} +if (isset($_GET['year'])) { + $year = $_GET['year']; +} +if (isset($_POST['year'])) { + $year = $_POST['year']; +} +if (isset($_POST['month'])) { + $month = $_POST['month']; +} +/* got 'em */ //display upper part of month calendar view function startcalendar() { @@ -32,28 +59,39 @@ function startcalendar() { $next_month = date( 'm', $next_date); $prev_year = date( 'Y', $prev_date); $next_year = date( 'Y', $next_date ); + $self = 'calendar.php'; - echo "" . - "" . - ''. - "\n". - "\n". - "\n" . - "". - "". - ''. - "'. - "'. - "'. - "'. - "'. - "'. - "'. - ''; - + echo html_tag( 'tr', "\n". + html_tag( 'td', "\n". + html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) . + html_tag( 'tr', "\n". + html_tag( 'th', + "<< ".($year-1)."" + ) . "\n". + html_tag( 'th', + "< " . + date_intl( 'M', $prev_date). "" + ) . "\n". + html_tag( 'th', date_intl( 'F Y', $act_date ), '', $color[0], 'colspan="3"') . + html_tag( 'th', + "" . + date_intl( 'M', $next_date) . " >" + ) . "\n". + html_tag( 'th', + "".($year+1)." >>" + ) + ) . "\n". + html_tag( 'tr', + html_tag( 'th', _("Sunday"), '', $color[5], 'width="14%" width="90"' ) ."\n" . + html_tag( 'th', _("Monday"), '', $color[5], 'width="14%" width="90"' ) ."\n" . + html_tag( 'th', _("Tuesday"), '', $color[5], 'width="14%" width="90"' ) ."\n" . + html_tag( 'th', _("Wednesday"), '', $color[5], 'width="14%" width="90"' ) ."\n" . + html_tag( 'th', _("Thursday"), '', $color[5], 'width="14%" width="90"' ) ."\n" . + html_tag( 'th', _("Friday"), '', $color[5], 'width="14%" width="90"' ) ."\n" . + html_tag( 'th', _("Saturday"), '', $color[5], 'width="14%" width="90"' ) ."\n" + ) + ) , + '', $color[0] ) ."\n"; } //main logic for month view of calendar @@ -63,34 +101,35 @@ function drawmonthview() { $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 ''; + echo html_tag( 'tr' ); 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"; + echo "\n\n"; $aday++; } echo ''; @@ -101,28 +140,29 @@ function drawmonthview() { 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 "[ ' . _("TODAY") . " ] " : ''); + echo "$aday
"; } else { - echo "
\n". + echo html_tag( 'td', '', 'left', $color[0]) ."\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"; + $calbar = $calendardata[$cdate][$calfoo['key']]; + $title = '['. $calfoo['key']. '] ' .$calbar['message']; + echo ($calbar['priority']==1) ? "$calbar[title]
\n" : "$calbar[title]
\n"; $i=$i+1; if($i==2){ break; } } } - echo "\n
\n". - "
\n". - " \n"; select_option_year($year); - echo " \n". - " \n". + " \n". - ' \n". - "
\n". - "
\n"; + echo " \n". + ' \n". + " \n". + " \n". + "\n"; } -if($month <= 0){ +if( !isset( $month ) || $month <= 0){ $month = date( 'm' ); } -if($year <= 0){ +if( !isset($year) || $year <= 0){ $year = date( 'Y' ); } -if($day <= 0){ +if( !isset($day) || $day <= 0){ $day = date( 'd' ); } @@ -137,4 +177,4 @@ drawmonthview(); endcalendar(); ?> - \ No newline at end of file +