From fc55d3e44a3792b991431059505d00248005c1fc Mon Sep 17 00:00:00 2001 From: Chad Little Date: Fri, 6 Feb 2004 05:49:05 +0000 Subject: Initial wiring of vtodo. --- day.php | 1 + functions/template.php | 62 +++++++++++++++++++++++++++++++++++++++++++ templates/default/sidebar.tpl | 6 ++--- 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/day.php b/day.php index 6c602a4..c3fdfc5 100644 --- a/day.php +++ b/day.php @@ -66,6 +66,7 @@ $page->replace_tags(array( $page->draw_day($this->page); $page->tomorrows_events($this->page); +$page->get_vtodo($this->page); $page->output(); diff --git a/functions/template.php b/functions/template.php index 6781efc..b3a6c20 100644 --- a/functions/template.php +++ b/functions/template.php @@ -90,6 +90,68 @@ class Page { } } + function get_vtodo() { + global $template, $getdate, $master_array, $next_day, $timeFormat; + + preg_match("!<\!-- switch show_completed on -->(.*)<\!-- switch show_completed off -->!is", $this->page, $match1); + preg_match("!<\!-- switch show_important on -->(.*)<\!-- switch show_important off -->!is", $this->page, $match2); + preg_match("!<\!-- switch show_normal on -->(.*)<\!-- switch show_normal off -->!is", $this->page, $match3); + $completed = trim($match1[1]); + $important = trim($match2[1]); + $normal = trim($match3[1]); + $comp_data = ''; + $impt_data = ''; + $norm_data = ''; + + if (is_array($master_array['-2'])) { + foreach ($master_array['-2'] as $vtodo_times) { + foreach ($vtodo_times as $val) { + $vtodo_text = stripslashes(urldecode($val["vtodo_text"])); + if ($vtodo_text != "") { + if (isset($val["description"])) { + $description = urldecode($val["description"]); + } else { + $description = ""; + } + $completed_date = $val['completed_date']; + $event_calna = $val['calname']; + $status = $val["status"]; + $priority = $val['priority']; + $start_date = $val["start_date"]; + $due_date = $val['due_date']; + $vtodo_array = array( + 'cal' => $event_calna, + 'completed_date'=> $completed_date, + 'description' => $description, + 'due_date' => $due_date, + 'priority' => $priority, + 'start_date' => $start_date, + 'status' => $status, + 'vtodo_text' => $vtodo_text); + + $vtodo_array = base64_encode(serialize($vtodo_array)); + $vtodo_text = word_wrap(strip_tags(str_replace('
',' ',$vtodo_text), ''), 21, $tomorrows_events_lines); + $data = array ('{VTODO_TEXT}', '{VTODO_ARRAY}'); + $rep = array ($vtodo_text, $vtodo_array); + + if ($status == 'COMPLETED' || (isset($val['completed_date']) && isset($val['completed_time']))) { + if ($show_completed == 'yes') { + $temp = $completed; + } + } elseif (isset($val['priority']) && ($val['priority'] != 0) && ($val['priority'] <= 5)) { + $temp = $important; + } else { + $temp = $normal; + } + $nugget1 = str_replace($data, $rep, $temp); + $nugget2 .= $nugget1; + } + } + $this->page = ereg_replace('(.*)', $nugget2, $this->page); + } + } + } + function draw_month($template_p, $offset = '+0', $type) { global $template, $getdate, $master_array, $this_year, $this_month, $dateFormat_month, $week_start_day, $cal, $minical_view, $month_event_lines, $daysofweekreallyshort_lang, $daysofweekshort_lang, $daysofweek_lang, $timeFormat_small, $timeFormat; preg_match("!<\!-- loop weekday on -->(.*)<\!-- loop weekday off -->!is", $template_p, $match1); diff --git a/templates/default/sidebar.tpl b/templates/default/sidebar.tpl index 4f4f22a..48b3585 100644 --- a/templates/default/sidebar.tpl +++ b/templates/default/sidebar.tpl @@ -99,7 +99,7 @@ - + @@ -129,7 +129,7 @@ - +
{VTODO_TEXT}
@@ -145,7 +145,7 @@
- + {MONTH_SMALL|-1} -- cgit v1.2.3