From fc15b8f37cc873a54c1d2e19aff977afa1432363 Mon Sep 17 00:00:00 2001 From: skeeter Date: Tue, 28 Aug 2001 03:41:16 +0000 Subject: [PATCH] This takes advantage of the css() function. Also fixes a problem where if no calednar reference is specified, it will be set to 0. --- calendar/inc/class.bocalendar.inc.php | 2 +- calendar/inc/class.uicalendar.inc.php | 56 +++++++++++++++++++-------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index b5d6c3d116..919e1bf085 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/calendar/inc/class.bocalendar.inc.php @@ -417,7 +417,7 @@ $this->so->set_start($l_start['year'],$l_start['month'],$l_start['mday'],$l_start['hour'],$l_start['min'],0); $this->so->set_end($l_end['year'],$l_end['month'],$l_end['mday'],$l_end['hour'],$l_end['min'],0); $this->so->set_class($is_public); - $this->so->add_attribute('reference',$l_cal['reference']); + $this->so->add_attribute('reference',($l_cal['reference']?$l_cal['reference']:0)); if($l_cal['id']) { $this->so->add_attribute('id',$l_cal['id']); diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index c6de2aa338..5cbb4c30ad 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/calendar/inc/class.uicalendar.inc.php @@ -51,7 +51,8 @@ 'viewmatrix' => True, 'search' => True, 'header' => True, - 'footer' => True + 'footer' => True, + 'css' => True ); function uicalendar() @@ -73,7 +74,7 @@ $this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('calendar'); $this->cat = CreateObject('phpgwapi.categories'); - $this->holiday_color = (substr($this->theme['bg07'],0,1)=='#'?'':'#').$this->theme['bg07']; + $this->holiday_color = (substr($this->theme['bg06'],0,1)=='#'?'':'#').$this->theme['bg06']; $this->cat_id = $this->bo->cat_id; @@ -97,6 +98,14 @@ return; } + $this->bo->store_to_cache( + Array( + 'smonth' => $params['month'], + 'sday' => 1, + 'syear' => $params['year'] + ) + ); + $params['link'] = (!isset($params['link'])?'':$params['link']); $params['buttons'] = (!isset($params['buttons'])?'none':$params['buttons']); $params['outside_month'] = (!isset($params['outside_month'])?True:$params['outside_month']); @@ -1479,6 +1488,18 @@ unset($p); } + function css() + { + return 'A.minicalendar { color: #000000 }'."\n" + . ' A.bminicalendar { color: #336699; font-weight: bold; font-style: italic }'."\n" + . ' A.minicalendargrey { color: #999999 }'."\n" + . ' A.bminicalendargrey { color: #336699; font-weight: bold; font-style: italic }'."\n" + . ' A.minicalhol { color: #000000; background-color: '.$this->holiday_color.' }'."\n" + . ' A.bminicalhol { color: #336699; background-color: '.$this->holiday_color.'; font-weight: bold; font-style: italic }'."\n" + . ' A.minicalgreyhol { color: #999999; background-color: '.$this->holiday_color.' }'."\n" + . ' A.bminicalgreyhol { color: #999999; background-color: '.$this->holiday_color.'; font-weight: bold; font-style: italic }'."\n"; + } + function no_edit() { if(!$isset($GLOBALS['phpgw_info']['flags']['noheader'])) @@ -2975,6 +2996,19 @@ echo "set_week_array : Date : ".$date."
\n"; } + if($this->bo->cached_events[$date]) + { + if($this->debug) + { + echo "Date : ".$date." Appointments found : ".count($this->bo->cached_events[$date])."
\n"; + } + $appts = True; + } + else + { + $appts = False; + } + $holidays = $this->bo->cached_holidays[$date]; if($weekly) { @@ -2985,7 +3019,7 @@ if($holidays) { $extra = ' bgcolor="'.$this->bo->holiday_color.'"'; - $class = 'minicalhol'; + $class = ($appts?'b':'').'minicalhol'; if ($date == $this->bo->today) { $day_image = ' background="'.$GLOBALS['phpgw']->common->image('calendar','mini_day_block.gif').'"'; @@ -2994,12 +3028,12 @@ elseif ($date != $this->bo->today) { $extra = ' bgcolor="'.$cellcolor.'"'; - $class = 'minicalendar'; + $class = ($appts?'b':'').'minicalendar'; } else { $extra = ' bgcolor="'.$GLOBALS['phpgw_info']['theme']['cal_today'].'"'; - $class = 'minicalendar'; + $class = ($appts?'b':'').'minicalendar'; $day_image = ' background="'.$GLOBALS['phpgw']->common->image('calendar','mini_day_block.gif').'"'; } @@ -3024,18 +3058,6 @@ $holiday_name[] = $holidays[$k]['name']; } } - if($this->bo->cached_events[$date]) - { - if($this->debug) - { - echo "Date : ".$date." Appointments found : ".count($this->bo->cached_events[$date])."
\n"; - } - $appts = True; - } - else - { - $appts = False; - } $week = ''; if (!$j || ($j && substr($date,6,2) == '01')) {