protected function getAllEvents($arrCalendars, $intStart, $intEnd)
	{
		if (!\is_array($arrCalendars))
		{
			return array();
		}

		$this->arrEvents = array();

		foreach ($arrCalendars as $id)
		{
			// Get the events of the current period
			$objEvents = CalendarEventsModel::findCurrentByPid($id, $intStart, $intEnd);

			if ($objEvents === null)
			{
				continue;
			}

			while ($objEvents->next())
			{
				$this->addEvent($objEvents, $objEvents->startTime, $objEvents->endTime, $intStart, $intEnd, $id);

				// Recurring events
				if ($objEvents->recurring)
				{
					$arrRepeat = StringUtil::deserialize($objEvents->repeatEach);

					if (!\is_array($arrRepeat) || !isset($arrRepeat['unit']) || !isset($arrRepeat['value']) || $arrRepeat['value'] < 1)
					{
						continue;
					}

					$count = 0;
					$intStartTime = $objEvents->startTime;
					$intEndTime = $objEvents->endTime;
					$strtotime = '+ ' . $arrRepeat['value'] . ' ' . $arrRepeat['unit'];

					while ($intEndTime < $intEnd)
					{
						if ($objEvents->recurrences > 0 && $count++ >= $objEvents->recurrences)
						{
							break;
						}

						$intStartTime = strtotime($strtotime, $intStartTime);
						$intEndTime = strtotime($strtotime, $intEndTime);

						// Stop if the upper boundary is reached (see #8445)
						if ($intStartTime === false || $intEndTime === false)
						{
							break;
						}

						// Skip events outside the scope
						if ($intEndTime < $intStart || $intStartTime > $intEnd)
						{
							continue;
						}

						$this->addEvent($objEvents, $intStartTime, $intEndTime, $intStart, $intEnd, $id);
					}
				}
			}
		}

		// Sort the array
		foreach (array_keys($this->arrEvents) as $key)
		{
			ksort($this->arrEvents[$key]);
		}

		// HOOK: modify the result set
		if (isset($GLOBALS['TL_HOOKS']['getAllEvents']) && \is_array($GLOBALS['TL_HOOKS']['getAllEvents']))
		{
			foreach ($GLOBALS['TL_HOOKS']['getAllEvents'] as $callback)
			{
				$this->import($callback[0]);
				$this->arrEvents = $this->{$callback[0]}->{$callback[1]}($this->arrEvents, $arrCalendars, $intStart, $intEnd, $this);
			}
		}

		return $this->arrEvents;
	}
protected function getAllEvents($arrCalendars, $intStart, $intEnd)
	{
		if (!\is_array($arrCalendars))
		{
			return array();
		}

		$this->arrEvents = array();

		foreach ($arrCalendars as $id)
		{
			
			$objEvents = CalendarEventsModel::findCurrentByPid($id, $intStart, $intEnd);

			if ($objEvents === null)
			{
				continue;
			}

			while ($objEvents->next())
			{
				$this->addEvent($objEvents, $objEvents->startTime, $objEvents->endTime, $intStart, $intEnd, $id);

				
				if ($objEvents->recurring)
				{
					$arrRepeat = StringUtil::deserialize($objEvents->repeatEach);

					if (!\is_array($arrRepeat) || !isset($arrRepeat['unit']) || !isset($arrRepeat['value']) || $arrRepeat['value'] < 1)
					{
						continue;
					}

					$count = 0;
					$intStartTime = $objEvents->startTime;
					$intEndTime = $objEvents->endTime;
					$strtotime = '+ ' . $arrRepeat['value'] . ' ' . $arrRepeat['unit'];

					while ($intEndTime < $intEnd)
					{
						if ($objEvents->recurrences > 0 && $count++ >= $objEvents->recurrences)
						{
							break;
						}

						$intStartTime = strtotime($strtotime, $intStartTime);
						$intEndTime = strtotime($strtotime, $intEndTime);

						
						if ($intStartTime === false || $intEndTime === false)
						{
							break;
						}

						
						if ($intEndTime < $intStart || $intStartTime > $intEnd)
						{
							continue;
						}

						$this->addEvent($objEvents, $intStartTime, $intEndTime, $intStart, $intEnd, $id);
					}
				}
			}
		}

		
		foreach (array_keys($this->arrEvents) as $key)
		{
			ksort($this->arrEvents[$key]);
		}

		
		if (isset($GLOBALS['TL_HOOKS']['getAllEvents']) && \is_array($GLOBALS['TL_HOOKS']['getAllEvents']))
		{
			foreach ($GLOBALS['TL_HOOKS']['getAllEvents'] as $callback)
			{
				$this->import($callback[0]);
				$this->arrEvents = $this->{$callback[0]}->{$callback[1]}($this->arrEvents, $arrCalendars, $intStart, $intEnd, $this);
			}
		}

		return $this->arrEvents;
	}
