diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index a4b5ab8ea0..c811c99d03 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/calendar/inc/class.bocalendar.inc.php @@ -510,79 +510,6 @@ } } - function preferences() - { - global $GLOBALS, $HTTP_POST_VARS; - - if ($HTTP_POST_VARS['submit']) - { - $GLOBALS['phpgw']->preferences->read_repository(); - $GLOBALS['phpgw']->preferences->add('calendar','weekdaystarts',$HTTP_POST_VARS['prefs']['weekdaystarts']); - $GLOBALS['phpgw']->preferences->add('calendar','workdaystarts',intval($HTTP_POST_VARS['prefs']['workdaystarts'])); - $GLOBALS['phpgw']->preferences->add('calendar','workdayends',intval($HTTP_POST_VARS['prefs']['workdayends'])); - $GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar',$HTTP_POST_VARS['prefs']['defaultcalendar']); - $GLOBALS['phpgw']->preferences->add('calendar','defaultfilter',$HTTP_POST_VARS['prefs']['defaultfilter']); - $GLOBALS['phpgw']->preferences->add('calendar','interval',intval($HTTP_POST_VARS['prefs']['interval'])); - if ($HTTP_POST_VARS['prefs']['mainscreen_showevents'] == True) - { - $GLOBALS['phpgw']->preferences->add('calendar','mainscreen_showevents',$HTTP_POST_VARS['prefs']['mainscreen_showevents']); - } - else - { - $GLOBALS['phpgw']->preferences->delete('calendar','mainscreen_showevents'); - } - if ($HTTP_POST_VARS['prefs']['send_updates'] == True) - { - $GLOBALS['phpgw']->preferences->add('calendar','send_updates',$HTTP_POST_VARS['prefs']['send_updates']); - } - else - { - $GLOBALS['phpgw']->preferences->delete('calendar','send_updates'); - } - - if ($HTTP_POST_VARS['prefs']['display_status'] == True) - { - $GLOBALS['phpgw']->preferences->add('calendar','display_status',$HTTP_POST_VARS['prefs']['display_status']); - } - else - { - $GLOBALS['phpgw']->preferences->delete('calendar','display_status'); - } - - if ($HTTP_POST_VARS['prefs']['default_private'] == True) - { - $GLOBALS['phpgw']->preferences->add('calendar','default_private',$HTTP_POST_VARS['prefs']['default_private']); - } - else - { - $GLOBALS['phpgw']->preferences->delete('calendar','default_private'); - } - - if ($HTTP_POST_VARS['prefs']['display_minicals'] == True) - { - $GLOBALS['phpgw']->preferences->add('calendar','display_minicals',$HTTP_POST_VARS['prefs']['display_minicals']); - } - else - { - $GLOBALS['phpgw']->preferences->delete('calendar','display_minicals'); - } - - if ($HTTP_POST_VARS['prefs']['print_black_white'] == True) - { - $GLOBALS['phpgw']->preferences->add('calendar','print_black_white',$HTTP_POST_VARS['prefs']['print_black_white']); - } - else - { - $GLOBALS['phpgw']->preferences->delete('calendar','print_black_white'); - } - - $GLOBALS['phpgw']->preferences->save_repository(True); - - Header('Location: '.$GLOBALS['phpgw']->link('/preferences/index.php')); - $GLOBALS['phpgw']->common->phpgw_exit(); - } - } - /* Private functions */ function read_holidays() { diff --git a/calendar/inc/class.bopreferences.inc.php b/calendar/inc/class.bopreferences.inc.php new file mode 100755 index 0000000000..bcaede9478 --- /dev/null +++ b/calendar/inc/class.bopreferences.inc.php @@ -0,0 +1,108 @@ + * + * http://www.radix.net/~cknudsen * + * Modified by Mark Peters * + * -------------------------------------------- * + * This program is free software; you can redistribute it and/or modify it * + * under the terms of the GNU General Public License as published by the * + * Free Software Foundation; either version 2 of the License, or (at your * + * option) any later version. * + \**************************************************************************/ + + /* $Id$ */ + + class bopreferences + { + var $public_functions = Array( + 'preferences' => True + ); + + var $prefs; + var $debug = False; + + function bopreferences() + { + global $GLOBALS; + + $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); + + $this->prefs['calendar'] = $GLOBALS['phpgw_info']['user']['preferences']['calendar']; + } + + function preferences() + { + global $GLOBALS, $HTTP_POST_VARS; + + if (isset($HTTP_POST_VARS['submit'])) + { + $GLOBALS['phpgw']->preferences->read_repository(); + $GLOBALS['phpgw']->preferences->add('calendar','weekdaystarts',$HTTP_POST_VARS['prefs']['weekdaystarts']); + $GLOBALS['phpgw']->preferences->add('calendar','workdaystarts',intval($HTTP_POST_VARS['prefs']['workdaystarts'])); + $GLOBALS['phpgw']->preferences->add('calendar','workdayends',intval($HTTP_POST_VARS['prefs']['workdayends'])); + $GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar',$HTTP_POST_VARS['prefs']['defaultcalendar']); + $GLOBALS['phpgw']->preferences->add('calendar','defaultfilter',$HTTP_POST_VARS['prefs']['defaultfilter']); + $GLOBALS['phpgw']->preferences->add('calendar','interval',intval($HTTP_POST_VARS['prefs']['interval'])); + if ($HTTP_POST_VARS['prefs']['mainscreen_showevents'] == True) + { + $GLOBALS['phpgw']->preferences->add('calendar','mainscreen_showevents',$HTTP_POST_VARS['prefs']['mainscreen_showevents']); + } + else + { + $GLOBALS['phpgw']->preferences->delete('calendar','mainscreen_showevents'); + } + if ($HTTP_POST_VARS['prefs']['send_updates'] == True) + { + $GLOBALS['phpgw']->preferences->add('calendar','send_updates',$HTTP_POST_VARS['prefs']['send_updates']); + } + else + { + $GLOBALS['phpgw']->preferences->delete('calendar','send_updates'); + } + + if ($HTTP_POST_VARS['prefs']['display_status'] == True) + { + $GLOBALS['phpgw']->preferences->add('calendar','display_status',$HTTP_POST_VARS['prefs']['display_status']); + } + else + { + $GLOBALS['phpgw']->preferences->delete('calendar','display_status'); + } + + if ($HTTP_POST_VARS['prefs']['default_private'] == True) + { + $GLOBALS['phpgw']->preferences->add('calendar','default_private',$HTTP_POST_VARS['prefs']['default_private']); + } + else + { + $GLOBALS['phpgw']->preferences->delete('calendar','default_private'); + } + + if ($HTTP_POST_VARS['prefs']['display_minicals'] == True) + { + $GLOBALS['phpgw']->preferences->add('calendar','display_minicals',$HTTP_POST_VARS['prefs']['display_minicals']); + } + else + { + $GLOBALS['phpgw']->preferences->delete('calendar','display_minicals'); + } + + if ($HTTP_POST_VARS['prefs']['print_black_white'] == True) + { + $GLOBALS['phpgw']->preferences->add('calendar','print_black_white',$HTTP_POST_VARS['prefs']['print_black_white']); + } + else + { + $GLOBALS['phpgw']->preferences->delete('calendar','print_black_white'); + } + + $GLOBALS['phpgw']->preferences->save_repository(True); + + Header('Location: '.$GLOBALS['phpgw']->link('/preferences/index.php')); + $GLOBALS['phpgw']->common->phpgw_exit(); + } + } + } + diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index bf5e5e667b..65b0a51433 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/calendar/inc/class.uicalendar.inc.php @@ -29,6 +29,8 @@ // var $debug = True; var $cat_id; + var $tz_offset; + var $theme; var $public_functions = array( 'mini_calendar' => True, @@ -57,20 +59,21 @@ global $GLOBALS; $GLOBALS['phpgw']->browser = CreateObject('phpgwapi.browser'); + $this->theme = $GLOBALS['phpgw_info']['theme']; $this->bo = CreateObject('calendar.bocalendar',1); + $this->tz_offset = $this->bo->datetime->tz_offset; if($this->debug) { echo "BO Owner : ".$this->bo->owner."
\n"; } - $this->template = $GLOBALS['phpgw']->template; $this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('calendar'); $this->cat = CreateObject('phpgwapi.categories'); - $this->holiday_color = (substr($GLOBALS['phpgw_info']['theme']['bg07'],0,1)=='#'?'':'#').$GLOBALS['phpgw_info']['theme']['bg07']; + $this->holiday_color = (substr($this->theme['bg07'],0,1)=='#'?'':'#').$this->theme['bg07']; $this->cat_id = $this->bo->cat_id; @@ -144,10 +147,10 @@ $var = Array( 'cal_img_root' => $GLOBALS['phpgw']->common->image('calendar','mini-calendar-bar.gif'), - 'bgcolor' => $GLOBALS['phpgw_info']['theme']['bg_color'], - 'bgcolor1' => $GLOBALS['phpgw_info']['theme']['bg_color'], + 'bgcolor' => $this->theme['bg_color'], + 'bgcolor1' => $this->theme['bg_color'], 'month' => $month, - 'bgcolor2' => $GLOBALS['phpgw_info']['theme']['cal_dayview'], + 'bgcolor2' => $this->theme['cal_dayview'], 'holiday_color' => $this->holiday_color ); @@ -295,7 +298,7 @@ $var = Array( 'printer_friendly' => $printer, - 'bg_text' => $GLOBALS['phpgw_info']['theme']['bg_text'], + 'bg_text' => $this->theme['bg_text'], 'small_calendar_prev' => $minical_prev, 'month_identifier' => lang(strftime("%B",$m)).' '.$this->bo->year, 'username' => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner), @@ -377,7 +380,7 @@ } else { - $printer = ''; + $printer = ''; $prev_week_link = '<<'; $next_week_link = '>>'; $print = ''; @@ -386,7 +389,7 @@ $var = Array( 'printer_friendly' => $printer, - 'bg_text' => $GLOBALS['phpgw_info']['theme']['bg_text'], + 'bg_text' => $this->theme['bg_text'], 'small_calendar_prev' => $minical_prev, 'prev_week_link' => $prev_week_link, 'small_calendar_this' => $minical_this, @@ -431,7 +434,7 @@ } else { - $print = ''; + $print = ''; $left_link = ''; $right_link = ''; $link = ''; @@ -442,7 +445,7 @@ $var = Array( 'print' => $print, 'left_link' => $left_link, - 'font' => $GLOBALS['phpgw_info']['theme']['font'], + 'font' => $this->theme['font'], 'year_text' => $this->bo->year, 'right_link'=> $right_link, 'printer_friendly'=> $printer @@ -668,134 +671,7 @@ $date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day); $cd = ''; } - Header('Location: '.$this->page('','&date'.$date.($cd?'&cd='.$cd:''))); - } - - function preferences() - { - global $GLOBALS; - - unset($GLOBALS['phpgw_info']['flags']['noheader']); - unset($GLOBALS['phpgw_info']['flags']['nonavbar']); - $GLOBALS['phpgw_info']['flags']['noappheader'] = True; - $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; - $GLOBALS['phpgw']->common->phpgw_header(); - - $p = CreateObject('phpgwapi.Template',$this->template_dir); - $p->set_file( - Array( - 'pref' =>'pref.tpl', - 'pref_colspan' =>'pref_colspan.tpl', - 'pref_list' =>'pref_list.tpl' - ) - ); - - $var = Array( - 'title' => lang('Calendar preferences'), - 'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.bocalendar.preferences'), - 'bg_color ' => $GLOBALS['phpgw_info']['theme']['th_bg'], - 'submit_lang' => lang('submit'), - 'text' => ' ' - ); - - $this->output_template_array($p,'row','pref_colspan',$var); - -// if ($totalerrors) -// { -// echo '

