EventBuilderFromGetList::getRecurringRule

  1. Bitrix24 API (v. 23.675.0)
  2. calendar
  3. EventBuilderFromGetList
  4. getRecurringRule
  • Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/core/builders/eventbuilderfromgetlist.php
  • Класс: BitrixCalendarCoreBuildersEventBuilderFromGetList
  • Вызов: EventBuilderFromGetList::getRecurringRule
protected function getRecurringRule(): ?EventPropertiesRecurringEventRules
{
	if (
		isset($this->fields['RRULE'])
		&& isset($this->fields['RRULE']['FREQ'])
		&& $this->fields['RRULE']['FREQ'] !== 'NONE'
	)
	{
		$rule = new EventPropertiesRecurringEventRules($this->fields['RRULE']['FREQ']);

		if (isset($this->fields['RRULE']['COUNT']))
		{
			$rule->setCount((int)$this->fields['RRULE']['COUNT']);
		}

		if (is_string($this->fields['RRULE']['UNTIL']))
		{
			$rule->setUntil($this->createDateForRecurrence($this->fields['RRULE']['UNTIL']));
		}

		if (isset($this->fields['RRULE']['INTERVAL']))
		{
			$rule->setInterval((int)$this->fields['RRULE']['INTERVAL']);
		}

		if (
			is_string($this->fields['RRULE']['BYDAY'])
			&& $this->fields['RRULE']['FREQ'] === EventPropertiesRecurringEventRules::FREQUENCY_WEEKLY
		)
		{
			$rule->setByDay(explode(",", $this->fields['RRULE']['BYDAY']));
		}
		elseif (
			is_array($this->fields['RRULE']['BYDAY'])
			&& $this->fields['RRULE']['FREQ'] === EventPropertiesRecurringEventRules::FREQUENCY_WEEKLY
		)
		{
			$rule->setByDay($this->fields['RRULE']['BYDAY']);
		}

		return $rule;
	}

	return null;
}

Добавить комментарий