diff options
author | Wesley Miaw <josuah@users.sourceforge.net> | 2004-05-14 22:36:52 +0000 |
---|---|---|
committer | Wesley Miaw <josuah@users.sourceforge.net> | 2004-05-14 22:36:52 +0000 |
commit | d5a212a132331202510071cca860532674acb3c8 (patch) | |
tree | 3c8cc07bd7bc6ca6724348e56375f53492cf7c60 | |
parent | 911d0baa7862a6e1e0c9129ab4177ff9712a319c (diff) | |
download | phpicalendar-d5a212a132331202510071cca860532674acb3c8.tar.gz phpicalendar-d5a212a132331202510071cca860532674acb3c8.tar.bz2 phpicalendar-d5a212a132331202510071cca860532674acb3c8.zip |
Fixed a bug where TODOs would be shown even if they did not fall into
one of the following categories:
1. Completed & flag to show completed is TRUE
2. Important
3. Normal
(i.e. Completed TODOs that showed up after parsing an important or
normal TODO would still be shown.)
Fixed a bug where if there are zero TODO items in the included
calendars, the TODO list would still be shown, with incorrect contents.
-rw-r--r-- | functions/template.php | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/functions/template.php b/functions/template.php index 481069d..f0e2352 100644 --- a/functions/template.php +++ b/functions/template.php @@ -565,6 +565,7 @@ class Page { $completed = trim($match1[1]); $important = trim($match2[1]); $normal = trim($match3[1]); + $nugget2 = ''; if (is_array($master_array['-2'])) { foreach ($master_array['-2'] as $vtodo_times) { @@ -597,6 +598,8 @@ class Page { $data = array ('{VTODO_TEXT}', '{VTODO_ARRAY}'); $rep = array ($vtodo_text, $vtodo_array); + // Reset this TODO's category. + $temp = ''; if ($status == 'COMPLETED' || (isset($val['completed_date']) && isset($val['completed_time']))) { if ($show_completed == 'yes') { $temp = $completed; @@ -606,13 +609,27 @@ class Page { } else { $temp = $normal; } - $nugget1 = str_replace($data, $rep, $temp); - $nugget2 .= $nugget1; + + // Do not include TODOs which do not have the + // category set. + if ($temp != '') { + $nugget1 = str_replace($data, $rep, $temp); + $nugget2 .= $nugget1; + } } } - $this->page = preg_replace('!<\!-- switch show_completed on -->(.*)<\!-- switch show_normal off -->!is', $nugget2, $this->page); } } + + // If there are no TODO items, completely hide the TODO list. + if ($nugget2 == '') { + $this->page = preg_replace('!<\!-- switch vtodo on -->(.*)<\!-- switch vtodo off -->!is', '', $this->page); + } + + // Otherwise display the list of TODOs. + else { + $this->page = preg_replace('!<\!-- switch show_completed on -->(.*)<\!-- switch show_normal off -->!is', $nugget2, $this->page); + } } function draw_month($template_p, $offset = '+0', $type) { @@ -869,4 +886,4 @@ class Page { print($this->page); } } -?>
\ No newline at end of file +?> |