From 27b9ae4ee32d3da71bd699f33c00d2de2eee8744 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 17 Feb 2011 18:18:06 +0000 Subject: [PATCH] Add 2934day/date2934 placeholder to first entry inside day of week and daily tables. Only available inside the selected date range(s). --- calendar/inc/class.calendar_merge.inc.php | 28 +++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/calendar/inc/class.calendar_merge.inc.php b/calendar/inc/class.calendar_merge.inc.php index 188af87a27..c7de8ffb71 100644 --- a/calendar/inc/class.calendar_merge.inc.php +++ b/calendar/inc/class.calendar_merge.inc.php @@ -185,7 +185,7 @@ class calendar_merge extends bo_merge * * @param string $plugin (Monday-Sunday) * @param int/array date or date range - * @param int $n + * @param int $n Row number * @param string $repeat Text being repeated for each entry * @return array */ @@ -218,6 +218,14 @@ class calendar_merge extends bo_merge { $days[date('Ymd',$_date)][date('l',$event['start'])][] = $this->calendar_replacements($event); } + if(strpos($repeat, '$$day/date$$') !== false) { + $date_marker = array('$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day))); + if(!is_array($days[date('Ymd',$_date)][date('l',strtotime($day))])) { + $days[date('Ymd',$_date)][date('l',strtotime($day))] = array($date_marker); + } else { + $days[date('Ymd',$_date)][date('l',strtotime($day))][0] += $date_marker; + } + } } return $days[date('Ymd',$_date)][$plugin][0]; } @@ -228,11 +236,12 @@ class calendar_merge extends bo_merge * Can be either a particular date (2011-02-15) or a day of the month (15) * * @param string $plugin - * @param int $id - * @param int $n + * @param int $id ID for this record + * @param int $n Repeated row number + * @param string $repeat Text being repeated for each entry * @return array */ - public function day($plugin,$id,$n) + public function day($plugin,$id,$n,$repeat) { static $days; @@ -277,6 +286,14 @@ class calendar_merge extends bo_merge { $days[date('Ymd',$_date)][$plugin][] = $this->calendar_replacements($event); } + if(strpos($repeat, '$$day/date$$') !== false) { + $date_marker = array('$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day))); + if(!is_array($days[date('Ymd',$_date)][$plugin])) { + $days[date('Ymd',$_date)][$plugin] = array($date_marker); + } else { + $days[date('Ymd',$_date)][$plugin][0] += $date_marker; + } + } } return $days[date('Ymd',$_date)][$plugin][0]; } @@ -444,13 +461,14 @@ class calendar_merge extends bo_merge { echo '$$table/'.$day. '$$ ... $$endtable$$'; } - echo ''; + echo '
'; echo '"; foreach(self::$relative as $key => $value) { echo ''; } echo ''; echo '

'.lang('Daily tables').":

$$table/'.$value. '$$ ... $$endtable$$
$$table/day_n$$ ... $$endtable$$1 <= n <= 31
'; + echo '$$day/date$$'.lang('Date for the day of the week, available for the first entry inside each day of week or daily table inside the selected range.').''; echo '

'.lang('General fields:')."

"; foreach(array(