diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index 1e67bf1634..6ad9798c9a 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/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; @@ -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) { @@ -405,7 +403,7 @@ $event = $this->read_entry(intval($param['id'])); if($this->owner == $event['owner']) { - $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) @@ -910,17 +908,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; } @@ -1058,7 +1056,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)) ' @@ -1249,8 +1247,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']; @@ -1352,7 +1350,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) @@ -1540,7 +1538,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); @@ -1705,8 +1703,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) @@ -1849,8 +1847,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; @@ -2013,12 +2011,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)) @@ -2127,7 +2125,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/calendar/inc/class.boicalendar.inc.php b/calendar/inc/class.boicalendar.inc.php index dd62ff5158..0327468251 100755 --- a/calendar/inc/class.boicalendar.inc.php +++ b/calendar/inc/class.boicalendar.inc.php @@ -1251,6 +1251,10 @@ class boicalendar ) ) ); + if(!is_object($GLOBALS['phpgw']->datetime)) + { + $GLOBALS['phpgw']->datetime = createobject('phpgwaqpi.datetime'); + } } function set_var(&$event,$type,$value) @@ -3046,7 +3050,7 @@ class boicalendar { if(isset($ical['event'][$i][$i_datevar])) { - $temp_time = $so_event->maketime($ical['event'][$i][$i_datevar]) + $so_event->datetime->tz_offset; + $temp_time = $so_event->maketime($ical['event'][$i][$i_datevar]) + $GLOBALS['phpgw']->datetime->tz_offset; @reset($date_array); while(list($key,$var) = each($date_array)) { @@ -3271,11 +3275,11 @@ class boicalendar $ical_event['priority'] = $event['priority']; $ical_event['class'] = intval($event['public']); - $dtstart_mktime = $so_event->maketime($event['start']) - $so_event->datetime->tz_offset; + $dtstart_mktime = $so_event->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; $this->parse_value($ical_event,'dtstart',date('Ymd\THis\Z',$dtstart_mktime),'vevent'); - $dtend_mktime = $so_event->maketime($event['end']) - $so_event->datetime->tz_offset; + $dtend_mktime = $so_event->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; $this->parse_value($ical_event,'dtend',date('Ymd\THis\Z',$dtend_mktime),'vevent'); - $mod_mktime = $so_event->maketime($event['modtime']) - $so_event->datetime->tz_offset; + $mod_mktime = $so_event->maketime($event['modtime']) - $GLOBALS['phpgw']->datetime->tz_offset; $this->parse_value($ical_event,'last_modified',date('Ymd\THis\Z',$mod_mktime),'vevent'); @reset($string_array); while(list($ical_value,$event_value) = each($string_array)) @@ -3389,7 +3393,7 @@ class boicalendar } if($event['recur_enddate']['month'] != 0 && $event['recur_enddate']['mday'] != 0 && $event['recur_enddate']['year'] != 0) { - $recur_mktime = $so_event->maketime($event['recur_enddate']) - $so_event->datetime->tz_offset; + $recur_mktime = $so_event->maketime($event['recur_enddate']) - $GLOBALS['phpgw']->datetime->tz_offset; $str .= ';UNTIL='.date('Ymd\THis\Z',$recur_mktime); } $this->parse_value($ical_event,'rrule',$str,'vevent'); diff --git a/calendar/inc/class.socalendar.inc.php b/calendar/inc/class.socalendar.inc.php index 5146836ad0..4d3784f2d1 100755 --- a/calendar/inc/class.socalendar.inc.php +++ b/calendar/inc/class.socalendar.inc.php @@ -23,14 +23,16 @@ var $owner; var $g_owner; var $is_group = False; - var $datetime; var $filter; var $cat_id; function socalendar($param) { $this->db = $GLOBALS['phpgw']->db; - $this->datetime = CreateObject('phpgwapi.datetime'); + if(!is_object($GLOBALS['phpgw']->datetime)) + { + $GLOBALS['phpgw']->datetime = createobject('phpgwapi.datetime'); + } $this->owner = (!isset($param['owner']) || $param['owner'] == 0?$GLOBALS['phpgw_info']['user']['account_id']:$param['owner']); $this->filter = (isset($param['filter']) && $param['filter'] != ''?$param['filter']:$this->filter); @@ -46,7 +48,12 @@ echo ''."\n"; } $this->cal = CreateObject('calendar.socalendar_'); - $this->cal->open('INBOX',intval($this->owner)); + $this->open_box($this->owner); + } + + function open_box($owner) + { + $this->cal->open('INBOX',intval($owner)); } function maketime($time) @@ -66,11 +73,11 @@ $extra .= ($this->cat_id?"AND phpgw_cal.category like '%".$this->cat_id."%' ":''); if($owner_id) { - return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$this->datetime->tz_offset,$owner_id); + return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset,$owner_id); } else { - return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$this->datetime->tz_offset); + return $this->cal->list_events($startYear,$startMonth,$startDay,$endYear,$endMonth,$endDay,$extra,$GLOBALS['phpgw']->datetime->tz_offset); } } @@ -81,8 +88,8 @@ return Array(); } - $starttime = mktime(0,0,0,$smonth,$sday,$syear) - $this->datetime->tz_offset; - $endtime = mktime(23,59,59,$emonth,$eday,$eyear) - $this->datetime->tz_offset; + $starttime = mktime(0,0,0,$smonth,$sday,$syear) - $GLOBALS['phpgw']->datetime->tz_offset; + $endtime = mktime(23,59,59,$emonth,$eday,$eyear) - $GLOBALS['phpgw']->datetime->tz_offset; // $starttime = mktime(0,0,0,$smonth,$sday,$syear); // $endtime = mktime(23,59,59,$emonth,$eday,$eyear); $sql = "AND (phpgw_cal.cal_type='M') " diff --git a/calendar/inc/class.socalendar__.inc.php b/calendar/inc/class.socalendar__.inc.php index 1344b456e5..663642ab5a 100755 --- a/calendar/inc/class.socalendar__.inc.php +++ b/calendar/inc/class.socalendar__.inc.php @@ -63,13 +63,15 @@ class socalendar__ var $stream; var $user; var $users_status; - var $datetime; var $debug = False; // var $debug = True; function socalendar__() { - $this->datetime = CreateObject('phpgwapi.datetime'); + if(!is_object($GLOBALS['phpgw']->datetime)) + { + $GLOBALS['phpgw']->datetime = createobject('phpgwapi.datetime'); + } } function maketime($time) diff --git a/calendar/inc/class.socalendar_sql.inc.php b/calendar/inc/class.socalendar_sql.inc.php index 081590973b..801deb31db 100755 --- a/calendar/inc/class.socalendar_sql.inc.php +++ b/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/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index a329fe962d..29949c1fcb 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/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); @@ -644,7 +654,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]) && @@ -1151,8 +1161,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); @@ -1209,7 +1219,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, @@ -1268,9 +1278,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++) @@ -1436,7 +1446,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'); @@ -1599,7 +1609,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, @@ -1672,7 +1682,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']); @@ -1866,8 +1876,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++) @@ -1970,24 +1980,12 @@ $str = ''; $is_private = $this->bo->is_private($event,$event['owner']); $editable = ((!$this->bo->printer_friendly) && (($is_private && $this->bo->check_perms(PHPGW_ACL_PRIVATE)) || !$is_private)); - $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'); - $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); @@ -2009,7 +2007,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 { @@ -2031,9 +2029,9 @@ 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) { @@ -2096,7 +2094,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 @@ -2108,15 +2106,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; } @@ -2135,8 +2135,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'); @@ -2275,7 +2275,7 @@ $col_width = 12; } - if($this->datetime->days[$i]['weekday']) + if($GLOBALS['phpgw']->datetime->days[$i]['weekday']) { switch($col_width) { @@ -2292,9 +2292,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); } } @@ -2309,7 +2309,7 @@ } $temp_owner = $this->bo->owner; - $this->bo->owner = $owner; +// $this->bo->owner = $owner; $str = ''; $p = CreateObject('phpgwapi.Template',$this->template_dir); @@ -2335,15 +2335,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; @@ -2430,7 +2430,7 @@ { if($this->debug) { - echo ''."\n"; + echo ''."\n"; } $this->bo->store_to_cache( @@ -2444,7 +2444,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) { @@ -2472,7 +2472,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( @@ -2507,7 +2507,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']; @@ -2641,12 +2641,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( @@ -2661,7 +2661,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( @@ -2718,7 +2718,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').' '; } } @@ -2887,7 +2887,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"; @@ -3005,7 +3005,7 @@ $last_endtime = $endtime; if($this->debug) { - echo ''."\n"; + echo ''."\n"; } } } @@ -3218,7 +3218,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'], @@ -3266,7 +3267,8 @@ . ''; } $this->bo->owner = $owner; - $this->so->owner = $owner; + $this->bo->so->owner = $owner; + $this->bo->so->open_box($owner); return $str.''."\n"; } @@ -3395,7 +3397,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( @@ -3417,7 +3419,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( @@ -3528,12 +3530,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( diff --git a/calendar/inc/class.uiicalendar.inc.php b/calendar/inc/class.uiicalendar.inc.php index 10134b9e8e..9508d207dd 100755 --- a/calendar/inc/class.uiicalendar.inc.php +++ b/calendar/inc/class.uiicalendar.inc.php @@ -17,7 +17,6 @@ class uiicalendar { var $bo; - var $datetime; var $template; var $public_functions = array( @@ -30,7 +29,6 @@ function uiicalendar() { $this->bo = CreateObject('calendar.boicalendar'); - $this->datetime = CreateObject('phpgwapi.datetime'); $this->template = $GLOBALS['phpgw']->template; }