From f67a1de2cd833b52586047157364628d471dc682 Mon Sep 17 00:00:00 2001 From: skeeter Date: Mon, 2 Apr 2001 17:24:57 +0000 Subject: [PATCH] Various fixes... including the footer for weekly, and for handling daily events on/or about midnight. --- calendar/inc/class.calendar.inc.php | 4 +- calendar/inc/footer.inc.php | 57 ++++++++++++++++++++++------- calendar/inc/functions.inc.php | 1 + calendar/inc/header.inc.php | 10 ++--- 4 files changed, 53 insertions(+), 19 deletions(-) diff --git a/calendar/inc/class.calendar.inc.php b/calendar/inc/class.calendar.inc.php index 3455050d8d..dec7e035cf 100755 --- a/calendar/inc/class.calendar.inc.php +++ b/calendar/inc/class.calendar.inc.php @@ -844,6 +844,8 @@ class calendar extends calendar_ { global $phpgw, $phpgw_info, $grants; + $startdate -= 7200; + if($owner == 0) { $owner= $phpgw_info['user']['account_id']; } $str = ''; @@ -927,7 +929,7 @@ class calendar extends calendar_ $p->parse('column_data','month_day',True); - $rep_events = $this->get_sorted_by_date($date['raw'] - 7200,$owner); + $rep_events = $this->get_sorted_by_date($date['raw'],$owner); if ($this->sorted_events_matching) { diff --git a/calendar/inc/footer.inc.php b/calendar/inc/footer.inc.php index d5370a5cd4..cb3ba33769 100644 --- a/calendar/inc/footer.inc.php +++ b/calendar/inc/footer.inc.php @@ -19,6 +19,11 @@ $phpgw->common->phpgw_exit(); } + if(floor($PHP_VERSION) == 4) + { + global $phpgw_info, $thisday, $thismonth, $thisyear; + } + $p = CreateObject('phpgwapi.Template',$phpgw->calendar->template_dir); $templates = Array( @@ -63,7 +68,7 @@ } $var = Array( - 'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/month.php','owner='.$owner), + 'action_url' => $phpgw->link('/calendar/month.php','owner='.$owner), 'form_name' => 'SelectMonth', 'label' => lang('Month'), 'form_label' => 'date', @@ -77,29 +82,55 @@ $p->parse('output','footer_column',True); $str = ''; - - if ($phpgw->calendar->tempyear && $phpgw->calendar->tempmonth) + + if ($phpgw->calendar->tempyear) { - $m = $phpgw->calendar->tempmonth; $y = $phpgw->calendar->tempyear; } else { - $m = date('m'); $y = date('Y'); } - - if ($thisday) + if ($phpgw->calendar->tempmonth) { - $d = $thisday; + $m = $phpgw->calendar->tempmonth; } else { - $d = date ('d'); + $m = date('m'); } + if ($phpgw->calendar->tempday) + { + $d = $phpgw->calendar->tempday; + } + else + { + $d = date('d'); + } + +// if ($phpgw->calendar->tempyear && $phpgw->calendar->tempmonth) +// { +// $m = $phpgw->calendar->tempmonth; +// $y = $phpgw->calendar->tempyear; +// } +// else +// { +// $m = date('m'); +// $y = date('Y'); +// } +// +// if ($thisday) +// { +// $d = $thisday; +// } +// else +// { +// $d = date ('d'); +// } + unset($thisdate); + $thisdate = $phpgw->calendar->makegmttime(0,0,0,$m,$d,$y); - $sun = $phpgw->calendar->get_weekday_start($y,$m,$d) - - ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset'])); + $sun = $phpgw->calendar->get_weekday_start($y,$m,$d) - $phpgw->calendar->tz_offset - 7200; $str = ''; @@ -117,7 +148,7 @@ } $var = Array( - 'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/week.php','owner='.$owner), + 'action_url' => $phpgw->link('/calendar/week.php','owner='.$owner), 'form_name' => 'SelectWeek', 'label' => lang('Week'), 'form_label' => 'date', @@ -150,7 +181,7 @@ } $var = Array( - 'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/year.php','owner='.$owner), + 'action_url' => $phpgw->link('/calendar/year.php','owner='.$owner), 'form_name' => 'SelectYear', 'label' => lang('Year'), 'form_label' => 'year', diff --git a/calendar/inc/functions.inc.php b/calendar/inc/functions.inc.php index 2062a6757b..6b06e42075 100755 --- a/calendar/inc/functions.inc.php +++ b/calendar/inc/functions.inc.php @@ -71,6 +71,7 @@ if(!isset($phpgw_info['user']['preferences']['calendar']['weekdaystarts'])) { $phpgw_info['user']['preferences']['calendar']['weekdaystarts'] = 'Sunday'; + $phpgw->preferences->save_repository(); } if (isset($date) && strlen($date) > 0) diff --git a/calendar/inc/header.inc.php b/calendar/inc/header.inc.php index c1728ddd93..d16c33014a 100644 --- a/calendar/inc/header.inc.php +++ b/calendar/inc/header.inc.php @@ -32,27 +32,27 @@   - + <?php echo lang('Today'); ?> - + <?php echo lang('This week'); ?> - + <?php echo lang('This month'); ?> - + <?php echo lang('This year'); ?> - + <?php echo lang('Daily Matrix View'); ?>