当前位置: 首页>>代码示例>>PHP>>正文


PHP Date_Calc::NWeekdayOfMonth方法代码示例

本文整理汇总了PHP中Date_Calc::NWeekdayOfMonth方法的典型用法代码示例。如果您正苦于以下问题:PHP Date_Calc::NWeekdayOfMonth方法的具体用法?PHP Date_Calc::NWeekdayOfMonth怎么用?PHP Date_Calc::NWeekdayOfMonth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Date_Calc的用法示例。


在下文中一共展示了Date_Calc::NWeekdayOfMonth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: calculateEvents


//.........这里部分代码省略.........
            //  Sun,Mon,Tue,Wed,Thu,Fri,Sat
            //  Every N Months
            //==============================================================
            case REPEAT_ON:
                $rfreq = $event_recurrspec['event_repeat_on_freq'];
                $rnum = $event_recurrspec['event_repeat_on_num'];
                $rday = $event_recurrspec['event_repeat_on_day'];
                $exdate = $event_recurrspec['exdate'];
                // this attribute follows the iCalendar spec http://www.ietf.org/rfc/rfc2445.txt
                //==============================================================
                //  Populate - Enter data into the event array
                //==============================================================
                $nm = $esM;
                $ny = $esY;
                $nd = $esD;
                if (isset($event_recurrspec['rt2_pf_flag']) && $event_recurrspec['rt2_pf_flag']) {
                    $nd = 1;
                }
                // Added by epsdky 2016.
                // $nd will sometimes be 29, 30 or 31 and if used in the mktime functions
                // below a problem with overfow will occur so it is set to 1 to prevent this.
                // (for rt2 appointments set prior to fix it remains unchanged). This can be done
                // since $nd has no influence past the mktime functions - epsdky 2016.
                // make us current
                while ($ny < $cy) {
                    $occurance = date('Y-m-d', mktime(0, 0, 0, $nm + $rfreq, $nd, $ny));
                    list($ny, $nm, $nd) = explode('-', $occurance);
                }
                // populate the event array
                while ($ny <= $cy) {
                    $dnum = $rnum;
                    // get day event repeats on
                    do {
                        $occurance = Date_Calc::NWeekdayOfMonth($dnum--, $rday, $nm, $ny, $format = "%Y-%m-%d");
                    } while ($occurance === -1);
                    if (isset($days[$occurance]) && $occurance <= $stop) {
                        // check for date exceptions before pushing the event into the days array -- JRM
                        $excluded = false;
                        if (isset($exdate)) {
                            foreach (explode(",", $exdate) as $exception) {
                                // occurrance format == yyyy-mm-dd
                                // exception format == yyyymmdd
                                if (preg_replace("/-/", "", $occurance) == $exception) {
                                    $excluded = true;
                                }
                            }
                        }
                        // push event into the days array
                        if ($excluded == false) {
                            array_push($days[$occurance], $event);
                        }
                        if ($viewtype == "week") {
                            fillBlocks($occurance, $days);
                            //echo "for $occurance loading " . getBlockTime($eventS) . "<br /><br />";
                            $gbt = getBlockTime($eventS);
                            $days[$occurance]['blocks'][$gbt][$occurance][] = $event;
                        }
                    }
                    $occurance = date('Y-m-d', mktime(0, 0, 0, $nm + $rfreq, $nd, $ny));
                    list($ny, $nm, $nd) = explode('-', $occurance);
                }
                break;
            case REPEAT_DAYS:
                $rfreq = $event_recurrspec['event_repeat_freq'];
                $rtype = $event_recurrspec['event_repeat_freq_type'];
                $exdate = $event_recurrspec['exdate'];
开发者ID:bradymiller,项目名称:openemr,代码行数:67,代码来源:pnuserapi.php

示例2: fetchEvents