' . $phpgw->common->error_list($errors) . '
'; -// } - - $this->display_item($p,lang('show day view on main screen'),'bo->prefs['calendar']['mainscreen_showevents']?' checked':'').'>'); - - $days = Array( - 'Monday', - 'Sunday', - 'Saturday' - ); - $str = ''; - for($i=0;$ibo->prefs['calendar']['weekdaystarts']==$days[$i]?' selected':'').'>'.lang($days[$i]).''."\n"; - } - $this->display_item($p,lang('weekday starts on'),''."\n"); - - $str = ''; - for ($i=0; $i<24; $i++) - { - $str .= ''."\n"; - } - $this->display_item($p,lang('work day starts on'),''."\n"); - - $str = ''; - for ($i=0; $i<24; $i++) - { - $str .= ''; - } - $this->display_item($p,lang('work day ends on'),''."\n"); - - if(strpos('.',$this->bo->prefs['calendar']['defaultcalendar'])) - { - $temp = explode('.',$this->bo->prefs['calendar']['defaultcalendar']); - $this->bo->prefs['calendar']['defaultcalendar'] = $temp[0]; - } - $selected[$this->bo->prefs['calendar']['defaultcalendar']] = ' selected'; - if (!isset($this->bo->prefs['calendar']['defaultcalendar'])) - { - $selected['month'] = ' selected'; - } - $str = ''; - $this->display_item($p,lang('default calendar view'),$str); - - $selected = array(); - $selected[$this->bo->prefs['calendar']['defaultfilter']] = ' selected'; - if (!isset($this->bo->prefs['calendar']['defaultfilter']) || $this->bo->prefs['calendar']['defaultfilter'] == 'private') - { - $selected['private'] = ' selected'; - } - $str = ''; - $this->display_item($p,lang('Default calendar filter'),$str); - - $var = Array( - 5 => '5', - 10 => '10', - 15 => '15', - 20 => '20', - 30 => '30', - 45 => '45', - 60 => '60' - ); - - $str = ''; - while(list($key,$value) = each($var)) - { - $str .= ''."\n"; - } - $this->display_item($p,lang('Display interval in Day View'),''."\n"); - - $this->display_item($p,lang('Send/receive updates via email'),'bo->prefs['calendar']['send_updates']?' checked':'').'>'."\n"); - - $this->display_item($p,lang('Display status of events'),'bo->prefs['calendar']['display_status']?' checked':'').'>'."\n"); - - $this->display_item($p,lang('When creating new events default set to private'),'bo->prefs['calendar']['default_private']?' checked':'').'>'."\n"); - - $this->display_item($p,lang('Display mini calendars when printing'),'bo->prefs['calendar']['display_minicals']?' checked':'').'>'."\n"); - - $this->display_item($p,lang('Print calendars in black & white'),'bo->prefs['calendar']['print_black_white']?' checked':'').'>'."\n"); - - $p->pparse('out','pref'); + Header('Location: '.$this->page('','&date='.$date.($cd?'&cd='.$cd:''))); } function day() @@ -832,12 +708,12 @@ else { $GLOBALS['phpgw_info']['flags']['nofooter'] = True; - $printer = ''; + $printer = ''; $print = ''; } $now = $this->bo->datetime->makegmttime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year); - $now['raw'] += $this->bo->datetime->tz_offset; + $now['raw'] += $this->tz_offset; $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); $p = CreateObject('phpgwapi.Template',$this->template_dir); @@ -893,7 +769,7 @@ return; } - $freetime = $this->bo->datetime->localdates(mktime(0,0,0,$event['start']['month'],$event['start']['mday'],$event['start']['year']) - $this->bo->datetime->tz_offset); + $freetime = $this->bo->datetime->localdates(mktime(0,0,0,$event['start']['month'],$event['start']['mday'],$event['start']['year']) - $this->tz_offset); echo $this->timematrix( Array( 'date' => $freetime, @@ -948,9 +824,9 @@ 23 => 2 ); - $startdate = mktime(0,0,0,$this->bo->month,1,$this->bo->year) - $this->bo->datetime->tz_offset; + $startdate = mktime(0,0,0,$this->bo->month,1,$this->bo->year) - $this->tz_offset; $days = $this->bo->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->bo->datetime->tz_offset; + $enddate = mktime(23,59,59,$this->bo->month,$this->bo->days,$this->bo->year) - $this->tz_offset; $header[] = lang('Category'); for ($d = 1; $d <= $days; $d++) @@ -1095,7 +971,7 @@ } } } - $bgcolor = 'bgcolor="'.$GLOBALS['phpgw_info']['theme']['th_bg'].'"'; + $bgcolor = 'bgcolor="'.$this->theme['th_bg'].'"'; echo $html->table( array( '_h' => $header, @@ -1109,7 +985,7 @@ { global $GLOBALS; - $datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $this->bo->datetime->tz_offset; + $datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $this->tz_offset; $sb = CreateObject('phpgwapi.sbox'); @@ -1346,7 +1222,7 @@ { $event = $this->bo->read_entry($id); - $datetime = $this->bo->maketime($event['start']) - $this->bo->datetime->tz_offset; + $datetime = $this->bo->maketime($event['start']) - $this->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']); @@ -1369,8 +1245,7 @@ } else { - echo ''.lang('Error').':'; - echo lang('no matches found.'); + echo ''.lang('Error').':'.lang('no matches found.'); return; } @@ -1386,7 +1261,7 @@ $p->set_block('search_form','search_list_footer','search_list_footer'); $var = Array( - 'color' => $GLOBALS['phpgw_info']['theme']['bg_text'], + 'color' => $this->theme['bg_text'], 'search_text' => lang('Search Results'), 'quantity' => $quantity ); @@ -1447,19 +1322,6 @@ $p->parse($row,$list,True); } - function display_item(&$p,$field,$data) - { - global $GLOBALS; - static $tr_color; - $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); - $var = Array( - 'bg_color' => $tr_color, - 'field' => $field, - 'data' => $data - ); - $this->output_template_array($p,'row','pref_list',$var); - } - function page($page='',$params='') { global $GLOBALS; @@ -1529,8 +1391,7 @@ $m = $this->bo->month; $y = $this->bo->year; - $d_time = mktime(0,0,0,$m,1,$y); - $thisdate = date('Ymd',$d_time); + $thisdate = date('Ymd',mktime(0,0,0,$m,1,$y)); $y--; $str = ''; @@ -1543,7 +1404,8 @@ $y++; } $d = mktime(0,0,0,$m,1,$y); - $str .= ''."\n"; + $d_ymd = date('Ymd',$d); + $str .= ''."\n"; } $var = Array( @@ -1562,7 +1424,7 @@ $d = $this->bo->day; unset($thisdate); $thisdate = $this->bo->datetime->makegmttime(0,0,0,$m,$d,$y); - $sun = $this->bo->datetime->get_weekday_start($y,$m,$d) - $this->bo->datetime->tz_offset - 7200; + $sun = $this->bo->datetime->get_weekday_start($y,$m,$d) - $this->tz_offset - 7200; $str = ''; for ($i = -7; $i <= 7; $i++) @@ -1643,11 +1505,11 @@ $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->bo->datetime->tz_offset; - $endtime = $this->bo->maketime($event['end']) - $this->bo->datetime->tz_offset; + $starttime = $this->bo->maketime($event['start']) - $this->tz_offset; + $endtime = $this->bo->maketime($event['end']) - $this->tz_offset; $rawdate = mktime(0,0,0,$month,$day,$year); - $rawdate_offset = $rawdate - $this->bo->datetime->tz_offset; - $nextday = mktime(0,0,0,$month,$day + 1,$year) - $this->bo->datetime->tz_offset; + $rawdate_offset = $rawdate - $this->tz_offset; + $nextday = mktime(0,0,0,$month,$day + 1,$year) - $this->tz_offset; if (intval($GLOBALS['phpgw']->common->show_date($starttime,'Hi')) && $starttime == $endtime) { $time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); @@ -1669,7 +1531,7 @@ if($endtime >= ($rawdate_offset + 86400)) { - $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $this->bo->datetime->tz_offset,$this->bo->users_timeformat); + $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $this->tz_offset,$this->bo->users_timeformat); } else { @@ -1686,7 +1548,7 @@ { $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) { @@ -1772,8 +1634,8 @@ $mday = $event['start']['mday']; $year = $event['start']['year']; - $start = mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$mday,$year) - $this->bo->datetime->tz_offset; - $end = $this->bo->maketime($event['end']) - $this->bo->datetime->tz_offset; + $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; $overlap = ''; for($i=0;$i $GLOBALS['phpgw_info']['theme']['bg_text'], + 'color' => $this->theme['bg_text'], 'overlap_title' => lang('Scheduling Conflict'), 'overlap_text' => lang('Your suggested time of x - x conflicts with the following existing calendar entries:',$GLOBALS['phpgw']->common->show_date($start),$GLOBALS['phpgw']->common->show_date($end)), 'overlap_list' => $overlap @@ -1876,8 +1738,8 @@ $p->set_block('month_header','column_title','column_title'); $var = Array( - 'bgcolor' => $GLOBALS['phpgw_info']['theme']['th_bg'], - 'font_color' => $GLOBALS['phpgw_info']['theme']['th_text'] + 'bgcolor' => $this->theme['th_bg'], + 'font_color' => $this->theme['th_text'] ); if($this->bo->printer_friendly && @$this->bo->prefs['calendar']['print_black_white']) { @@ -1973,13 +1835,13 @@ $p->set_var($var); - if($day_params['holidays']) + if(@$day_params['holidays']) { reset($day_params['holidays']); while(list($key,$value) = each($day_params['holidays'])) { $var = Array( - 'day_events' => ''.$value.''.$GLOBALS['phpgw']->browser->br + 'day_events' => ''.$value.''.$GLOBALS['phpgw']->browser->br ); $this->output_template_array($p,'daily_events','event',$var); } @@ -1994,7 +1856,8 @@ ); $p->set_var($var); $rep_events = $this->bo->cached_events[$date]; - for ($k=0;$kset_var('day_events',$this->link_to_entry($lr_events,$month,$day,$year)); @@ -2058,7 +1921,7 @@ ); $this->output_template_array($p,'row','event',$var); - $cellcolor = $GLOBALS['phpgw_info']['theme']['row_on']; + $cellcolor = $this->theme['row_on']; for ($i=intval($start);intval(date('Ymd',$i)) <= $monthend;$i += 604800) { @@ -2082,7 +1945,7 @@ $year = substr($params['date'],0,4); $month = substr($params['date'],4,2); - $year = substr($params['date'],6,2); + $day = substr($params['date'],6,2); $showyear = $params['showyear']; $owners = $params['owners']; @@ -2099,7 +1962,7 @@ $start = $this->bo->datetime->get_weekday_start($year, $month, $day); - $cellcolor = $GLOBALS['phpgw_info']['theme']['row_off']; + $cellcolor = $this->theme['row_off']; $true_printer_friendly = $this->bo->printer_friendly; @@ -2178,7 +2041,7 @@ $p->set_block('view','list','list'); $var = Array( - 'bg_text'=> $GLOBALS['phpgw_info']['theme']['bg_text'], + 'bg_text'=> $this->theme['bg_text'], 'name' => $event->title ); $p->set_var($var); @@ -2206,12 +2069,12 @@ $var[] = Array( 'field' => lang('Start Date/Time'), - 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $this->bo->datetime->tz_offset) + 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $this->tz_offset) ); $var[] = Array( 'field' => lang('End Date/Time'), - 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $this->bo->datetime->tz_offset) + 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $this->tz_offset) ); $var[] = Array( @@ -2226,7 +2089,7 @@ $var[] = Array( 'field' => lang('Updated'), - 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['modtime']) - $this->bo->datetime->tz_offset) + 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['modtime']) - $this->tz_offset) ); $var[] = Array( @@ -2283,7 +2146,7 @@ $recur_end = $this->bo->maketime($event['recur_enddate']); if($recur_end != 0) { - $recur_end -= $this->bo->datetime->tz_offset; + $recur_end -= $this->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').' '; } } @@ -2357,28 +2220,23 @@ return $p->fp('out','view_event'); } - function print_day($param) + function print_day($params) { global $GLOBALS; - if(!is_array($param)) + if(!is_array($params)) { $this->index(); } - $year = $param['year']; - $month = $param['month']; - $day = $param['day']; - $this->bo->store_to_cache( Array( - 'syear' => $year, - 'smomth' => $month, - 'sday' => $day, - 'eyear' => $year, - 'emonth' => $month, -// 'eday' => $day + 7 - 'eday' => $day + 'syear' => $params['year'], + 'smomth' => $params['month'], + 'sday' => $params['day'], + 'eyear' => $params['year'], + 'emonth' => $params['month'], + 'eday' => $params['day'] ) ); @@ -2428,10 +2286,10 @@ } $var = Array( 'time_width' => $time_width, - 'time_bgcolor' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], - 'font_color' => $GLOBALS['phpgw_info']['theme']['bg_text'], - 'time_border_color' => $GLOBALS['phpgw_info']['theme']['navbar_text'], - 'font' => $GLOBALS['phpgw_info']['theme']['font'] + 'time_bgcolor' => $this->theme['navbar_bg'], + 'font_color' => $this->theme['bg_text'], + 'time_border_color' => $this->theme['navbar_text'], + 'font' => $this->theme['font'] ); $p->set_var($var); @@ -2445,11 +2303,11 @@ } } - $date_to_eval = sprintf("%04d%02d%02d",$year,$month,$day); + $date_to_eval = sprintf("%04d%02d%02d",$params['year'],$params['month'],$params['day']); $time = Array(); - $daily = $this->bo->set_week_array($this->bo->datetime->get_weekday_start($year, $month, $day),$GLOBALS['phpgw_info']['theme']['row_on'],True); + $daily = $this->bo->set_week_array($this->bo->datetime->get_weekday_start($params['year'],$params['month'],$params['day']),$this->theme['row_on'],True); if($this->debug) { echo "Date to Eval : ".$date_to_eval."
\n"; @@ -2467,20 +2325,20 @@ // $event = $events[$i]; if($events[$i]['recur_type'] == MCAL_RECUR_NONE) { - if($events[$i]['start']['mday'] < $day) + if($events[$i]['start']['mday'] < $params['day']) { - if($events[$i]['end']['mday'] > $day) + if($events[$i]['end']['mday'] > $params['day']) { $ind = 99; $interval_start = 0; } - elseif($events[$i]['end']['mday'] == $day) + elseif($events[$i]['end']['mday'] == $params['day']) { $ind = 0; $interval_start = 0; } } - elseif($events[$i]['start']['mday'] == $day) + elseif($events[$i]['start']['mday'] == $params['day']) { $ind = intval($events[$i]['start']['hour']); $interval_start = intval($events[$i]['start']['min'] / intval($this->bo->prefs['calendar']['interval'])); @@ -2503,7 +2361,7 @@ $interval_start = 0; } - $time[$ind][$interval_start] .= $this->link_to_entry($events[$i],$month,$day,$year); + $time[$ind][$interval_start] .= $this->link_to_entry($events[$i],$params['month'],$params['day'],$params['year']); $starttime = $this->bo->maketime($events[$i]['start']); $endtime = $this->bo->maketime($events[$i]['end']); @@ -2529,7 +2387,7 @@ } if($this->debug) { - echo 'Time : '.$GLOBALS['phpgw']->common->show_date($this->bo->maketime($events[$i]['start']) - $this->bo->datetime->tz_offset).' - '.$GLOBALS['phpgw']->common->show_date($this->bo->maketime($events[$i]['end']) - $this->bo->datetime->tz_offset).' : Start : '.$ind.' : Interval # : '.$interval_start."
\n"; + echo 'Time : '.$GLOBALS['phpgw']->common->show_date($this->bo->maketime($events[$i]['start']) - $this->tz_offset).' - '.$GLOBALS['phpgw']->common->show_date($this->bo->maketime($events[$i]['end']) - $this->tz_offset).' : Start : '.$ind.' : Interval # : '.$interval_start."
\n"; } } } @@ -2573,7 +2431,7 @@ } else { - $bgcolor = $GLOBALS['phpgw_info']['theme']['bg04']; + $bgcolor = $this->theme['bg04']; while(list($index,$name) = each($holiday_names)) { $time[99][0] = '
'.$name.'
'.$time[99][0]; @@ -2700,7 +2558,7 @@ . ' '.$GLOBALS['phpgw']->common->show_date($date['raw'],'d, Y').'
' . '' . '' - . ''; + . ''; for($i=0;$i<24;$i++) { for($j=0;$j<$interval;$j++) @@ -2724,12 +2582,12 @@ { $k .= substr(strval($i),strlen(strval($i)) - 1,1); } - $str .= ''; break; default: - $str .= ''; break; @@ -2746,7 +2604,7 @@ while(list($part,$status) = each($participants)) { $str .= '' - . ''; + . ''; $this->bo->cached_events = Array(); $this->bo->owner = $part; @@ -2768,7 +2626,7 @@ { for($k=0;$k<$interval;$k++) { - $str .= ''; + $str .= ''; } } } @@ -2784,13 +2642,13 @@ switch($time_slice[$index]['marker']) { case ' ': - $time_slice[$index]['color'] = $GLOBALS['phpgw_info']['theme']['bg_color']; + $time_slice[$index]['color'] = $this->theme['bg_color']; break; case '-': - $time_slice[$index]['color'] = $GLOBALS['phpgw_info']['theme']['bg01']; + $time_slice[$index]['color'] = $this->theme['bg01']; break; } - $str .= ''; + $str .= ''; } } } @@ -2870,10 +2728,10 @@ $p->set_block('edit','hr','hr'); $vars = Array( - 'font' => $GLOBALS['phpgw_info']['theme']['font'], - 'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_text'], + 'font' => $this->theme['font'], + 'bg_color' => $this->theme['bg_text'], 'calendar_action' => ($event['id']?lang('Calendar - Edit'):lang('Calendar - Add')), - 'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.bocalendar.update'), + 'action_url' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update')), 'common_hidden' => ''."\n" . ''."\n", 'errormsg' => ($params['cd']?$GLOBALS['phpgw']->common->check_code($params['cd']):'') @@ -2899,7 +2757,7 @@ ); // Date - $start = $this->bo->maketime($event['start']) - $this->bo->datetime->tz_offset; + $start = $this->bo->maketime($event['start']) - $this->tz_offset; $var[] = Array( 'field' => lang('Start Date'), 'data' => $GLOBALS['phpgw']->common->dateformatorder( @@ -2921,7 +2779,7 @@ ); // End Date - $end = $this->bo->maketime($event['end']) - $this->bo->datetime->tz_offset; + $end = $this->bo->maketime($event['end']) - $this->tz_offset; $var[] = Array( 'field' => lang('End Date'), 'data' => $GLOBALS['phpgw']->common->dateformatorder( @@ -3029,12 +2887,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->bo->datetime->tz_offset; + $recur_end = $this->bo->maketime($event['recur_enddate']) - $this->tz_offset; } else { $checked = ''; - $recur_end = $this->bo->maketime($event['start']) + 86400 - $this->bo->datetime->tz_offset; + $recur_end = $this->bo->maketime($event['start']) + 86400 - $this->tz_offset; } $var[] = Array( diff --git a/calendar/inc/class.uipreferences.inc.php b/calendar/inc/class.uipreferences.inc.php new file mode 100755 index 0000000000..a034b5c934 --- /dev/null +++ b/calendar/inc/class.uipreferences.inc.php @@ -0,0 +1,182 @@ + * + * http://www.radix.net/~cknudsen * + * Modified by Mark Peters * + * -------------------------------------------- * + * This program is free software; you can redistribute it and/or modify it * + * under the terms of the GNU General Public License as published by the * + * Free Software Foundation; either version 2 of the License, or (at your * + * option) any later version. * + \**************************************************************************/ + + /* $Id$ */ + + class uipreferences + { +// var $template_dir; + var $template; + + var $bo; + + var $debug = False; +// var $debug = True; + + var $theme; + + var $public_functions = array( + 'preferences' => True + ); + + function uipreferences() + { + global $GLOBALS; + + $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); + $this->template = $GLOBALS['phpgw']->template; + $this->theme = $GLOBALS['phpgw_info']['theme']; + $this->bo = CreateObject('calendar.bopreferences'); + } + + function preferences() + { + global $GLOBALS; + + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw_info']['flags']['noappheader'] = True; + $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; + $GLOBALS['phpgw']->common->phpgw_header(); + + $this->template->set_file( + Array( + 'pref' =>'pref.tpl', + 'pref_colspan' =>'pref_colspan.tpl', + 'pref_list' =>'pref_list.tpl' + ) + ); + + $var = Array( + 'title' => lang('Calendar preferences'), + 'action_url' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bopreferences.preferences')), + 'bg_color ' => $this->theme['th_bg'], + 'submit_lang' => lang('submit'), + 'text' => ' ' + ); + + $this->output_template_array('row','pref_colspan',$var); + + $this->display_item(lang('show day view on main screen'),'bo->prefs['calendar']['mainscreen_showevents']?' checked':'').'>'); + + $days = Array( + 'Monday', + 'Sunday', + 'Saturday' + ); + $str = ''; + for($i=0;$ibo->prefs['calendar']['weekdaystarts']==$days[$i]?' selected':'').'>'.lang($days[$i]).''."\n"; + } + $this->display_item(lang('weekday starts on'),''."\n"); + + $str = ''; + for ($i=0; $i<24; $i++) + { + $str .= ''."\n"; + } + $this->display_item(lang('work day starts on'),''."\n"); + + $str = ''; + for ($i=0; $i<24; $i++) + { + $str .= ''; + } + $this->display_item(lang('work day ends on'),''."\n"); + + if(strpos('.',$this->bo->prefs['calendar']['defaultcalendar'])) + { + $temp = explode('.',$this->bo->prefs['calendar']['defaultcalendar']); + $this->bo->prefs['calendar']['defaultcalendar'] = $temp[0]; + } + $selected[$this->bo->prefs['calendar']['defaultcalendar']] = ' selected'; + if (!isset($this->bo->prefs['calendar']['defaultcalendar'])) + { + $selected['month'] = ' selected'; + } + $str = ''; + $this->display_item(lang('default calendar view'),$str); + + $selected = array(); + $selected[$this->bo->prefs['calendar']['defaultfilter']] = ' selected'; + if (!isset($this->bo->prefs['calendar']['defaultfilter']) || $this->bo->prefs['calendar']['defaultfilter'] == 'private') + { + $selected['private'] = ' selected'; + } + $str = ''; + $this->display_item(lang('Default calendar filter'),$str); + + $var = Array( + 5 => '5', + 10 => '10', + 15 => '15', + 20 => '20', + 30 => '30', + 45 => '45', + 60 => '60' + ); + + $str = ''; + while(list($key,$value) = each($var)) + { + $str .= ''."\n"; + } + $this->display_item(lang('Display interval in Day View'),''."\n"); + + $this->display_item(lang('Send/receive updates via email'),'bo->prefs['calendar']['send_updates']?' checked':'').'>'."\n"); + + $this->display_item(lang('Display status of events'),'bo->prefs['calendar']['display_status']?' checked':'').'>'."\n"); + + $this->display_item(lang('When creating new events default set to private'),'bo->prefs['calendar']['default_private']?' checked':'').'>'."\n"); + + $this->display_item(lang('Display mini calendars when printing'),'bo->prefs['calendar']['display_minicals']?' checked':'').'>'."\n"); + + $this->display_item(lang('Print calendars in black & white'),'bo->prefs['calendar']['print_black_white']?' checked':'').'>'."\n"); + + $this->template->pparse('out','pref'); + } + + function output_template_array($row,$list,$var) + { + $this->template->set_var($var); + $this->template->parse($row,$list,True); + } + + function display_item($field,$data) + { + global $GLOBALS; + static $tr_color; + $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); + $var = Array( + 'bg_color' => $tr_color, + 'field' => $field, + 'data' => $data + ); + $this->output_template_array('row','pref_list',$var); + } + } diff --git a/calendar/inc/hook_home.inc.php b/calendar/inc/hook_home.inc.php index 0fb2bb38c6..c5cd9623dc 100755 --- a/calendar/inc/hook_home.inc.php +++ b/calendar/inc/hook_home.inc.php @@ -36,12 +36,16 @@ 'year' => $cal->bo->year, 'link' => 'day' ) - ).'
'.lang('Participant').'
'.lang('Participant').'' + $str .= '' . '" . $k.'' + $str .= '' . '" . ' 
'.$this->bo->get_fullname($part).''.$this->bo->get_fullname($part).'  ".''.$time_slice[$index]['marker'].'".''.$time_slice[$index]['marker'].'' - . '' - . '
' - . lang($phpgw->common->show_date(time()-((60*60)*intval($phpgw_info['user']['preferences']['common']['tz_offset'])),'F')).' '.$cal->bo->day.', '.$cal->bo->year.'
' - . $cal->print_day(Array('year'=>$cal->bo->year,'month'=>$cal->bo->month,'day'=>$cal->bo->day)).'
'."\n" - . "\n".'
'."\n"; + ).''.'' + . ''.'
.lang($phpgw->common->show_date(time()-((60*60)*intval($phpgw_info['user']['preferences']['common']['tz_offset'])),'F')) + .' '.$cal->bo->day.', '.$cal->bo->year.'
'.$cal->print_day( + Array( + 'year'=>$cal->bo->year, + 'month'=>$cal->bo->month, + 'day'=>$cal->bo->day + ) + ).'
'."\n"."\n".''."\n"; unset($cal); } ?> diff --git a/calendar/inc/hook_preferences.inc.php b/calendar/inc/hook_preferences.inc.php index 74b6ce9521..840139d88a 100644 --- a/calendar/inc/hook_preferences.inc.php +++ b/calendar/inc/hook_preferences.inc.php @@ -14,7 +14,11 @@ // Only Modify the $file and $title variables..... $title = $appname; $file = Array( - 'Calendar preferences' => $phpgw->link('/index.php','menuaction=calendar.uicalendar.preferences'), + 'Calendar preferences' => $phpgw->link('/index.php', + Array( + 'menuaction' => 'calendar.uipreferences.preferences' + ) + ), 'Grant Access' => $phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname), 'Edit Categories' => $phpgw->link('/preferences/categories.php','cats_app='.$appname.'&global_cats=True') );