aboutsummaryrefslogtreecommitdiffstats
path: root/functions/parse
diff options
context:
space:
mode:
authorJim Hu <jimhu@users.sourceforge.net>2008-12-29 03:07:34 +0000
committerJim Hu <jimhu@users.sourceforge.net>2008-12-29 03:07:34 +0000
commit50ce9c8c7c7ac6b8c3137e84ec4da8a1bbe38a12 (patch)
treedb0b8b6315decf58289016c5472ed52fc7a9784f /functions/parse
parentcb7df8518466fe3a1e70df815dca056730cbbbc5 (diff)
downloadphpicalendar-50ce9c8c7c7ac6b8c3137e84ec4da8a1bbe38a12.tar.gz
phpicalendar-50ce9c8c7c7ac6b8c3137e84ec4da8a1bbe38a12.tar.bz2
phpicalendar-50ce9c8c7c7ac6b8c3137e84ec4da8a1bbe38a12.zip
change handling of multiday allday events in week view; other misc changes
Diffstat (limited to 'functions/parse')
-rw-r--r--functions/parse/end_vevent.php19
-rw-r--r--functions/parse/recur_functions.php5
2 files changed, 13 insertions, 11 deletions
diff --git a/functions/parse/end_vevent.php b/functions/parse/end_vevent.php
index 27f7bd3..ac909ff 100644
--- a/functions/parse/end_vevent.php
+++ b/functions/parse/end_vevent.php
@@ -124,9 +124,9 @@ foreach ($rrule_array as $key => $val) {
break;
case 'UNTIL':
# UNTIL must be in UTC
- $until = date("YmdHis",strtotime($val));
+ $until = date("YmdHis",strtotime($val));
ereg ('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs);
- $until_unixtime = mktime($regs[4],$regs[5],@$regs[6],$regs[2],$regs[3],$regs[1]);
+ $until_unixtime = mktime($regs[4],@$regs[5],@$regs[6],$regs[2],$regs[3],$regs[1]);
$recur_array[($start_date)][($hour.$minute)][$uid]['recur'][$key] = localizeDate($dateFormat_week,$until);
break;
case 'INTERVAL':
@@ -181,7 +181,8 @@ foreach ($rrule_array as $key => $val) {
$wkst3char = two2threeCharDays($wkst);
if($current_view == 'search') $freq_type = 'none';
# $recur is the recurrence info that goes into the master array for this VEVENT
-$recur = @$recur_array[($start_date)][($hour.$minute)][$uid]['recur'];
+$recur ='';
+if (isset($recur_array[($start_date)][($hour.$minute)][$uid]['recur'])) $recur = $recur_array[($start_date)][($hour.$minute)][$uid]['recur'];
/* ============================ Load $recur_data ============================
$recur_data is an array of unix times for days of recurrences of an event. This code handles repeats at the day level or above. The next loop handles the times.
@@ -214,7 +215,7 @@ if($count == 1000000 && $interval == 1 && $mArray_begin > $next_range_unixtime)
if ($next_range_unixtime < $start_date_unixtime) $next_range_unixtime = $start_date_unixtime;
# stop at the until limit if set
-if(isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime;
+if(isset($until) && $end_range_unixtime > $until_unixtime) $end_range_unixtime = $until_unixtime;else $until_unixtime = $mArray_end;
# more adjustments
switch ($freq_type){
@@ -257,10 +258,10 @@ while ($next_range_unixtime <= $end_range_unixtime && $count > 0) {
}
break;
case 'year':
- $times = expand_bymonth($time); #echo "exp bymonth";dump_times($times);
- $times = expand_byweekno($times); #echo "exp byweekno";dump_times($times);
- $times = expand_byyearday($times); #echo "exp byyearday";dump_times($times);
- $times = expand_bymonthday($times); #echo "\nexp bymonthday";dump_times($times);
+ $times = expand_bymonth($time); #echo "exp bymonth";dump_times($times);
+ $times = expand_byweekno($times); #echo "exp byweekno";dump_times($times);
+ $times = expand_byyearday($times); #echo "exp byyearday";dump_times($times);
+ $times = expand_bymonthday($times); #echo "\nexp bymonthday";dump_times($times);
foreach($times as $time){
add_recur(expand_byday($time));
}
@@ -319,7 +320,7 @@ foreach($recur_data as $recur_data_unixtime) {
# the day is not the last day of the recurrence
if ($this_date_tmp < $end_date_tmp) $display_end_tmp = '2400';
}
- if($this_date_tmp == $end_date_tmp && ($end_time == '0000' ||$time_key == -1)) continue;
+ if($this_date_tmp == $end_date_tmp && ($end_time == '0000' && $time_key == -1)) continue;
$master_array[$this_date_tmp][$time_key][$uid] = array (
'event_start' => $start_time, # hhmm
'event_end' => $end_time, # hhmm
diff --git a/functions/parse/recur_functions.php b/functions/parse/recur_functions.php
index e936c64..89d39b2 100644
--- a/functions/parse/recur_functions.php
+++ b/functions/parse/recur_functions.php
@@ -10,7 +10,7 @@ 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, $current_view;
+ global $count, $mArray_begin, $mArray_end, $except_dates, $start_date, $start_date_unixtime,$end_range_unixtime,$until_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);
@@ -27,7 +27,7 @@ function add_recur($times,$freq=''){
}
$until_date = date("Ymd",$end_range_unixtime);
foreach ($times as $time){
- #echo "time:". date("Ymd",$time)."\n";
+ #echo "time:". date("Ymd",$time)." $until_date<br>\n";
if (!isset($time) || $time == '') continue;
$date = date("Ymd",$time);
$time = strtotime("$date 12:00:00");
@@ -38,6 +38,7 @@ function add_recur($times,$freq=''){
&& $time != ''
&& !in_array($time, $recur_data)
&& !in_array($date, $except_dates)
+ && $time <= $until_unixtime
&& $time >= $start_date_unixtime
&& $date <= $until_date
){

© 2014-2024 Faster IT GmbH | imprint | privacy policy