//.........这里部分代码省略.........
                while ($occurance < $from_date) {
                    $occurance =& __increment($nd, $nm, $ny, $rfreq, $rtype);
                    list($ny, $nm, $nd) = explode('-', $occurance);
                }
                while ($occurance <= $stopDate) {
                    $excluded = false;
                    if (isset($exdate)) {
                        foreach (explode(",", $exdate) as $exception) {
                            // occurrance format == yyyy-mm-dd
                            // exception format == yyyymmdd
                            if (preg_replace("/-/", "", $occurance) == $exception) {
                                $excluded = true;
                            }
                        }
                    }
                    if ($excluded == false) {
                        $event['pc_eventDate'] = $occurance;
                        $event['pc_endDate'] = '0000-00-00';
                        $events2[] = $event;
                        //////
                        if ($nextX) {
                            ++$incX;
                            if ($incX == $nextX) {
                                break;
                            }
                        }
                        //////
                    }
                    $occurance =& __increment($nd, $nm, $ny, $rfreq, $rtype);
                    list($ny, $nm, $nd) = explode('-', $occurance);
                }
                break;
                //////
            //////
            case '2':
                $event_recurrspec = @unserialize($event['pc_recurrspec']);
                $rfreq = $event_recurrspec['event_repeat_on_freq'];
                $rnum = $event_recurrspec['event_repeat_on_num'];
                $rday = $event_recurrspec['event_repeat_on_day'];
                $exdate = $event_recurrspec['exdate'];
                list($ny, $nm, $nd) = explode('-', $event['pc_eventDate']);
                if (isset($event_recurrspec['rt2_pf_flag']) && $event_recurrspec['rt2_pf_flag']) {
                    $nd = 1;
                }
                $occuranceYm = "{$ny}-{$nm}";
                // YYYY-mm
                $from_dateYm = substr($from_date, 0, 7);
                // YYYY-mm
                $stopDateYm = substr($stopDate, 0, 7);
                // YYYY-mm
                // $nd will sometimes be 29, 30 or 31 and if used in the mktime functions below
                // a problem with overflow will occur so it is set to 1 to avoid this (for rt2
                // appointments set prior to fix $nd remains unchanged). This can be done since
                // $nd has no influence past the mktime functions.
                while ($occuranceYm < $from_dateYm) {
                    $occuranceYmX = date('Y-m-d', mktime(0, 0, 0, $nm + $rfreq, $nd, $ny));
                    list($ny, $nm, $nd) = explode('-', $occuranceYmX);
                    $occuranceYm = "{$ny}-{$nm}";
                }
                while ($occuranceYm <= $stopDateYm) {
                    // (YYYY-mm)-dd
                    $dnum = $rnum;
                    do {
                        $occurance = Date_Calc::NWeekdayOfMonth($dnum--, $rday, $nm, $ny, $format = "%Y-%m-%d");
                    } while ($occurance === -1);
                    if ($occurance >= $from_date && $occurance <= $stopDate) {
                        $excluded = false;
                        if (isset($exdate)) {
                            foreach (explode(",", $exdate) as $exception) {
                                // occurrance format == yyyy-mm-dd
                                // exception format == yyyymmdd
                                if (preg_replace("/-/", "", $occurance) == $exception) {
                                    $excluded = true;
                                }
                            }
                        }
                        if ($excluded == false) {
                            $event['pc_eventDate'] = $occurance;
                            $event['pc_endDate'] = '0000-00-00';
                            $events2[] = $event;
                            //////
                            if ($nextX) {
                                ++$incX;
                                if ($incX == $nextX) {
                                    break;
                                }
                            }
                            //////
                        }
                    }
                    $occuranceYmX = date('Y-m-d', mktime(0, 0, 0, $nm + $rfreq, $nd, $ny));
                    list($ny, $nm, $nd) = explode('-', $occuranceYmX);
                    $occuranceYm = "{$ny}-{$nm}";
                }
                break;
        }
    }
    return $events2;
    ////////////////////// End of code inserted by epsdky
}
开发者ID:bradymiller,项目名称:openemr,代码行数:101,代码来源:appointments.inc.php

