From: <cl...@us...> - 2003-09-15 06:28:54
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1:/tmp/cvs-serv719/functions Modified Files: ical_parser.php Log Message: Major changes in BYDAY monthly support, added new stuffs to readme and added new calendar to test and fix. Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** ical_parser.php 15 Sep 2003 03:18:24 -0000 1.97 --- ical_parser.php 15 Sep 2003 06:28:51 -0000 1.98 *************** *** 98,102 **** $beginning, $rrule_array, $start_of_vevent, $description, $valarm_description, $start_unixtime, $end_unixtime, ! $recurrence_id, $uid, $class, $location ); --- 98,102 ---- $beginning, $rrule_array, $start_of_vevent, $description, $valarm_description, $start_unixtime, $end_unixtime, ! $recurrence_id, $uid, $class, $location, $rrule ); *************** *** 432,436 **** $next_range_time = strtotime(date('Y-m-01', $next_range_time)); // month has two cases, either $bymonthday or $byday ! if (is_array($bymonthday)) { // loop through the days on which this event happens foreach($bymonthday as $day) { --- 432,436 ---- $next_range_time = strtotime(date('Y-m-01', $next_range_time)); // month has two cases, either $bymonthday or $byday ! if ((is_array($bymonthday)) && (!is_array($byday))) { // loop through the days on which this event happens foreach($bymonthday as $day) { *************** *** 446,463 **** // loop through the days on which this event happens foreach($byday as $day) { ! ereg ('([-\+]{0,1})([0-9]{1})([A-Z]{2})', $day, $byday_arr); $nth = $byday_arr[2]-1; $on_day = two2threeCharDays($byday_arr[3]); $on_day_num = two2threeCharDays($byday_arr[3],false); ! if ($byday_arr[1] == '-') { $last_day_tmp = date('t',$next_range_time); $next_range_time = strtotime(date('Y-m-'.$last_day_tmp, $next_range_time)); $last_tmp = (date('w',$next_range_time) == $on_day_num) ? '' : 'last '; $next_date_time = strtotime($last_tmp.$on_day.' -'.$nth.' week', $next_range_time); ! } else { $next_date_time = strtotime($on_day.' +'.$nth.' week', $next_range_time); } $next_date = date('Ymd', $next_date_time); ! $recur_data[] = $next_date_time; } } --- 446,478 ---- // loop through the days on which this event happens foreach($byday as $day) { ! ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); $nth = $byday_arr[2]-1; $on_day = two2threeCharDays($byday_arr[3]); $on_day_num = two2threeCharDays($byday_arr[3],false); ! if ((isset($byday_arr[1])) && ($byday_arr[1] == '-')) { $last_day_tmp = date('t',$next_range_time); $next_range_time = strtotime(date('Y-m-'.$last_day_tmp, $next_range_time)); $last_tmp = (date('w',$next_range_time) == $on_day_num) ? '' : 'last '; $next_date_time = strtotime($last_tmp.$on_day.' -'.$nth.' week', $next_range_time); ! } elseif (is_array($bymonthday)) { ! // This supports MONTHLY where BYDAY and BYMONTH are both set ! if (!isset($bymonth)) $bymonth = array(1,2,3,4,5,6,7,8,9,10,11,12); ! foreach($bymonthday as $day) { ! $year = date('Y', $next_range_time); ! $month = date('m', $next_range_time); ! if (checkdate($month,$day,$year)) { ! $next_date_time = mktime(0,0,0,$month,$day,$year); ! $daday = strtolower(strftime("%a", $next_date_time)); ! if ($daday == $on_day && in_array($month, $bymonth)) { ! $recur_data[] = $next_date_time; ! } ! } ! } ! } elseif (isset($byday_arr[1])) { $next_date_time = strtotime($on_day.' +'.$nth.' week', $next_range_time); + $recur_data[] = $next_date_time; } $next_date = date('Ymd', $next_date_time); ! //$recur_data[] = $next_date_time; } } *************** *** 470,474 **** $checkdate_time = mktime(0,0,0,$month,1,$year); foreach($byday as $day) { ! ereg ('([-\+]{0,1})([0-9]{1})([A-Z]{2})', $day, $byday_arr); $nth = $byday_arr[2]-1; $on_day = two2threeCharDays($byday_arr[3]); --- 485,489 ---- $checkdate_time = mktime(0,0,0,$month,1,$year); foreach($byday as $day) { ! ereg ('([-\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr); $nth = $byday_arr[2]-1; $on_day = two2threeCharDays($byday_arr[3]); *************** *** 955,967 **** //If you want to see the values in the arrays, uncomment below. ! /* ! print '<pre>'; ! print_r($master_array); ! print_r($overlap_array); //print_r($day_array); ! //print_r($rrule); //print_r($recurrence_delete); ! print '</pre>'; ! */ // Set a calender name for all calenders combined --- 970,981 ---- //If you want to see the values in the arrays, uncomment below. ! ! //print '<pre>'; ! //print_r($master_array); ! //print_r($overlap_array); //print_r($day_array); ! //print_r($rrule_array); //print_r($recurrence_delete); ! //print '</pre>'; // Set a calender name for all calenders combined |