/** * @param timestamp $lastTimestamp * @return next date timestamp or null if there is no other date */ public function getNextDate($lastTimestamp) { if ($this->getStartDate() != null && $this->getStartDate() > Gpf_Common_DateUtils::getDateTime(time())) { return null; } if ($this->getEndDate() != null && $this->getEndDate() < Gpf_Common_DateUtils::getDateTime(time())) { return null; } $recurrenceSetting = new Gpf_Db_RecurrenceSetting(); $recurrenceSetting->setRecurrencePresetId($this->getId()); $nextDate = 0; foreach ($recurrenceSetting->loadCollection() as $recurrenceSetting) { $setting = Gpf_Recurrence_Setting_Factory::getRecurrenceSetting($recurrenceSetting); $settingNextDate = $setting->getNextDate($lastTimestamp); if ($nextDate < $settingNextDate) { $nextDate = $settingNextDate; } } if ($nextDate == 0) { return null; } return $nextDate; }