diff options
author | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-26 08:26:31 +0000 |
---|---|---|
committer | Jim Hu <jimhu@users.sourceforge.net> | 2008-12-26 08:26:31 +0000 |
commit | b8cc4f61ed18ee4bb8fcedb5a836e7bab9ecbbe4 (patch) | |
tree | ab2d8af1f6fa3aadab110842f304d4bf7f6b5d5e /functions | |
parent | 7d565474b41400bfce2d665da96d39631458eda3 (diff) | |
download | phpicalendar-b8cc4f61ed18ee4bb8fcedb5a836e7bab9ecbbe4.tar.gz phpicalendar-b8cc4f61ed18ee4bb8fcedb5a836e7bab9ecbbe4.tar.bz2 phpicalendar-b8cc4f61ed18ee4bb8fcedb5a836e7bab9ecbbe4.zip |
expand search range;fix todo display
Diffstat (limited to 'functions')
-rw-r--r-- | functions/init/date_range.php | 4 | ||||
-rw-r--r-- | functions/parse/end_vevent.php | 1 | ||||
-rw-r--r-- | functions/parse/recur_functions.php | 22 | ||||
-rw-r--r-- | functions/template.php | 174 |
4 files changed, 104 insertions, 97 deletions
diff --git a/functions/init/date_range.php b/functions/init/date_range.php index a4579db..7a51b47 100644 --- a/functions/init/date_range.php +++ b/functions/init/date_range.php @@ -37,6 +37,10 @@ switch ($current_view){ $mArray_begin = time(); $mArray_end = time(); break; + case 'search': + $mArray_begin = mktime (0,0,0,1,1,1970); + $mArray_end = mktime (0,0,0,1,31,2030); + break; default: $mArray_begin = mktime (0,0,0,12,21,($this_year - 1)); $mArray_end = mktime (0,0,0,1,31,($this_year + 1)); diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php index 80e1ce9..4c5c352 100644 --- a/functions/parse/end_vevent.php +++ b/functions/parse/end_vevent.php @@ -253,6 +253,7 @@ one $next_range_time per repeat, but the BYXXX rules may write more than one eve $next_date_time handles those instances within a $freq_type */ #echo "<pre>$summary\n\tstart mArray time:".date("Ymd his",$mArray_begin)."\n\tnext_range_unixtime:".date("Ymd his",$next_range_unixtime)."\n\tend range time ".date("Ymd his",$end_range_unixtime)."\n"; $recur_data = array(); +if($current_view == 'search') $freq_type = 'none'; while ($next_range_unixtime <= $end_range_unixtime && $count > 0) { $year = date("Y", $next_range_unixtime); $month = date('m', $next_range_unixtime); diff --git a/functions/parse/recur_functions.php b/functions/parse/recur_functions.php index 2328e4b..8daa71d 100644 --- a/functions/parse/recur_functions.php +++ b/functions/parse/recur_functions.php @@ -10,19 +10,21 @@ We will use two kinds of functions - those that restrict the date to allowed val function add_recur($times,$freq=''){ global $recur_data; - global $count, $mArray_begin, $mArray_end, $except_dates, $start_date, $start_date_unixtime,$end_range_unixtime, $day_offset; + global $count, $mArray_begin, $mArray_end, $except_dates, $start_date, $start_date_unixtime,$end_range_unixtime, $day_offset, $current_view; if (!is_array($times)) $times = array($times); /* BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS */ #dump_times($times); - $times = restrict_bymonth($times,$freq); -# $times = restrict_byweekno($times,$freq); - $times = restrict_byyearday($times,$freq); - $times = restrict_bymonthday($times,$freq); - $times = restrict_byday($times,$freq); - if($start_date_unixtime > $mArray_begin) $times[] = $start_date_unixtime; - $times = restrict_bysetpos($times,$freq);#echo "restrict_bysetpos"; - $times = array_unique($times); - sort($times); + if ($current_view != 'search'){ + $times = restrict_bymonth($times,$freq); + # $times = restrict_byweekno($times,$freq); + $times = restrict_byyearday($times,$freq); + $times = restrict_bymonthday($times,$freq); + $times = restrict_byday($times,$freq); + if($start_date_unixtime > $mArray_begin) $times[] = $start_date_unixtime; + $times = restrict_bysetpos($times,$freq);#echo "restrict_bysetpos"; + $times = array_unique($times); + sort($times); + } $until_date = date("Ymd",$end_range_unixtime); foreach ($times as $time){ #echo "time:". date("Ymd",$time)."\n"; diff --git a/functions/template.php b/functions/template.php index 64c9818..4df442c 100644 --- a/functions/template.php +++ b/functions/template.php @@ -146,97 +146,95 @@ class Page { $parse_month = date ("Ym", strtotime($getdate)); if (isset($the_arr)){ + // Pull out each event + foreach($the_arr as $key => $val) { + $events_found++; + $dayofmonth = strtotime($val['date']); + $dayofmonth = localizeDate ('%A, %B %e %Y', $dayofmonth); + $events_tmp = $loop_event; + $recur_tmp = $loop_recur; + if ($val['event_text']) { + $event_text = stripslashes(urldecode($val['event_text'])); + $description = stripslashes(urldecode($val['description'])); + $location = stripslashes(urldecode($val['location'])); + $event_start = $val['event_start']; + $event_end = $val['event_end']; + if (isset($val['display_end'])) $event_end = $val['display_end']; + if (!$val['event_start']) { + $event_start = $lang['l_all_day']; + $event_start2 = ''; + $event_end = ''; + } else { + $event_start = date ($timeFormat, strtotime ($event_start)); + $event_end = date ($timeFormat, strtotime ($event_end)); + $event_start = $event_start .' - '.$event_end; + } + } + + if ($description == '') { + $events_tmp = preg_replace('!<\!-- switch description_events on -->(.*)<\!-- switch description_events off -->!Uis', '', $events_tmp); + } + if (!isset($val['exceptions'])) { + $events_tmp = preg_replace('!<\!-- switch exceptions on -->(.*)<\!-- switch exceptions off -->!Uis', '', $events_tmp); + }else{ + $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_event_start = date ($timeFormat, strtotime ($except_val['event_start'])); + $except_event_end = date ($timeFormat, strtotime ($except_val['event_end'])); + $except_event_start = $except_event_start .' - '.$except_event_end; + + $except_tmp = str_replace('{EVENT_START}', $except_event_start, $except_tmp); + + $except_event_text = stripslashes(urldecode($except_val['event_text'])); + $except_tmp = str_replace('{EVENT_TEXT}', $except_event_text, $except_tmp); + + #is there a recur in the exception? + if (!$except_val['recur']) { + $except_tmp = preg_replace('!<\!-- switch except_recur on -->(.*)<\!-- switch except_recur off -->!Uis', '', $except_tmp); + }else{ + $except_tmp = str_replace('{EXCEPT_RECUR}', $except_val['recur'], $except_tmp); + } + #is there a description in the exception? + if (!$except_val['description']) { + $except_tmp = preg_replace('!<\!-- switch except_description on -->(.*)<\!-- switch except_description off -->!Uis', '', $except_tmp); + }else{ + $except_description = stripslashes(urldecode($except_val['description'])); + $except_tmp = str_replace('{EXCEPT_DESCRIPTION}', $except_description, $except_tmp); + } + $some_exceptions .= $except_tmp; - // Pull out each event - foreach($the_arr as $key => $val) { - - $events_found++; - $dayofmonth = strtotime($val['date']); - $dayofmonth = localizeDate ('%A, %B %e %Y', $dayofmonth); - $events_tmp = $loop_event; - $recur_tmp = $loop_recur; - - if ($val['event_text']) { - $event_text = stripslashes(urldecode($val['event_text'])); - $description = stripslashes(urldecode($val['description'])); - $location = stripslashes(urldecode($val['location'])); - $event_start = $val['event_start']; - $event_end = $val['event_end']; - if (isset($val['display_end'])) $event_end = $val['display_end']; - if (!$val['event_start']) { - $event_start = $lang['l_all_day']; - $event_start2 = ''; - $event_end = ''; - } else { - $event_start = date ($timeFormat, strtotime ($event_start)); - $event_end = date ($timeFormat, strtotime ($event_end)); - $event_start = $event_start .' - '.$event_end; - } - } - - if ($description == '') { - $events_tmp = preg_replace('!<\!-- switch description_events on -->(.*)<\!-- switch description_events off -->!Uis', '', $events_tmp); - } - if (!isset($val['exceptions'])) { - $events_tmp = preg_replace('!<\!-- switch exceptions on -->(.*)<\!-- switch exceptions off -->!Uis', '', $events_tmp); - }else{ - $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_event_start = date ($timeFormat, strtotime ($except_val['event_start'])); - $except_event_end = date ($timeFormat, strtotime ($except_val['event_end'])); - $except_event_start = $except_event_start .' - '.$except_event_end; - - $except_tmp = str_replace('{EVENT_START}', $except_event_start, $except_tmp); - - $except_event_text = stripslashes(urldecode($except_val['event_text'])); - $except_tmp = str_replace('{EVENT_TEXT}', $except_event_text, $except_tmp); - - #is there a recur in the exception? - if (!$except_val['recur']) { - $except_tmp = preg_replace('!<\!-- switch except_recur on -->(.*)<\!-- switch except_recur off -->!Uis', '', $except_tmp); - }else{ - $except_tmp = str_replace('{EXCEPT_RECUR}', $except_val['recur'], $except_tmp); - } - #is there a description in the exception? - if (!$except_val['description']) { - $except_tmp = preg_replace('!<\!-- switch except_description on -->(.*)<\!-- switch except_description off -->!Uis', '', $except_tmp); - }else{ - $except_description = stripslashes(urldecode($except_val['description'])); - $except_tmp = str_replace('{EXCEPT_DESCRIPTION}', $except_description, $except_tmp); } - $some_exceptions .= $except_tmp; + $events_tmp = preg_replace('!<\!-- switch exceptions on -->(.*)<\!-- switch exceptions off -->!Uis', $some_exceptions,$events_tmp ); - } - $events_tmp = preg_replace('!<\!-- switch exceptions on -->(.*)<\!-- switch exceptions off -->!Uis', $some_exceptions,$events_tmp ); - - - } - - if (!$val['recur']) { - $events_tmp = preg_replace('!<\!-- switch recur on -->(.*)<\!-- switch recur off -->!Uis', '', $events_tmp); - }else{ - $events_tmp = str_replace('{RECUR}', $val['recur'], $events_tmp); - } - + + } + + if (!$val['recur']) { + $events_tmp = preg_replace('!<\!-- switch recur on -->(.*)<\!-- switch recur off -->!Uis', '', $events_tmp); + $events_tmp = str_replace('{L_STARTING_ON}', '', $events_tmp); + }else{ + $events_tmp = str_replace('{RECUR}', $val['recur'], $events_tmp); + } + $search = array('{EVENT_START}', '{EVENT_TEXT}', '{DESCRIPTION}','{LOCATION}'); $replace = array($event_start, $event_text, $description, $location); - $events_tmp = str_replace($search, $replace, $events_tmp); - $some_events .= $events_tmp; - $events_tmp = $loop_event; + $events_tmp = str_replace($search, $replace, $events_tmp); + $some_events .= $events_tmp; + $events_tmp = $loop_event; + - - $some_events = str_replace('{KEY}', $val['date'], $some_events); - $some_events = str_replace('{DAYOFMONTH}', $dayofmonth, $some_events); - $final .= $day_tmp.$some_events; - unset ($day_tmp, $some_events); - - } + $some_events = str_replace('{KEY}', $val['date'], $some_events); + $some_events = str_replace('{DAYOFMONTH}', $dayofmonth, $some_events); + $final .= $day_tmp.$some_events; + unset ($day_tmp, $some_events); + + } } if ($events_found < 1) { $this->page = preg_replace('!<\!-- switch results on -->(.*)<\!-- switch results off -->!Uis', '', $this->page); @@ -824,13 +822,15 @@ class Page { $todo_popup_data_index++; $vtodo_array = $todo; - $vtodo_text = word_wrap(strip_tags(str_replace('<br />',' ',$vtodo_text), '<b><i><u>'), 21, $tomorrows_events_lines); + $vtodo_text = word_wrap(strip_tags(str_replace('<br />',' ',$vtodo_text), '<b><i><u>'), 21, $phpiCal_config->tomorrows_events_lines); $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 ($status == 'COMPLETED' || ($val['completed_date'] !='' && $val['completed_time'] !='')) { if ($phpiCal_config->show_completed == 'yes') { $temp = $completed; } |