From d78f272032271777c8a370296ce5c4f6adc0d85e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 6 Aug 2002 07:56:32 +0000 Subject: [PATCH] merged skeeter's last changes --- infolog/calendar/inc/class.bocalendar.inc.php | 51 +++--- .../calendar/inc/class.socalendar_sql.inc.php | 16 +- infolog/calendar/inc/class.uicalendar.inc.php | 160 +++++++++--------- 3 files changed, 114 insertions(+), 113 deletions(-) diff --git a/infolog/calendar/inc/class.bocalendar.inc.php b/infolog/calendar/inc/class.bocalendar.inc.php index 1586cf2671..c97af1e4a6 100755 --- a/infolog/calendar/inc/class.bocalendar.inc.php +++ b/infolog/calendar/inc/class.bocalendar.inc.php @@ -97,7 +97,6 @@ var $so; var $cached_events; var $repeating_events; - var $datetime; var $day; var $month; var $year; @@ -181,7 +180,7 @@ if ($this->prefs['common']['timeformat'] == '12') { - $this->users_timeformat = 'h:i a'; + $this->users_timeformat = 'h:ia'; } else { @@ -203,8 +202,7 @@ 'g_owner' => $this->g_owner ) ); - $this->datetime = $this->so->datetime; - $localtime = $this->datetime->gmtnow + $this->datetime->tz_offset; + $localtime = $GLOBALS['phpgw']->datetme->users_localtime; $date = get_var('date',Array('HTTP_GET_VARS','HTTP_POST_VARS')); $year = get_var('year',Array('HTTP_GET_VARS','HTTP_POST_VARS')); @@ -225,7 +223,7 @@ } elseif($this->year == 0) { - $this->year = date('Y',$localtime); + $this->year = date('Y',$GLOBALS['phpgw']->datetme->users_localtime); } if(isset($month) && $month!='') { @@ -233,7 +231,7 @@ } elseif($this->month == 0) { - $this->month = date('m',$localtime); + $this->month = date('m',$GLOBALS['phpgw']->datetme->users_localtime); } if(isset($day) && $day!='') { @@ -241,11 +239,11 @@ } elseif($this->day == 0) { - $this->day = date('d',$localtime); + $this->day = date('d',$GLOBALS['phpgw']->datetme->users_localtime); } } - $this->today = date('Ymd',$this->datetime->gmtnow); + $this->today = date('Ymd',$GLOBALS['phpgw']->datetime->gmtnow); if($this->debug) { @@ -406,7 +404,7 @@ $event = $this->read_entry(intval($param['id'])); //RB if($this->owner == $event['owner']) //RB { - $exception_time = mktime($event['start']['hour'],$event['start']['min'],0,$param['month'],$param['day'],$param['year']) - $this->datetime->tz_offset; + $exception_time = mktime($event['start']['hour'],$event['start']['min'],0,$param['month'],$param['day'],$param['year']) - $GLOBALS['phpgw']->datetime->tz_offset; $event['recur_exception'][] = intval($exception_time); $this->so->cal->event = $event; if($this->debug) @@ -946,17 +944,17 @@ { $error = 40; } - elseif (($this->datetime->time_valid($event['start']['hour'],$event['start']['min'],0) == False) || ($this->datetime->time_valid($event['end']['hour'],$event['end']['min'],0) == False)) + elseif (($GLOBALS['phpgw']->datetime->time_valid($event['start']['hour'],$event['start']['min'],0) == False) || ($GLOBALS['phpgw']->datetime->time_valid($event['end']['hour'],$event['end']['min'],0) == False)) { $error = 41; } - elseif (($this->datetime->date_valid($event['start']['year'],$event['start']['month'],$event['start']['mday']) == False) || ($this->datetime->date_valid($event['end']['year'],$event['end']['month'],$event['end']['mday']) == False) || ($this->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday']) == 1)) + elseif (($GLOBALS['phpgw']->datetime->date_valid($event['start']['year'],$event['start']['month'],$event['start']['mday']) == False) || ($GLOBALS['phpgw']->datetime->date_valid($event['end']['year'],$event['end']['month'],$event['end']['mday']) == False) || ($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday']) == 1)) { $error = 42; } - elseif ($this->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday']) == 0) + elseif ($GLOBALS['phpgw']->datetime->date_compare($event['start']['year'],$event['start']['month'],$event['start']['mday'],$event['end']['year'],$event['end']['month'],$event['end']['mday']) == 0) { - if ($this->datetime->time_compare($event['start']['hour'],$event['start']['min'],0,$event['end']['hour'],$event['end']['min'],0) == 1) + if ($GLOBALS['phpgw']->datetime->time_compare($event['start']['hour'],$event['start']['min'],0,$event['end']['hour'],$event['end']['min'],0) == 1) { $error = 42; } @@ -1061,7 +1059,8 @@ } $temp_event_start = sprintf("%d%02d",$event['start']['hour'],$event['start']['min']); $temp_event_end = sprintf("%d%02d",$event['end']['hour'],$event['end']['min']); - if((($temp_start_time <= $temp_event_start) && ($temp_end_time >= $temp_event_start) && ($temp_end_time <= $temp_event_end)) || +// if((($temp_start_time <= $temp_event_start) && ($temp_end_time >= $temp_event_start) && ($temp_end_time <= $temp_event_end)) || + if((($temp_start_time <= $temp_event_start) && ($temp_end_time > $temp_event_start) && ($temp_end_time <= $temp_event_end)) || (($temp_start_time >= $temp_event_start) && ($temp_start_time < $temp_event_end) && ($temp_end_time >= $temp_event_end)) || (($temp_start_time <= $temp_event_start) && ($temp_end_time >= $temp_event_end)) || (($temp_start_time >= $temp_event_start) && ($temp_end_time <= $temp_event_end))) @@ -1094,7 +1093,7 @@ // if($starttime == $endtime && $GLOBALS['phpgw']->common->show_date($starttime,'Hi') == 0) // { -// $endtime = mktime(23,59,59,$GLOBALS['phpgw']->common->show_date($starttime,'m'),$GLOBALS['phpgw']->common->show_date($starttime,'d') + 1,$GLOBALS['phpgw']->common->show_date($starttime,'Y')) - $this->datetime->tz_offset; +// $endtime = mktime(23,59,59,$GLOBALS['phpgw']->common->show_date($starttime,'m'),$GLOBALS['phpgw']->common->show_date($starttime,'d') + 1,$GLOBALS['phpgw']->common->show_date($starttime,'Y')) - $GLOBALS['phpgw']->datetime->tz_offset; // } // // - $sql = 'AND ((('.$starttime.' <= phpgw_cal.datetime) AND ('.$endtime.' >= phpgw_cal.datetime) AND ('.$endtime.' <= phpgw_cal.edatetime)) ' @@ -1285,8 +1284,8 @@ function get_week_label() { - $first = $this->datetime->gmtdate($this->datetime->get_weekday_start($this->year, $this->month, $this->day)); - $last = $this->datetime->gmtdate($first['raw'] + 518400); + $first = $GLOBALS['phpgw']->datetime->gmtdate($GLOBALS['phpgw']->datetime->get_weekday_start($this->year, $this->month, $this->day)); + $last = $GLOBALS['phpgw']->datetime->gmtdate($first['raw'] + 518400); // Week Label $week_id = lang(strftime("%B",$first['raw'])).' '.$first['day']; @@ -1388,7 +1387,7 @@ $inserted = False; if(isset($event['recur_exception'])) { - $event_time = mktime($event['start']['hour'],$event['start']['min'],0,intval(substr($date,4,2)),intval(substr($date,6,2)),intval(substr($date,0,4))) - $this->datetime->tz_offset; + $event_time = mktime($event['start']['hour'],$event['start']['min'],0,intval(substr($date,4,2)),intval(substr($date,6,2)),intval(substr($date,0,4))) - $GLOBALS['phpgw']->datetime->tz_offset; while($inserted == False && list($key,$exception_time) = each($event['recur_exception'])) { if($this->debug) @@ -1576,7 +1575,7 @@ continue; } - if (($this->datetime->day_of_week($rep_events['start']['year'],$rep_events['start']['month'],$rep_events['start']['mday']) == $this->datetime->day_of_week($search_date_year,$search_date_month,$search_date_day)) && + if (($GLOBALS['phpgw']->datetime->day_of_week($rep_events['start']['year'],$rep_events['start']['month'],$rep_events['start']['mday']) == $GLOBALS['phpgw']->datetime->day_of_week($search_date_year,$search_date_month,$search_date_day)) && (ceil($rep_events['start']['mday']/7) == ceil($search_date_day/7))) { $this->sort_event($rep_events,$search_date_full); @@ -1741,8 +1740,8 @@ echo ''."\n"; } } -// $edate -= $this->datetime->tz_offset; -// for($date=mktime(0,0,0,$smonth,$sday,$syear) - $this->datetime->tz_offset;$date<=$edate;$date += 86400) +// $edate -= $GLOBALS['phpgw']->datetime->tz_offset; +// for($date=mktime(0,0,0,$smonth,$sday,$syear) - $GLOBALS['phpgw']->datetime->tz_offset;$date<=$edate;$date += 86400) for($date=mktime(0,0,0,$smonth,$sday,$syear);$date<=$edate;$date += 86400) { if($this->debug) @@ -1885,8 +1884,8 @@ for($k=0;$kcached_events[$fulldate]);$k++) { $event = $this->cached_events[$fulldate][$k]; - $eventstart = $this->datetime->localdates($this->maketime($event['start']) - $this->datetime->tz_offset); - $eventend = $this->datetime->localdates($this->maketime($event['end']) - $this->datetime->tz_offset); + $eventstart = $GLOBALS['phpgw']->datetime->localdates($this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset); + $eventend = $GLOBALS['phpgw']->datetime->localdates($this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset); $start = ($eventstart['hour'] * 10000) + ($eventstart['minute'] * 100); $starttemp = $this->splittime("$start",False); $subminute = 0; @@ -2049,12 +2048,12 @@ if($old_event != False) { - $old_event_datetime = $t_old_start_time - $this->datetime->tz_offset; + $old_event_datetime = $t_old_start_time - $GLOBALS['phpgw']->datetime->tz_offset; } if($new_event != False) { - $new_event_datetime = $this->maketime($new_event['start']) - $this->datetime->tz_offset; + $new_event_datetime = $this->maketime($new_event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; } while($participants && list($userid,$statusid) = each($participants)) @@ -2163,7 +2162,7 @@ $t_appt['hour'] = $GLOBALS['phpgw']->common->show_date($starttime,'H'); $t_appt['min'] = $GLOBALS['phpgw']->common->show_date($starttime,'i'); $t_appt['sec'] = 0; - $t_time = $this->maketime($t_appt) - $this->datetime->tz_offset; + $t_time = $this->maketime($t_appt) - $GLOBALS['phpgw']->datetime->tz_offset; $y_time = $t_time - 86400; $tt_time = $t_time + 86399; if($this->debug) diff --git a/infolog/calendar/inc/class.socalendar_sql.inc.php b/infolog/calendar/inc/class.socalendar_sql.inc.php index 03a51a37ef..bf6f7a5542 100644 --- a/infolog/calendar/inc/class.socalendar_sql.inc.php +++ b/infolog/calendar/inc/class.socalendar_sql.inc.php @@ -129,13 +129,13 @@ class socalendar_ extends socalendar__ // But until then, do it this way... //Legacy Support (New) - $datetime = $this->datetime->localdates($this->stream->f('datetime')); + $datetime = $GLOBALS['phpgw']->datetime->localdates($this->stream->f('datetime')); $this->set_start($datetime['year'],$datetime['month'],$datetime['day'],$datetime['hour'],$datetime['minute'],$datetime['second']); - $datetime = $this->datetime->localdates($this->stream->f('mdatetime')); + $datetime = $GLOBALS['phpgw']->datetime->localdates($this->stream->f('mdatetime')); $this->set_date('modtime',$datetime['year'],$datetime['month'],$datetime['day'],$datetime['hour'],$datetime['minute'],$datetime['second']); - $datetime = $this->datetime->localdates($this->stream->f('edatetime')); + $datetime = $GLOBALS['phpgw']->datetime->localdates($this->stream->f('edatetime')); $this->set_end($datetime['year'],$datetime['month'],$datetime['day'],$datetime['hour'],$datetime['minute'],$datetime['second']); //Legacy Support @@ -159,7 +159,7 @@ class socalendar_ extends socalendar__ $enddate = $this->stream->f('recur_enddate'); if($enddate != 0 && $enddate != Null) { - $datetime = $this->datetime->localdates($enddate); + $datetime = $GLOBALS['phpgw']->datetime->localdates($enddate); $this->add_attribute('recur_enddate',$datetime['year'],'year'); $this->add_attribute('recur_enddate',$datetime['month'],'month'); $this->add_attribute('recur_enddate',$datetime['day'],'mday'); @@ -459,9 +459,9 @@ class socalendar_ extends socalendar__ $event['id'] = $this->stream->f('cal_id'); } - $date = $this->maketime($event['start']) - $this->datetime->tz_offset; - $enddate = $this->maketime($event['end']) - $this->datetime->tz_offset; - $today = time() - $this->datetime->tz_offset; + $date = $this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; + $enddate = $this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; + $today = time() - $GLOBALS['phpgw']->datetime->tz_offset; if($event['recur_type'] != MCAL_RECUR_NONE) { @@ -507,7 +507,7 @@ class socalendar_ extends socalendar__ { if($event['recur_enddate']['month'] != 0 && $event['recur_enddate']['mday'] != 0 && $event['recur_enddate']['year'] != 0) { - $end = $this->maketime($event['recur_enddate']) - $this->datetime->tz_offset; + $end = $this->maketime($event['recur_enddate']) - $GLOBALS['phpgw']->datetime->tz_offset; } else { diff --git a/infolog/calendar/inc/class.uicalendar.inc.php b/infolog/calendar/inc/class.uicalendar.inc.php index 6ed6d84c63..ad4bb2150b 100755 --- a/infolog/calendar/inc/class.uicalendar.inc.php +++ b/infolog/calendar/inc/class.uicalendar.inc.php @@ -29,9 +29,8 @@ // var $debug = True; var $cat_id; - var $datetime; - var $tz_offset; var $theme; + var $link_tpl; var $public_functions = array( 'mini_calendar' => True, @@ -68,8 +67,6 @@ $this->theme = $GLOBALS['phpgw_info']['theme']; $this->bo = CreateObject('calendar.bocalendar',1); - $this->datetime = $this->bo->datetime; - $this->tz_offset = $this->datetime->tz_offset; if($this->debug) { @@ -84,6 +81,19 @@ $this->cat_id = $this->bo->cat_id; + $this->link_tpl = CreateObject('phpgwapi.Template',$this->template_dir); + $this->link_tpl->set_unknowns('remove'); + $this->link_tpl->set_file( + Array( + 'link_picture' => 'link_pict.tpl' + ) + ); + $this->link_tpl->set_block('link_picture','link_pict','link_pict'); + $this->link_tpl->set_block('link_picture','pict','pict'); + $this->link_tpl->set_block('link_picture','link_open','link_open'); + $this->link_tpl->set_block('link_picture','link_close','link_close'); + $this->link_tpl->set_block('link_picture','link_text','link_text'); + if($this->bo->use_session) { $this->save_sessiondata(); @@ -129,13 +139,13 @@ $this->bo->read_holidays($params['year']); - $date = $this->datetime->makegmttime(0,0,0,$params['month'],$params['day'],$params['year']); + $date = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$params['month'],$params['day'],$params['year']); $month_ago = intval(date('Ymd',mktime(0,0,0,$params['month'] - 1,$params['day'],$params['year']))); $month_ahead = intval(date('Ymd',mktime(0,0,0,$params['month'] + 1,$params['day'],$params['year']))); $monthstart = intval(date('Ymd',mktime(0,0,0,$params['month'],1,$params['year']))); $monthend = intval(date('Ymd',mktime(0,0,0,$params['month'] + 1,0,$params['year']))); - $weekstarttime = $this->datetime->get_weekday_start($params['year'],$params['month'],1); + $weekstarttime = $GLOBALS['phpgw']->datetime->get_weekday_start($params['year'],$params['month'],1); if($this->debug) { @@ -206,17 +216,17 @@ for($i=0;$i<7;$i++) { $var = Array( - 'dayname' => '' . substr(lang($this->datetime->days[$i]['name']),0,2) . '', + 'dayname' => '' . substr(lang($GLOBALS['phpgw']->datetime->days[$i]['name']),0,2) . '', 'day_image' => '' ); $this->output_template_array($p,'daynames','mini_day',$var); } - $today = date('Ymd',$this->datetime->gmtnow + $this->tz_offset); + $today = date('Ymd',$GLOBALS['phpgw']->datetime->gmtnow + $GLOBALS['phpgw']->datetme->tz_offset); unset($date); - for($i=$weekstarttime + $this->tz_offset;date('Ymd',$i)<=$monthend;$i += (24 * 3600 * 7)) + for($i=$weekstarttime + $GLOBALS['phpgw']->datetme->tz_offset;date('Ymd',$i)<=$monthend;$i += (24 * 3600 * 7)) { unset($var); - $daily = $this->set_week_array($i - $this->tz_offset,$cellcolor,$weekly); + $daily = $this->set_week_array($i - $GLOBALS['phpgw']->datetme->tz_offset,$cellcolor,$weekly); @reset($daily); while(list($date,$day_params) = each($daily)) { @@ -380,8 +390,8 @@ { $this->bo->read_holidays(); - $next = $this->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 7,$this->bo->year); - $prev = $this->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day - 7,$this->bo->year); + $next = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 7,$this->bo->year); + $prev = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day - 7,$this->bo->year); if (!$this->bo->printer_friendly || ($this->bo->printer_friendly && @$this->bo->prefs['calendar']['display_minicals'])) { @@ -503,8 +513,8 @@ $print = ''; } - $now = $this->datetime->makegmttime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year); - $now['raw'] += $this->tz_offset; + $now = $GLOBALS['phpgw']->datetime->makegmttime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year); + $now['raw'] += $GLOBALS['phpgw']->datetme->tz_offset; $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); $p = CreateObject('phpgwapi.Template',$this->template_dir); @@ -645,7 +655,7 @@ $this->bo->repeating_events = Array(); $this->bo->cached_events = Array(); $this->bo->repeating_events[0] = $event; - $datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $this->tz_offset; + $datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $GLOBALS['phpgw']->datetme->tz_offset; $this->bo->check_repeating_events($datetime); $check_date = $GLOBALS['phpgw']->common->show_date($datetime,'Ymd'); if(is_array($this->bo->cached_events[$check_date][0]) && @@ -1158,8 +1168,8 @@ $print = ''; } - $now = $this->datetime->makegmttime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year); - $now['raw'] += $this->tz_offset; + $now = $GLOBALS['phpgw']->datetime->makegmttime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year); + $now['raw'] += $GLOBALS['phpgw']->datetme->tz_offset; $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); $p = CreateObject('phpgwapi.Template',$this->template_dir); @@ -1216,7 +1226,7 @@ return; } - $freetime = $this->datetime->localdates(mktime(0,0,0,$event['start']['month'],$event['start']['mday'],$event['start']['year']) - $this->tz_offset); + $freetime = $GLOBALS['phpgw']->datetime->localdates(mktime(0,0,0,$event['start']['month'],$event['start']['mday'],$event['start']['year']) - $GLOBALS['phpgw']->datetme->tz_offset); echo $this->timematrix( Array( 'date' => $freetime, @@ -1275,9 +1285,9 @@ 23 => 2 ); - $startdate = mktime(0,0,0,$this->bo->month,1,$this->bo->year) - $this->tz_offset; - $days = $this->datetime->days_in_month($this->bo->month,$this->bo->year); - $enddate = mktime(23,59,59,$this->bo->month,$this->bo->days,$this->bo->year) - $this->tz_offset; + $startdate = mktime(0,0,0,$this->bo->month,1,$this->bo->year) - $GLOBALS[\'phpgw\']->datetme->tz_offset; + $days = $GLOBALS[\'phpgw\']->datetime->days_in_month($this->bo->month,$this->bo->year); + $enddate = mktime(23,59,59,$this->bo->month,$this->bo->days,$this->bo->year) - $GLOBALS[\'phpgw\']->datetme->tz_offset; $header[] = lang(\'Category\'); for ($d = 1; $d <= $days; $d++) @@ -1455,7 +1465,7 @@ function matrixselect() { - $datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $this->tz_offset; + $datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $GLOBALS['phpgw']->datetme->tz_offset; $sb = CreateObject('phpgwapi.sbox'); @@ -1618,7 +1628,7 @@ switch($GLOBALS['HTTP_POST_VARS']['matrixtype']) { case 'free/busy': - $freetime = $this->datetime->gmtdate(mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year)); + $freetime = $GLOBALS['phpgw']->datetime->gmtdate(mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year)); echo $this->timematrix( Array( 'date' => $freetime, @@ -1691,7 +1701,7 @@ { $event = $this->bo->read_entry($id); - $datetime = $this->bo->maketime($event['start']) - $this->tz_offset; + $datetime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetme->tz_offset; $ids[strval($event['id'])]++; $info[strval($event['id'])] = $GLOBALS['phpgw']->common->show_date($datetime).$this->link_to_entry($event,$event['start']['month'],$event['start']['mday'],$event['start']['year']); @@ -1885,8 +1895,8 @@ $this->output_template_array($p,'table_row','footer_row',$var); unset($thisdate); - $thisdate = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $this->tz_offset; - $sun = $this->datetime->get_weekday_start($this->bo->year,$this->bo->month,$this->bo->day) - $this->tz_offset; + $thisdate = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $GLOBALS['phpgw']->datetme->tz_offset; + $sun = $GLOBALS['phpgw']->datetime->get_weekday_start($this->bo->year,$this->bo->month,$this->bo->day) - $GLOBALS['phpgw']->datetme->tz_offset; $str = ''; for ($i = -7; $i <= 7; $i++) @@ -1990,26 +2000,14 @@ //RB $is_private = $this->bo->is_private($event,$event['owner']); //RB $editable = ((!$this->bo->printer_friendly) && (($is_private && $this->bo->check_perms(PHPGW_ACL_PRIVATE)) || !$is_private)); //RB editable means here, ok to set a link to view - $editable = !$this->bo->printer_friendly && $this->bo->rb_check_perms(PHPGW_ACL_READ,$event); $is_private = !$event['public'] && !$this->bo->rb_check_perms(PHPGW_ACL_READ,$event); - $p = CreateObject('phpgwapi.Template',$this->template_dir); - $p->set_unknowns('remove'); - $p->set_file( - Array( - 'link_picture' => 'link_pict.tpl' - ) - ); - $p->set_block('link_picture','link_pict','link_pict'); - $p->set_block('link_picture','pict','pict'); - $p->set_block('link_picture','link_open','link_open'); - $p->set_block('link_picture','link_close','link_close'); - $p->set_block('link_picture','link_text','link_text'); + $editable = !$this->bo->printer_friendly && $this->bo->rb_check_perms(PHPGW_ACL_READ,$event); - $starttime = $this->bo->maketime($event['start']) - $this->tz_offset; - $endtime = $this->bo->maketime($event['end']) - $this->tz_offset; + $starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetme->tz_offset; + $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetme->tz_offset; $rawdate = mktime(0,0,0,$month,$day,$year); - $rawdate_offset = $rawdate - $this->tz_offset; - $nextday = mktime(0,0,0,$month,$day + 1,$year) - $this->tz_offset; + $rawdate_offset = $rawdate - $GLOBALS['phpgw']->datetme->tz_offset; + $nextday = mktime(0,0,0,$month,$day + 1,$year) - $GLOBALS['phpgw']->datetme->tz_offset; if (intval($GLOBALS['phpgw']->common->show_date($starttime,'Hi')) && $starttime == $endtime) { $time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); @@ -2031,7 +2029,7 @@ if($endtime >= ($rawdate_offset + 86400)) { - $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $this->tz_offset,$this->bo->users_timeformat); + $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetme->tz_offset,$this->bo->users_timeformat); } else { @@ -2048,14 +2046,14 @@ { $text .= $this->bo->display_status($event['users_status']); } - $text = ''.$time.' '.$this->bo->get_short_field($event,$is_private,'title').$text.''.$GLOBALS['phpgw']->browser->br; + $text = ''.$time.' '.$this->bo->get_short_field($event,$is_private,'title').$text.''.$GLOBALS['phpgw']->browser->br; if ($editable) { $date = sprintf('%04d%02d%02d',$year,$month,$day); - $p->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date)); - $p->set_var('lang_view',lang('View this entry')); - $p->parse('picture','link_open',True); + $this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date)); + $this->link_tpl->set_var('lang_view',lang('View this entry')); + $this->link_tpl->parse('picture','link_open',True); if($event['priority'] == 3) { @@ -2118,7 +2116,7 @@ 'height' => $picture[$i]['height'], 'description' => $description ); - $this->output_template_array($p,'picture','pict',$var); + $this->output_template_array($this->link_tpl,'picture','pict',$var); } } else @@ -2130,15 +2128,17 @@ $var = Array( 'text' => $text ); - $this->output_template_array($p,'picture','link_text',$var); + $this->output_template_array($this->link_tpl,'picture','link_text',$var); } if ($editable) { - $p->parse('picture','link_close',True); + $this->link_tpl->parse('picture','link_close',True); } - $str = $p->fp('out','link_pict'); - unset($p); + $str = $this->link_tpl->fp('out','link_pict'); + $this->link_tpl->set_var('picture',''); + $this->link_tpl->set_var('out',''); +// unset($p); return $str; } @@ -2157,8 +2157,8 @@ $mday = $event['start']['mday']; $year = $event['start']['year']; - $start = mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$mday,$year) - $this->tz_offset; - $end = $this->bo->maketime($event['end']) - $this->tz_offset; + $start = mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$mday,$year) - $GLOBALS['phpgw']->datetme->tz_offset; + $end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetme->tz_offset; $overlap = ''; for($i=0;$iweekstarttime = $this->datetime->get_weekday_start($year,$month,1); + $this->weekstarttime = $GLOBALS['phpgw']->datetime->get_weekday_start($year,$month,1); $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_unknowns('remove'); @@ -2297,7 +2297,7 @@ $col_width = 12; } - if($this->datetime->days[$i]['weekday']) + if($GLOBALS['phpgw']->datetime->days[$i]['weekday']) { switch($col_width) { @@ -2314,9 +2314,9 @@ for($i=0;$i<7;$i++) { - if($this->bo->prefs['calendar']['weekdays_only'] && $this->datetime->days[$i]['weekday']) + if($this->bo->prefs['calendar']['weekdays_only'] && $GLOBALS['phpgw']->datetime->days[$i]['weekday']) { - $p->set_var('col_title',lang($this->datetime->days[$i]['name'])); + $p->set_var('col_title',lang($GLOBALS['phpgw']->datetime->days[$i]['name'])); $p->parse('column_header','column_title',True); } } @@ -2331,7 +2331,7 @@ } $temp_owner = $this->bo->owner; - $this->bo->owner = $owner; +// $this->bo->owner = $owner; $str = ''; $p = CreateObject('phpgwapi.Template',$this->template_dir); @@ -2357,15 +2357,15 @@ $p->parse('column_header','month_column',True); $p->set_var('col_width','12'); } - $today = date('Ymd',$this->datetime->gmtnow + $this->tz_offset); - $daily = $this->set_week_array($startdate - $this->tz_offset,$cellcolor,$weekly); + $today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime); + $daily = $this->set_week_array($startdate - $GLOBALS['phpgw']->datetme->tz_offset,$cellcolor,$weekly); @reset($daily); while(list($date,$day_params) = each($daily)) { $year = intval(substr($date,0,4)); $month = intval(substr($date,4,2)); $day = intval(substr($date,6,2)); - $dow = $this->datetime->day_of_week($year,$month,$day); + $dow = $GLOBALS['phpgw']->datetime->day_of_week($year,$month,$day); if($this->bo->prefs['calendar']['weekdays_only'] && ($dow == 0 || $dow == 6)) { continue; @@ -2452,7 +2452,7 @@ { if($this->debug) { - echo ''."\n"; + echo ''."\n"; } $this->bo->store_to_cache( @@ -2466,7 +2466,7 @@ $monthstart = intval(date('Ymd',mktime(0,0,0,$month ,1,$year))); $monthend = intval(date('Ymd',mktime(0,0,0,$month + 1,0,$year))); - $start = $this->datetime->get_weekday_start($year, $month, 1); + $start = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, 1); if($this->debug) { @@ -2494,7 +2494,7 @@ $cellcolor = $this->theme['row_on']; - for ($i=intval($start + $this->tz_offset);intval(date('Ymd',$i)) <= $monthend;$i += 604800) + for ($i=intval($start + $GLOBALS['phpgw']->datetme->tz_offset);intval(date('Ymd',$i)) <= $monthend;$i += 604800) { $cellcolor = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($cellcolor); $var = Array( @@ -2529,7 +2529,7 @@ $p->set_block('week','m_w_table','m_w_table'); $p->set_block('week','event','event'); - $start = $this->datetime->get_weekday_start($year, $month, $day); + $start = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, $day); $cellcolor = $this->theme['row_off']; @@ -2664,12 +2664,12 @@ } $var[] = Array( 'field' => lang('Start Date/Time'), - 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $this->tz_offset) + 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetme->tz_offset) ); $var[] = Array( 'field' => lang('End Date/Time'), - 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $this->tz_offset) + 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetme->tz_offset) ); $var[] = Array( @@ -2684,7 +2684,7 @@ $var[] = Array( 'field' => lang('Updated'), - 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['modtime']) - $this->tz_offset) + 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['modtime']) - $GLOBALS['phpgw']->datetme->tz_offset) ); $var[] = Array( @@ -2741,7 +2741,7 @@ $recur_end = $this->bo->maketime($event['recur_enddate']); if($recur_end != 0) { - $recur_end -= $this->tz_offset; + $recur_end -= $GLOBALS['phpgw']->datetme->tz_offset; $str_extra .= lang('ends').': '.lang($GLOBALS['phpgw']->common->show_date($recur_end,'l')).', '.lang($GLOBALS['phpgw']->common->show_date($recur_end,'F')).' '.$GLOBALS['phpgw']->common->show_date($recur_end,'d, Y').' '; } } @@ -2910,7 +2910,7 @@ $time = Array(); - $daily = $this->set_week_array($this->datetime->get_weekday_start($params['year'],$params['month'],$params['day']),$this->theme['row_on'],True); + $daily = $this->set_week_array($GLOBALS['phpgw']->datetime->get_weekday_start($params['year'],$params['month'],$params['day']),$this->theme['row_on'],True); if($this->debug) { echo ''."\n"; @@ -3028,7 +3028,7 @@ $last_endtime = $endtime; if($this->debug) { - echo ''."\n"; + echo ''."\n"; } } } @@ -3241,7 +3241,8 @@ $this->bo->cached_events = Array(); $this->bo->owner = $part; - $this->so->owner = $part; + $this->bo->so->owner = $part; + $this->bo->so->open_box($part); $this->bo->store_to_cache( Array( 'syear' => $date['year'], @@ -3289,7 +3290,8 @@ . ''; } $this->bo->owner = $owner; - $this->so->owner = $owner; + $this->bo->so->owner = $owner; + $this->bo->so->open_box($owner); return $str.''."\n"; } @@ -3418,7 +3420,7 @@ ); // Date - $start = $this->bo->maketime($event['start']) - $this->tz_offset; + $start = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetme->tz_offset; $var[] = Array( 'field' => lang('Start Date'), 'data' => $GLOBALS['phpgw']->common->dateformatorder( @@ -3440,7 +3442,7 @@ ); // End Date - $end = $this->bo->maketime($event['end']) - $this->tz_offset; + $end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetme->tz_offset; $var[] = Array( 'field' => lang('End Date'), 'data' => $GLOBALS['phpgw']->common->dateformatorder( @@ -3552,12 +3554,12 @@ if($event['recur_enddate']['year'] != 0 && $event['recur_enddate']['month'] != 0 && $event['recur_enddate']['mday'] != 0) { $checked = ' checked'; - $recur_end = $this->bo->maketime($event['recur_enddate']) - $this->tz_offset; + $recur_end = $this->bo->maketime($event['recur_enddate']) - $GLOBALS['phpgw']->datetme->tz_offset; } else { $checked = ''; - $recur_end = $this->bo->maketime($event['start']) + 86400 - $this->tz_offset; + $recur_end = $this->bo->maketime($event['start']) + 86400 - $GLOBALS['phpgw']->datetme->tz_offset; } $var[] = Array(