protected function getAllEvents ( $ arrCalendars , $ intStart , $ intEnd ) { if ( ! \ is_array ( $ arrCalendars ) ) { return array ( ) ; } $ this -> arrEvents = array ( ) ; foreach ( $ arrCalendars as $ id ) { // Get the events of the current period $ objEvents = CalendarEventsModel :: findCurrentByPid ( $ id , $ intStart , $ intEnd ) ; if ( $ objEvents === null ) { continue ; } while ( $ objEvents -> next ( ) ) { $ this -> addEvent ( $ objEvents , $ objEvents -> startTime , $ objEvents -> endTime , $ intStart , $ intEnd , $ id ) ; // Recurring events if ( $ objEvents -> recurring ) { $ arrRepeat = StringUtil :: deserialize ( $ objEvents -> repeatEach ) ; if ( ! \ is_array ( $ arrRepeat ) || ! isset ( $ arrRepeat [ 'unit' ] ) || ! isset ( $ arrRepeat [ 'value' ] ) || $ arrRepeat [ 'value' ] < 1 ) { continue ; } $ count = 0 ; $ intStartTime = $ objEvents -> startTime ; $ intEndTime = $ objEvents -> endTime ; $ strtotime = '+ ' . $ arrRepeat [ 'value' ] . ' ' . $ arrRepeat [ 'unit' ] ; while ( $ intEndTime < $ intEnd ) { if ( $ objEvents -> recurrences > 0 && $ count ++ >= $ objEvents -> recurrences ) { break ; } $ intStartTime = strtotime ( $ strtotime , $ intStartTime ) ; $ intEndTime = strtotime ( $ strtotime , $ intEndTime ) ; // Stop if the upper boundary is reached (see #8445) if ( $ intStartTime === false || $ intEndTime === false ) { break ; } // Skip events outside the scope if ( $ intEndTime < $ intStart || $ intStartTime > $ intEnd ) { continue ; } $ this -> addEvent ( $ objEvents , $ intStartTime , $ intEndTime , $ intStart , $ intEnd , $ id ) ; } } } } // Sort the array foreach ( array_keys ( $ this -> arrEvents ) as $ key ) { ksort ( $ this -> arrEvents [ $ key ] ) ; } // HOOK: modify the result set if ( isset ( $ GLOBALS [ 'TL_HOOKS' ] [ 'getAllEvents' ] ) && \ is_array ( $ GLOBALS [ 'TL_HOOKS' ] [ 'getAllEvents' ] ) ) { foreach ( $ GLOBALS [ 'TL_HOOKS' ] [ 'getAllEvents' ] as $ callback ) { $ this -> import ( $ callback [ 0 ] ) ; $ this -> arrEvents = $ this -> { $ callback [ 0 ] } -> { $ callback [ 1 ] } ( $ this -> arrEvents , $ arrCalendars , $ intStart , $ intEnd , $ this ) ; } } return $ this -> arrEvents ; }
Get all events of a certain period

@param array   $arrCalendars
@param integer $intStart
@param integer $intEnd

@return array
Get all events of a certain period