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 | |
parent | fed8bd8a84209a71224353fd37176f7f494e2f5d (diff) | |
download | phpicalendar-fc55d3e44a3792b991431059505d00248005c1fc.tar.gz phpicalendar-fc55d3e44a3792b991431059505d00248005c1fc.tar.bz2 phpicalendar-fc55d3e44a3792b991431059505d00248005c1fc.zip |
Initial wiring of vtodo.
-rw-r--r-- | day.php | 1 | ||||
-rw-r--r-- | functions/template.php | 62 | ||||
-rw-r--r-- | templates/default/sidebar.tpl | 6 |
3 files changed, 66 insertions, 3 deletions
@@ -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('<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); 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 @@ <!-- switch tomorrows_events off --> -<!-- switch todo on --> +<!-- switch vtodo on --> <table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder"> <tr> @@ -129,7 +129,7 @@ <td><img src="images/spacer.gif" width="2" height="1" border="0" alt="" /></td> <td><a class="psf" href="javascript:openTodoInfo('{VTODO_ARRAY}')"><font class="G10B"> {VTODO_TEXT}</font></a></td> </tr> - <!-- switch show_normal on --> + <!-- switch show_normal off --> </table> </div> </td> @@ -145,7 +145,7 @@ <img src="images/spacer.gif" width="1" height="10" alt=" " /><br /> -<!-- switch todo off --> +<!-- switch vtodo off --> {MONTH_SMALL|-1} <table width="100%" border="0" cellpadding="0" cellspacing="0"> |