From d0208328bc9665a0066dc83c3fcb7ef1cf19d7bf Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 20 Oct 2014 09:14:24 +0000 Subject: [PATCH] * Calendar: fixed planner by category view was showing all categories under "None" --- calendar/inc/class.calendar_uiviews.inc.php | 36 +++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/calendar/inc/class.calendar_uiviews.inc.php b/calendar/inc/class.calendar_uiviews.inc.php index 36f9a420e4..b9155c5d35 100644 --- a/calendar/inc/class.calendar_uiviews.inc.php +++ b/calendar/inc/class.calendar_uiviews.inc.php @@ -613,7 +613,7 @@ class calendar_uiviews extends calendar_ui if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date); $this->use_time_grid = !$this->cal_prefs['use_time_grid'] || $this->cal_prefs['use_time_grid'] == 'all'; // all views - + // Merge print if($weeks) { @@ -657,7 +657,7 @@ class calendar_uiviews extends calendar_ui $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; $navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; - + $days =& $this->bo->search(array( 'start' => $this->first, 'end' => $this->last, @@ -684,13 +684,13 @@ class calendar_uiviews extends calendar_ui $content .= $this->timeGridWidget($this->tagWholeDayOnTop($week),$weeks == 2 ? 30 : 60,200,'',$title,0,$week_start+WEEK_s >= $this->last); } - + $navHeader = '
' .html::a_href(html::image('phpgwapi','left',lang('previous'),$options=' alt="<<"'),array( 'menuaction' => $this->view_menuaction, 'date' => date('Ymd',strtotime("-".$weekNavH, $weeks? $this->first: $this->bo->date2ts($this->date))), )). ' '.$navHeader; - + $navHeader = $navHeader.' '.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array( 'menuaction' => $this->view_menuaction, 'date' => date('Ymd',strtotime("+".$weekNavH, $weeks? $this->first: $this->bo->date2ts($this->date))), @@ -813,7 +813,7 @@ class calendar_uiviews extends calendar_ui $this->last = strtotime("+$days days",$this->first) - 1; $GLOBALS['egw_info']['flags']['app_header'] .= ': '.lang('Four days view').' '.$this->bo->long_date($this->first,$this->last); $navHeader =lang('Four days view').' '.$this->bo->long_date($this->first,$this->last); - } + } else { $wd_start = $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); @@ -850,18 +850,18 @@ class calendar_uiviews extends calendar_ui # # $class = $class == 'row_on' ? 'th' : 'row_on'; //echo "

weekdaystarts='".$this->cal_prefs['weekdaystarts']."', get_weekday_start($this->year,$this->month,$this->day)=".date('l Y-m-d',$wd_start).", first=".date('l Y-m-d',$this->first)."

\n"; - + $navHeader = '
' .html::a_href(html::image('phpgwapi','left',lang('previous'),$options=' alt="<<"'),array( 'menuaction' => $this->view_menuaction, 'date' => date('Ymd',$this->first-$days*DAY_s), )). ''.$navHeader; - + $navHeader = $navHeader.''.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array( 'menuaction' => $this->view_menuaction, 'date' => date('Ymd',$this->last+$days*DAY_s), )).'
'; - + $merge = $this->merge(); if($merge) { @@ -898,12 +898,12 @@ class calendar_uiviews extends calendar_ui if (count($users) > $headerCounter) { $content .= $navHeader; - } + } } } - + $content = $navHeader.$content; - + if (!$home) { $this->do_header(); @@ -984,7 +984,7 @@ class calendar_uiviews extends calendar_ui unset($holidays); $cols[0] =& $this->timeGridWidget($this->tagWholeDayOnTop($dayEvents),$this->cal_prefs['interval'],450,'','',$owner); - + if (count($users) > 1) { $navHeader = '
' @@ -992,13 +992,13 @@ class calendar_uiviews extends calendar_ui 'menuaction' => $this->view_menuaction, 'date' => date('Ymd',$this->first-1), )). ''.$this->bo->long_date($this->first,0,false,true); - + $navHeader = $navHeader.''.html::a_href(html::image('phpgwapi','right',lang('next'),$options=' alt=">>"'),array( 'menuaction' => $this->view_menuaction, 'date' => date('Ymd',$this->last+1), )).'
'; } - + // only show todo's for a single user if (count($users) == 1 && ($todos = $this->get_todos($todo_label)) !== false) { @@ -1026,7 +1026,7 @@ class calendar_uiviews extends calendar_ui $cols[0] = $navHeader . $cols[0]; echo $cols[0]; } - + } else { @@ -1903,7 +1903,7 @@ class calendar_uiviews extends calendar_ui } // Helps client-side to bind handler to events with specific types tag $resizableHelper = $this->bo->date2string($event['start']). '|' .$this->bo->format_date($event['start'],false) . '|' . $this->cal_prefs['interval'].'|'.$eventTypeTag; - + $html = $indent.'
'.$prefix_icon."\n".$html."\n". @@ -2296,9 +2296,11 @@ class calendar_uiviews extends calendar_ui if (!is_array($cat2sort)) { $cat2sort = array(); + $cat_filter = $this->cat_id ? (array)$this->cat_id : array(); foreach((array)$this->categories->return_sorted_array(0,false,'','','',true) as $data) { - if (in_array($data['parent'], (array)$this->cat_id) || in_array($data['id'], (array)$this->cat_id)) // cat is a direct sub of $this->cat_id + if (in_array($data['parent'], $cat_filter) || in_array($data['id'], $cat_filter) || + !$data['parent'] && !$cat_filter) // cat is a direct sub of $this->cat_id { $cat2sort[$data['id']] = $data['id']; $sort2label[$data['id']] = stripslashes($data['name']);