diff options
author | Chad Little <clittle@users.sourceforge.net> | 2004-02-06 05:49:05 +0000 |
---|---|---|
committer | Chad Little <clittle@users.sourceforge.net> | 2004-02-06 05:49:05 +0000 |
commit | fc55d3e44a3792b991431059505d00248005c1fc (patch) | |
tree | e1ed4b74bb348e1fef573f8f1f5757118bc9f538 /functions | |
parent | fed8bd8a84209a71224353fd37176f7f494e2f5d (diff) | |
download | phpicalendar-fc55d3e44a3792b991431059505d00248005c1fc.tar.gz phpicalendar-fc55d3e44a3792b991431059505d00248005c1fc.tar.bz2 phpicalendar-fc55d3e44a3792b991431059505d00248005c1fc.zip |
Initial wiring of vtodo.
Diffstat (limited to 'functions')
-rw-r--r-- | functions/template.php | 62 |
1 files changed, 62 insertions, 0 deletions
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('<br>',' ',$vtodo_text), '<b><i><u>'), 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('<!-- switch show_completed on -->(.*)<!-- switch show_normal off -->', $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); |