示例3: _buildHolidays

 /**
  * Build the internal arrays that contain data about holidays.
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     parent::_buildHolidays();
     /**
      * Method that returns the date of the nearest Monday to the specified date
      * 
      * @return Monday date closest to specified date
      * 
      */
     /**
      * New Year's Day and Day after New Year's Day
      * always observed on a working day (1..5)
      * always show New Year's Day regardless of day of week
      */
     $newYearsDay = new Date($this->_year . '-01-01');
     $dayAfterNewYearsDay = new Date($this->_year . '-01-02');
     $this->_addHoliday('newYearsDay', $newYearsDay, 'New Year\'s Day');
     if ($newYearsDay->getDayOfWeek() == 0) {
         $this->_addHoliday('dayAfterNewYearsDay', $this->_year . '-01-02', 'Day after New Year\'s Day');
         $this->_addHoliday('newYearsDayHoliday', $this->_year . '-01-03', 'New Year\'s Holiday');
     } elseif ($newYearsDay->getDayOfWeek() == 5) {
         $this->_addHoliday('dayAfterNewYearsDay', $this->_year . '-01-04', 'New Year\'s Holiday');
     } elseif ($newYearsDay->getDayOfWeek() == 6) {
         $this->_addHoliday('newYearsDayHoliday', $this->_year . '-01-03', 'New Year\'s Holiday');
         $this->_addHoliday('dayAfterNewYearsDay', $this->_year . '-01-04', 'New Year\'s Holiday');
     } else {
         $this->_addHoliday('dayAfterNewYearsDay', $dayAfterNewYearsDay, 'Day after New Year\'s Day');
     }
     /**
      * Waitangi Day
      * always observed on 6 February
      */
     $waitangiDay = new Date($this->_year . '-02-06');
     $this->_addHoliday('waitangiDay', $waitangiDay, 'Waitangi Day');
     /**
      * Easter
      */
     $easter = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $goodFridayDate = new Date($easter);
     $goodFridayDate = $this->_addDays($easter, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     $this->_addHoliday('easterMonday', $easter->getNextDay(), 'Easter Monday');
     /**
      * Anzac Day
      * always observed on 25 April
      * differs from Australia in that there is no working day lost if Anzac Day falls on a weekend
      */
     $anzacDay = new Date($this->_year . '-04-25');
     $this->_addHoliday('anzacDay', $anzacDay, 'Anzac Day');
     /**
      * The Queen's Birthday.
      * always observed on 1st Monday in June
      */
     $queensBirthday = Date_Calc::NWeekdayOfMonth(1, 1, 6, $this->_year);
     $this->_addHoliday('queensBirthday', $queensBirthday, "Queen\\'s Birthday");
     /**
      * Labour Day.
      * observed as 4th Monday in October
      */
     $labourDay = Date_Calc::NWeekdayOfMonth(4, 1, 10, $this->_year);
     $this->_addHoliday('labourDay', $labourDay, "Labour Day");
     /**
      * Christmas and Boxing days
      * always observed on a working day (1..5)
      * always show Christmas and Boxing days
      */
     $christmasDay = new Date($this->_year . '-12-25');
     $boxingDay = new Date($this->_year . '-12-26');
     $this->_addHoliday('christmasDay', $christmasDay, 'Christmas Day');
     $this->_addHoliday('boxingDay', $boxingDay, 'Boxing Day');
     if ($christmasDay->getDayOfWeek() == 0) {
         $this->_addHoliday('christmasDayHoliday', $this->_year . '-12-27', 'Christmas Day Holiday');
     } elseif ($christmasDay->getDayOfWeek() == 5) {
         $this->_addHoliday('boxingDayHoliday', $this->_year . '-12-28', 'Boxing Day Holiday');
     } elseif ($christmasDay->getDayOfWeek() == 6) {
         $this->_addHoliday('christmasDayHoliday', $this->_year . '-12-27', 'Christmas Day Holiday');
         $this->_addHoliday('boxingDayHoliday', $this->_year . '-12-28', 'Boxing Day Holiday');
     }
     /**
      * Regional anniversary calculations
      * http://www.dol.govt.nz/er/holidaysandleave/publicholidays/publicholidaydates/current.asp
      * ordered by date of observation
      * Note - where rule may be modified by proximity of Easter, this is NOT taken into account
      * 
      * Each of 8 regions can use common rule of nearest Monday
      * Southland 17 Jan
      * Wellington 22 Jan
      * Auckland 29 Jan
      * Nelson 1 Feb
      * Otago 23 Mar (some local variation)
      * Marlborough 1 Nov
      * Chatam Islands 30 Nov
      * Westland 1 Dec (some local variation)
//.........这里部分代码省略.........
开发者ID:Raithlin,项目名称:web2project-holiday,代码行数:101,代码来源:NewZealand.php

示例4: fetchEvents


//.........这里部分代码省略.........
                //////
            //////
            case '1':
                $event_recurrspec = @unserialize($event['pc_recurrspec']);
                $rfreq = $event_recurrspec['event_repeat_freq'];
                $rtype = $event_recurrspec['event_repeat_freq_type'];
                $exdate = $event_recurrspec['exdate'];
                list($ny, $nm, $nd) = explode('-', $event['pc_eventDate']);
                //        $occurance = Date_Calc::dateFormat($nd,$nm,$ny,'%Y-%m-%d');
                $occurance = $event['pc_eventDate'];
                while ($occurance < $from_date) {
                    $occurance =& __increment($nd, $nm, $ny, $rfreq, $rtype);
                    list($ny, $nm, $nd) = explode('-', $occurance);
                }
                while ($occurance <= $stopDate) {
                    $excluded = false;
                    if (isset($exdate)) {
                        foreach (explode(",", $exdate) as $exception) {
                            // occurrance format == yyyy-mm-dd
                            // exception format == yyyymmdd
                            if (preg_replace("/-/", "", $occurance) == $exception) {
                                $excluded = true;
                            }
                        }
                    }
                    if ($excluded == false) {
                        $event['pc_eventDate'] = $occurance;
                        $event['pc_endDate'] = '0000-00-00';
                        $events2[] = $event;
                        //////
                        if ($flagPSM) {
                            break;
                        }
                        //////
                    }
                    $occurance =& __increment($nd, $nm, $ny, $rfreq, $rtype);
                    list($ny, $nm, $nd) = explode('-', $occurance);
                }
                break;
                //////
            //////
            case '2':
                $event_recurrspec = @unserialize($event['pc_recurrspec']);
                $rfreq = $event_recurrspec['event_repeat_on_freq'];
                $rnum = $event_recurrspec['event_repeat_on_num'];
                $rday = $event_recurrspec['event_repeat_on_day'];
                $exdate = $event_recurrspec['exdate'];
                list($ny, $nm, $nd) = explode('-', $event['pc_eventDate']);
                $occuranceYm = "{$ny}-{$nm}";
                // YYYY-mm
                $from_dateYm = substr($from_date, 0, 7);
                // YYYY-mm
                $stopDateYm = substr($stopDate, 0, 7);
                // YYYY-mm
                // $nd will sometimes be 29, 30 or 31, and if used in mktime below, a problem
                // with overflow will occur ('01' should be plugged in to avoid this). We need
                // to mirror the calendar code which has this problem, so $nd has been used.
                while ($occuranceYm < $from_dateYm) {
                    $occuranceYmX = date('Y-m-d', mktime(0, 0, 0, $nm + $rfreq, $nd, $ny));
                    list($ny, $nm, $nd) = explode('-', $occuranceYmX);
                    $occuranceYm = "{$ny}-{$nm}";
                }
                while ($occuranceYm <= $stopDateYm) {
                    // (YYYY-mm)-dd
                    $dnum = $rnum;
                    do {
                        $occurance = Date_Calc::NWeekdayOfMonth($dnum--, $rday, $nm, $ny, $format = "%Y-%m-%d");
                    } while ($occurance === -1);
                    if ($occurance >= $from_date && $occurance <= $stopDate) {
                        $excluded = false;
                        if (isset($exdate)) {
                            foreach (explode(",", $exdate) as $exception) {
                                // occurrance format == yyyy-mm-dd
                                // exception format == yyyymmdd
                                if (preg_replace("/-/", "", $occurance) == $exception) {
                                    $excluded = true;
                                }
                            }
                        }
                        if ($excluded == false) {
                            $event['pc_eventDate'] = $occurance;
                            $event['pc_endDate'] = '0000-00-00';
                            $events2[] = $event;
                            //////
                            if ($flagPSM) {
                                break;
                            }
                            //////
                        }
                    }
                    $occuranceYmX = date('Y-m-d', mktime(0, 0, 0, $nm + $rfreq, $nd, $ny));
                    list($ny, $nm, $nd) = explode('-', $occuranceYmX);
                    $occuranceYm = "{$ny}-{$nm}";
                }
                break;
        }
    }
    return $events2;
    ////////////////////// End of code inserted by epsdky
}
开发者ID:hitechelp,项目名称:openemr,代码行数:101,代码来源:appointments.inc.php

示例5: MakeRecurrences

 public function MakeRecurrences()
 {
     global $_EV_CONF;
     $intervalA = $this->event->rec_data['interval'];
     if (!is_array($intervalA)) {
         $intervalA = array($intervalA);
     }
     if (!isset($this->event->rec_data['weekday'])) {
         // Missing day of week
         return $this->events;
     }
     $occurrence = $this->dt_start;
     list($y, $m, $d) = explode('-', $occurrence);
     $num_intervals = count($intervalA);
     $last_interval = $intervalA[$num_intervals - 1];
     $count = 0;
     // reduce the weekday number, since evlist uses Sun=1 while
     // Date_Calc uses Sun=0
     $datecalc_weekday = (int) $this->event->rec_data['weekday'] - 1;
     while ($occurrence <= $this->event->rec_data['stop'] && $occurrence >= '1971-01-01' && $count < $_EV_CONF['max_repeats']) {
         foreach ($intervalA as $interval) {
             $occurrence = Date_Calc::NWeekdayOfMonth((int) $interval, $datecalc_weekday, $m, $y, '%Y-%m-%d');
             // Skip any dates earlier than the starting date
             if ($occurrence < $this->dt_start) {
                 continue;
             }
             // If the new date goes past the end of month, and we're looking
             // for the last (5th) week, then re-adjust to use the 4th week.
             // If we already have a 4th, this will just overwrite it
             if ($occurrence == -1 && $interval == 5) {
                 $occurrence = Date_Calc::NWeekdayOfMonth(4, $datecalc_weekday, $m, $y, '%Y-%m-%d');
             }
             // Stop when we hit the stop date
             if ($occurrence > $this->event->rec_data['stop']) {
                 break;
             }
             // This occurrence is ok, save it
             $this->storeEvent($occurrence);
             $count++;
             list($y, $m, $d) = explode('-', $occurrence);
         }
         // foreach intervalA
         // We've gone through all the intervals this month, now
         // increment the month
         $m += $this->event->rec_data['freq'];
         if ($m > 12) {
             // Roll over to next year
             $y += 1;
             $m = $m - 12;
         }
     }
     // while not at stop date
     return $this->events;
 }
开发者ID:matrox66,项目名称:evlist,代码行数:54,代码来源:evRecur.class.php

示例6: compare

compare('20050113', Date_Calc::NWeekdayOfMonth('2', '4', '01', '2005'), 'NWeekdayOfMonth 241');
compare('20050114', Date_Calc::NWeekdayOfMonth('2', '5', '01', '2005'), 'NWeekdayOfMonth 251');
compare('20050131', Date_Calc::NWeekdayOfMonth('last', 1, 1, 2005), 'NWeekdayOfMonth l11');
compare('20050130', Date_Calc::NWeekdayOfMonth('last', 0, 1, 2005), 'NWeekdayOfMonth l01');
compare('20050129', Date_Calc::NWeekdayOfMonth('last', 6, 1, 2005), 'NWeekdayOfMonth l61');
compare('20050128', Date_Calc::NWeekdayOfMonth('last', 5, 1, 2005), 'NWeekdayOfMonth l51');
compare('20050127', Date_Calc::NWeekdayOfMonth('last', 4, 1, 2005), 'NWeekdayOfMonth l41');
compare('20050126', Date_Calc::NWeekdayOfMonth('last', 3, 1, 2005), 'NWeekdayOfMonth l31');
compare('20050125', Date_Calc::NWeekdayOfMonth('last', 2, 1, 2005), 'NWeekdayOfMonth l21');
compare('20050331', Date_Calc::NWeekdayOfMonth('last', 4, 3, 2005), 'NWeekdayOfMonth l43');
compare('20050330', Date_Calc::NWeekdayOfMonth('last', 3, 3, 2005), 'NWeekdayOfMonth l33');
compare('20050329', Date_Calc::NWeekdayOfMonth('last', 2, 3, 2005), 'NWeekdayOfMonth l23');
compare('20050328', Date_Calc::NWeekdayOfMonth('last', 1, 3, 2005), 'NWeekdayOfMonth l13');
compare('20050327', Date_Calc::NWeekdayOfMonth('last', 0, 3, 2005), 'NWeekdayOfMonth l03');
compare('20050326', Date_Calc::NWeekdayOfMonth('last', 6, 3, 2005), 'NWeekdayOfMonth l63');
compare('20050325', Date_Calc::NWeekdayOfMonth('last', 5, 3, 2005), 'NWeekdayOfMonth l53');
compare(false, Date_Calc::isValidDate(29, 2, 1900), 'isValidDate 1');
compare(true, Date_Calc::isValidDate(29, 2, 2000), 'isValidDate 2');
compare(true, Date_Calc::isValidDate('29', '02', '2000'), 'isValidDate 2 str');
compare(false, Date_Calc::isLeapYear(1900), 'isLeapYear 1');
compare(true, Date_Calc::isLeapYear(1996), 'isLeapYear 2');
compare(true, Date_Calc::isLeapYear(2000), 'isLeapYear 3');
compare(false, Date_Calc::isLeapYear(2001), 'isLeapYear 4');
compare(false, Date_Calc::isLeapYear('2001'), 'isLeapYear 4 str');
compare(false, Date_Calc::isFutureDate('22', '11', '2000'), 'isFutureDate 1 str');
compare(false, Date_Calc::isFutureDate(22, 11, 2000), 'isFutureDate 1');
compare(true, Date_Calc::isFutureDate(22, 11, date('Y') + 1), 'isFutureDate 2');
compare(false, Date_Calc::isPastDate(22, 11, date('Y') + 1), 'isPastDate 1');
compare(true, Date_Calc::isPastDate(22, 11, 2000), 'isPastDate 2');
compare(true, Date_Calc::isPastDate('22', '11', '2000'), 'isPastDate 2 str');
compare(10, Date_Calc::dateDiff(22, 11, 2000, 12, 11, 2000), 'dateDiff 1');
开发者ID:MagnusA,项目名称:Date,代码行数:31,代码来源:calc.php

示例7: postcalendar_upgrade


//.........这里部分代码省略.........
                        break;
                    case _EVENT_DAILY:
                        $recurrtype = REPEAT;
                        $recurrspec['event_repeat_freq'] = REPEAT_EVERY;
                        $recurrspec['event_repeat_freq_type'] = REPEAT_EVERY_DAY;
                        $recurrspec['event_repeat_on_num'] = 0;
                        $recurrspec['event_repeat_on_day'] = 0;
                        $recurrspec['event_repeat_on_freq'] = 0;
                        break;
                    case _EVENT_WEEKLY:
                        $recurrtype = REPEAT;
                        $recurrspec['event_repeat_freq'] = REPEAT_EVERY;
                        $recurrspec['event_repeat_freq_type'] = REPEAT_EVERY_WEEK;
                        $recurrspec['event_repeat_on_num'] = 0;
                        $recurrspec['event_repeat_on_day'] = 0;
                        $recurrspec['event_repeat_on_freq'] = 0;
                        break;
                    case _EVENT_MONTHLY:
                        if ($rfreq == _RECUR_SAME_DATE) {
                            $recurrtype = REPEAT;
                            $recurrspec['event_repeat_freq'] = REPEAT_EVERY;
                            $recurrspec['event_repeat_freq_type'] = REPEAT_EVERY_MONTH;
                            $recurrspec['event_repeat_on_num'] = 0;
                            $recurrspec['event_repeat_on_day'] = 0;
                            $recurrspec['event_repeat_on_freq'] = 0;
                        } elseif ($rfreq == _RECUR_SAME_DAY) {
                            $recurrtype = REPEAT_ON;
                            list($y, $m, $d) = explode('-', $eventdate);
                            $recurrspec['event_repeat_freq'] = 0;
                            $recurrspec['event_repeat_freq_type'] = 0;
                            // event day of week
                            $edow = Date_Calc::dayOfWeek($d, $m, $y);
                            // date of first event day of week
                            $firstDay = Date_Calc::NWeekdayOfMonth(1, $edow, $m, $y, '%Y-%m-%d');
                            // find difference between 1st day and event day
                            list($y2, $m2, $d2) = explode('-', $firstDay);
                            $diff = Date_Calc::dateDiff($d, $m, $y, $d2, $m2, $y2);
                            // assuming $diff is going to be a multiple of 7
                            if ($diff > 0) {
                                $diff /= 7;
                            }
                            if ($diff > REPEAT_ON_4TH) {
                                $diff = REPEAT_ON_LAST;
                            }
                            $recurrspec['event_repeat_on_num'] = $diff;
                            $recurrspec['event_repeat_on_day'] = $edow;
                            $recurrspec['event_repeat_on_freq'] = REPEAT_ON_MONTH;
                        }
                        break;
                    case _EVENT_YEARLY:
                        if ($rfreq == _RECUR_SAME_DATE) {
                            $recurrtype = REPEAT;
                            $recurrspec['event_repeat_freq'] = REPEAT_EVERY;
                            $recurrspec['event_repeat_freq_type'] = REPEAT_EVERY_YEAR;
                            $recurrspec['event_repeat_on_num'] = 0;
                            $recurrspec['event_repeat_on_day'] = 0;
                            $recurrspec['event_repeat_on_freq'] = 0;
                        } elseif ($rfreq == _RECUR_SAME_DAY) {
                            $recurrtype = REPEAT_ON;
                            list($y, $m, $d) = explode('-', $eventdate);
                            $recurrspec['event_repeat_freq'] = 0;
                            $recurrspec['event_repeat_freq_type'] = 0;
                            // event day of week
                            $edow = Date_Calc::dayOfWeek($d, $m, $y);
                            // date of first event day of week
                            $firstDay = Date_Calc::NWeekdayOfMonth(1, $edow, $m, $y, '%Y-%m-%d');
开发者ID:katopenzz,项目名称:openemr,代码行数:67,代码来源:pninit.php


注:本文中的Date_Calc::NWeekdayOfMonth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。