diff options
author | Jim Hu <jimhu@users.sourceforge.net> | 2005-04-16 20:39:00 +0000 |
---|---|---|
committer | Jim Hu <jimhu@users.sourceforge.net> | 2005-04-16 20:39:00 +0000 |
commit | f0978df393ba890f8d2dd04e2f703cfcfd4441dd (patch) | |
tree | 74ee3816bfb33da546311a23d821c4ff8a2393cc /functions | |
parent | 9b60bae6928290d38a574a7269029484fab585d5 (diff) | |
download | phpicalendar-f0978df393ba890f8d2dd04e2f703cfcfd4441dd.tar.gz phpicalendar-f0978df393ba890f8d2dd04e2f703cfcfd4441dd.tar.bz2 phpicalendar-f0978df393ba890f8d2dd04e2f703cfcfd4441dd.zip |
enable exceptions. bug fixes
Diffstat (limited to 'functions')
-rw-r--r-- | functions/template.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/functions/template.php b/functions/template.php index 3b45cd9..a26ba2a 100644 --- a/functions/template.php +++ b/functions/template.php @@ -127,6 +127,8 @@ class Page { $loop_except = trim($match3[1]); $parse_month = date ("Ym", strtotime($getdate)); + if (isset($the_arr)){ + // Pull out each event foreach($the_arr as $key => $val) { @@ -156,11 +158,28 @@ class Page { if ($description == '') { $events_tmp = preg_replace('!<\!-- switch description_events on -->(.*)<\!-- switch description_events off -->!is', '', $events_tmp); } - if (!$val['exception']) { + if (!$val['exception'] || !isset($val['exceptions'])) { $events_tmp = preg_replace('!<\!-- switch exceptions on -->(.*)<\!-- switch exceptions off -->!is', '', $events_tmp); }else{ - foreach ($val['exception'] as $except_val){ - } + $some_exceptions = ""; + foreach ($val['exceptions'] as $except_val){ + $except_tmp = $loop_except; + $except_date = strtotime($except_val['date']); + $except_date = localizeDate ('%A, %B %e %Y', $except_date); + + $except_tmp = str_replace('{DAYOFMONTH}', $except_date, $except_tmp); + $except_tmp = str_replace('{EXCEPT_DESCRIPTION}', stripslashes(urldecode($except_val['event_text'])), $except_tmp); + if (!$except_val['recur']) { + $except_tmp = preg_replace('!<\!-- switch except_recur on -->(.*)<\!-- switch except_recur off -->!is', '', $except_tmp); + }else{ + $except_tmp = str_replace('{EXCEPT_RECUR}', $except_val['recur'], $except_tmp); + } + $some_exceptions .= $except_tmp; + + } + $events_tmp = preg_replace('!<\!-- switch exceptions on -->(.*)<\!-- switch exceptions off -->!is', $some_exceptions,$events_tmp ); + + } if (!$val['recur']) { @@ -181,7 +200,7 @@ class Page { unset ($day_tmp, $some_events); } - + } if ($events_found < 1) { $this->page = preg_replace('!<\!-- switch results on -->(.*)<\!-- switch results off -->!is', '', $this->page); } else { |