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


PHP Tinebase_DateTime::isDate方法代码示例

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


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

示例1: _computeRecurMonthlyByMonthDay

 /**
  * computes monthly (bymonthday) recurring events and inserts them into given $_recurSet
  *
  * @param Calendar_Model_Event      $_event
  * @param Calendar_Model_Rrule      $_rrule
  * @param array                     $_exceptionRecurIds
  * @param Tinebase_DateTime                 $_from
  * @param Tinebase_DateTime                 $_until
  * @param Tinebase_Record_RecordSet $_recurSet
  * @return void
  */
 protected static function _computeRecurMonthlyByMonthDay($_event, $_rrule, $_exceptionRecurIds, $_from, $_until, $_recurSet)
 {
     $eventInOrganizerTZ = clone $_event;
     $eventInOrganizerTZ->setTimezone($_event->originator_tz);
     // some clients skip the monthday e.g. for yearly rrules
     if (!$_rrule->bymonthday) {
         $_rrule->bymonthday = $eventInOrganizerTZ->dtstart->format('j');
     }
     // NOTE: non existing dates will be discarded (e.g. 31. Feb.)
     //       for correct computations we deal with virtual dates, represented as arrays
     $computationStartDateArray = self::date2array($eventInOrganizerTZ->dtstart);
     // adopt startdate if rrule monthday != dtstart monthday
     // in this case, the first instance is not the base event!
     if ($_rrule->bymonthday != $computationStartDateArray['day']) {
         $computationStartDateArray['day'] = $_rrule->bymonthday;
         $computationStartDateArray = self::addMonthIgnoringDay($computationStartDateArray, -1 * $_rrule->interval);
     }
     $computationEndDate = $_event->rrule_until instanceof DateTime && $_until->isLater($_event->rrule_until) ? $_event->rrule_until : $_until;
     // if dtstart is before $_from, we compute the offset where to start our calculations
     if ($eventInOrganizerTZ->dtstart->isEarlier($_from)) {
         $computationOffsetMonth = self::getMonthDiff($eventInOrganizerTZ->dtend, $_from);
         // NOTE: $computationOffsetMonth must be multiple of interval!
         $computationOffsetMonth = floor($computationOffsetMonth / $_rrule->interval) * $_rrule->interval;
         $computationStartDateArray = self::addMonthIgnoringDay($computationStartDateArray, $computationOffsetMonth - $_rrule->interval);
     }
     $eventLength = $eventInOrganizerTZ->dtstart->diff($eventInOrganizerTZ->dtend);
     $originatorsOriginalDtstart = clone $eventInOrganizerTZ->dtstart;
     while (true) {
         $computationStartDateArray = self::addMonthIgnoringDay($computationStartDateArray, $_rrule->interval);
         $recurEvent = self::cloneEvent($eventInOrganizerTZ);
         $recurEvent->dtstart = self::array2date($computationStartDateArray, $eventInOrganizerTZ->originator_tz);
         // we calculate dtend from the event length, as events during a dst boundary could get dtend less than dtstart otherwise
         $recurEvent->dtend = clone $recurEvent->dtstart;
         $recurEvent->dtend->add($eventLength);
         $recurEvent->setTimezone('UTC');
         if ($computationEndDate->isEarlier($recurEvent->dtstart)) {
             break;
         }
         // skip non existing dates
         if (!Tinebase_DateTime::isDate(self::array2string($computationStartDateArray))) {
             continue;
         }
         // skip events ending before our period.
         // NOTE: such events could be included, cause our offset only calcs months and not seconds
         if ($_from->compare($recurEvent->dtend) >= 0) {
             continue;
         }
         $recurEvent->setRecurId($_event->getId());
         if (!in_array($recurEvent->recurid, $_exceptionRecurIds)) {
             self::addRecurrence($recurEvent, $_recurSet);
         }
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:64,代码来源:Rrule.php

示例2: getOriginalDtStart

 /**
  * returns the original dtstart of a recur series exception event 
  *  -> when the event should have started with no exception
  * 
  * @return Tinebase_DateTime
  */
 public function getOriginalDtStart()
 {
     $origianlDtStart = $this->dtstart instanceof stdClass ? clone $this->dtstart : $this->dtstart;
     if ($this->isRecurException()) {
         if ($this->recurid instanceof DateTime) {
             $origianlDtStart = clone $this->recurid;
         } else {
             if (is_string($this->recurid)) {
                 $origianlDtStartString = substr($this->recurid, -19);
                 if (!Tinebase_DateTime::isDate($origianlDtStartString)) {
                     throw new Tinebase_Exception_InvalidArgument('recurid does not contain a valid original start date');
                 }
                 $origianlDtStart = new Tinebase_DateTime($origianlDtStartString, 'UTC');
             }
         }
     }
     return $origianlDtStart;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:24,代码来源:Event.php


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