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 | |
parent | 7d565474b41400bfce2d665da96d39631458eda3 (diff) | |
download | phpicalendar-b8cc4f61ed18ee4bb8fcedb5a836e7bab9ecbbe4.tar.gz phpicalendar-b8cc4f61ed18ee4bb8fcedb5a836e7bab9ecbbe4.tar.bz2 phpicalendar-b8cc4f61ed18ee4bb8fcedb5a836e7bab9ecbbe4.zip |
expand search range;fix todo display
-rw-r--r-- | calendars/Home.ics | 4 | ||||
-rw-r--r-- | calendars/test.ics | 13 | ||||
-rw-r--r-- | config.inc.php | 3 | ||||
-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 | ||||
-rw-r--r-- | languages/english.inc.php | 3 | ||||
-rw-r--r-- | search.php | 1 | ||||
-rw-r--r-- | templates/default/search.tpl | 2 |
10 files changed, 125 insertions, 102 deletions
diff --git a/calendars/Home.ics b/calendars/Home.ics index 415089f..59697cd 100644 --- a/calendars/Home.ics +++ b/calendars/Home.ics @@ -88,6 +88,7 @@ UID:997316C8-92C7-11D7-A4A2-000A95690022 DTSTAMP:20021015T173308Z DTSTART;TZID=US/Pacific:20021015T103220 END:VTODO + BEGIN:VTODO SEQUENCE:2 DTSTAMP:20021016T174840Z @@ -97,15 +98,16 @@ UID:997318C6-92C7-11D7-A4A2-000A95690022 STATUS:COMPLETED DTSTART;TZID=US/Pacific:20021015T103220 END:VTODO + BEGIN:VTODO SEQUENCE:2 DTSTAMP:20021016T174842Z SUMMARY:zzz COMPLETED;TZID=US/Pacific:20021016T104842 UID:99731AB0-92C7-11D7-A4A2-000A95690022 -STATUS:COMPLETED DTSTART;TZID=US/Pacific:20021015T103220 END:VTODO + BEGIN:VEVENT SEQUENCE:9 DTSTAMP:20021016T175751Z diff --git a/calendars/test.ics b/calendars/test.ics index ea16a99..1b92d29 100644 --- a/calendars/test.ics +++ b/calendars/test.ics @@ -28,7 +28,7 @@ END:VTIMEZONE BEGIN:VEVENT
DTSTAMP:20070616T185152Z
UID:{e5d8825e-4189-5341-80c7-4ec2c9f54404}
-SUMMARY:Futsal
+SUMMARY:Futsal geändert geääääääääääääääääääändert geändert geändert
LOCATION:Jockvale E S\, 101 Malvern Dr\, Nepean\, K2J 2S8
DESCRIPTION: (613) 825-1224\, (613) 825-1219\nhttp://maps.google.com/maps?f=q&hl=en&q=101+Malvern+Dr\,+Nepean\,+K2J+2S8+canada&sll=45.460733\,-75.610657&sspn=0.062007\,0.144196&ie=UTF8&ll=45.285969\,-75.763178&spn=0.01555\,0.036049&z=15&om=1
CATEGORIES:Competition
@@ -39,4 +39,15 @@ DTSTART:20070621T003000Z DTEND:20070621T013000Z
END:VEVENT
+BEGIN:VEVENT
+SEQUENCE:7
+DTSTAMP:20020918T224617Z
+SUMMARY:Daily for 10 occurrences
+STATUS:CONFIRMED
+DURATION:PT1H30M
+DTSTART;TZID=US/Eastern:20100902T090000
+RRULE:FREQ=DAILY;COUNT=10
+END:VEVENT
+
+
END:VCALENDAR
diff --git a/config.inc.php b/config.inc.php index c4a80ca..4eb7eb2 100644 --- a/config.inc.php +++ b/config.inc.php @@ -11,8 +11,9 @@ $configs = array( # 'allow_admin' => 'yes', # 'allow_login' => 'yes', 'allow_preferences' => 'yes', -# 'show_search' => 'yes', + 'show_search' => 'yes', # 'show_todos' => 'no', + 'show_completed' => 'no', # 'timezone' => 'US/Central', 'timezone' => 'America/Bogota', # 'second_offset' => $secs, 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; } diff --git a/languages/english.inc.php b/languages/english.inc.php index 0194c88..1d9dd8a 100644 --- a/languages/english.inc.php +++ b/languages/english.inc.php @@ -59,6 +59,7 @@ $lang['l_rss_week_date '] = '%b %e'; // Lists just the day $lang['l_rss_month_date '] = '%b %e'; // Lists just the day $lang['l_rss_language'] = 'en-us'; $lang['l_search_took'] = 'Search took %s seconds'; +$lang['l_starting_on'] = 'Starting on '; $lang['l_recurring_event'] = 'Recurring event'; $lang['l_exception'] = 'Exception'; $lang['l_no_query'] = 'No query given'; @@ -68,7 +69,7 @@ $lang['l_select_lang'] = 'Select your default language'; $lang['l_select_cal'] = 'Select your default calendar'; $lang['l_select_view'] = 'Select your default view'; $lang['l_select_time'] = 'Select your default start time'; -$lang['l_select_endtime'] = 'Select your default end time'; +$lang['l_select_endtime'] = 'Select your default end time'; $lang['l_select_day'] = 'Select your default start day of week'; $lang['l_select_style'] = 'Select your default style'; $lang['l_set_prefs'] = 'Set preferences'; @@ -296,6 +296,7 @@ $page->replace_tags(array( 'formatted_search' => $formatted_search, 'l_results' => $lang['l_results'], 'l_query' => $lang['l_query'], + 'l_starting_on' => $lang['l_starting_on'], 'l_time' => $lang['l_time'], 'l_summary' => $lang['l_summary'], 'l_location' => $lang['l_location'], diff --git a/templates/default/search.tpl b/templates/default/search.tpl index dfb83e3..24fead7 100644 --- a/templates/default/search.tpl +++ b/templates/default/search.tpl @@ -30,7 +30,7 @@ <div style="padding: 10px;"> <div><p class="V12">{L_QUERY}: {FORMATTED_SEARCH}</p></div> <!-- switch results on --> - <font class="V12"><b><a class="ps3" href="day.php?cal={CAL}&getdate={KEY}">{DAYOFMONTH}</a></b></font><br /> + <font class="V12"><b><a class="ps3" href="day.php?cal={CAL}&getdate={KEY}">{L_STARTING_ON} {DAYOFMONTH}</a></b></font><br /> <div style="margin-left: 10px; margin-bottom: 10px;"> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> |