protected function addEvent($objEvent, $intStart, $intEnd, $strUrl, $strBase='')
	{
		if ($intEnd < time()) // see #3917
		{
			return;
		}

		/** @var PageModel $objPage */
		global $objPage;

		// Called in the back end (see #4026)
		if ($objPage === null)
		{
			$objPage = new \stdClass();
			$objPage->dateFormat = Config::get('dateFormat');
			$objPage->datimFormat = Config::get('datimFormat');
			$objPage->timeFormat = Config::get('timeFormat');
		}

		$intKey = date('Ymd', $intStart);
		$span = self::calculateSpan($intStart, $intEnd);
		$format = $objEvent->addTime ? 'datimFormat' : 'dateFormat';

		// Add date
		if ($span > 0)
		{
			$title = Date::parse($objPage->$format, $intStart) . $GLOBALS['TL_LANG']['MSC']['cal_timeSeparator'] . Date::parse($objPage->$format, $intEnd);
		}
		else
		{
			$title = Date::parse($objPage->dateFormat, $intStart) . ($objEvent->addTime ? ' (' . Date::parse($objPage->timeFormat, $intStart) . (($intStart < $intEnd) ? $GLOBALS['TL_LANG']['MSC']['cal_timeSeparator'] . Date::parse($objPage->timeFormat, $intEnd) : '') . ')' : '');
		}

		// Add title and link
		$title .= ' ' . $objEvent->title;

		// Backwards compatibility (see #8329)
		if ($strBase != '' && !preg_match('#^https?://#', $strUrl))
		{
			$strUrl = $strBase . $strUrl;
		}

		$link = '';

		switch ($objEvent->source)
		{
			case 'external':
				$link = $objEvent->url;
				break;

			case 'internal':
				if (($objTarget = $objEvent->getRelated('jumpTo')) instanceof PageModel)
				{
					/** @var PageModel $objTarget */
					$link = $objTarget->getAbsoluteUrl();
				}
				break;

			case 'article':
				if (($objArticle = ArticleModel::findByPk($objEvent->articleId)) instanceof ArticleModel && ($objPid = $objArticle->getRelated('pid')) instanceof PageModel)
				{
					/** @var PageModel $objPid */
					$link = ampersand($objPid->getAbsoluteUrl('/articles/' . ($objArticle->alias ?: $objArticle->id)));
				}
				break;

			default:
				$link = sprintf(preg_replace('/%(?!s)/', '%%', $strUrl), ($objEvent->alias ?: $objEvent->id));
				break;
		}

		// Store the whole row (see #5085)
		$arrEvent = $objEvent->row();

		// Override link and title
		$arrEvent['link'] = $link;
		$arrEvent['title'] = $title;

		// Clean the RTE output
		$arrEvent['teaser'] = StringUtil::toHtml5($objEvent->teaser);

		// Reset the enclosures (see #5685)
		$arrEvent['enclosure'] = array();
		$arrEvent['media:content'] = array();

		// Add the article image as enclosure
		if ($objEvent->addImage)
		{
			$objFile = FilesModel::findByUuid($objEvent->singleSRC);

			if ($objFile !== null)
			{
				$arrEvent['media:content'][] = $objFile->path;
			}
		}

		// Enclosures
		if ($objEvent->addEnclosure)
		{
			$arrEnclosure = StringUtil::deserialize($objEvent->enclosure, true);

			if (\is_array($arrEnclosure))
			{
				$objFile = FilesModel::findMultipleByUuids($arrEnclosure);

				if ($objFile !== null)
				{
					while ($objFile->next())
					{
						$arrEvent['enclosure'][] = $objFile->path;
					}
				}
			}
		}

		$this->arrEvents[$intKey][$intStart][] = $arrEvent;
	}
protected function addEvent($objEvent, $intStart, $intEnd, $strUrl, $strBase='')
	{
		if ($intEnd < time()) 
		{
			return;
		}

		
		global $objPage;

		
		if ($objPage === null)
		{
			$objPage = new \stdClass();
			$objPage->dateFormat = Config::get('dateFormat');
			$objPage->datimFormat = Config::get('datimFormat');
			$objPage->timeFormat = Config::get('timeFormat');
		}

		$intKey = date('Ymd', $intStart);
		$span = self::calculateSpan($intStart, $intEnd);
		$format = $objEvent->addTime ? 'datimFormat' : 'dateFormat';

		
		if ($span > 0)
		{
			$title = Date::parse($objPage->$format, $intStart) . $GLOBALS['TL_LANG']['MSC']['cal_timeSeparator'] . Date::parse($objPage->$format, $intEnd);
		}
		else
		{
			$title = Date::parse($objPage->dateFormat, $intStart) . ($objEvent->addTime ? ' (' . Date::parse($objPage->timeFormat, $intStart) . (($intStart < $intEnd) ? $GLOBALS['TL_LANG']['MSC']['cal_timeSeparator'] . Date::parse($objPage->timeFormat, $intEnd) : '') . ')' : '');
		}

		
		$title .= ' ' . $objEvent->title;

		
		if ($strBase != '' && !preg_match('
		{
			$strUrl = $strBase . $strUrl;
		}

		$link = '';

		switch ($objEvent->source)
		{
			case 'external':
				$link = $objEvent->url;
				break;

			case 'internal':
				if (($objTarget = $objEvent->getRelated('jumpTo')) instanceof PageModel)
				{
					
					$link = $objTarget->getAbsoluteUrl();
				}
				break;

			case 'article':
				if (($objArticle = ArticleModel::findByPk($objEvent->articleId)) instanceof ArticleModel && ($objPid = $objArticle->getRelated('pid')) instanceof PageModel)
				{
					
					$link = ampersand($objPid->getAbsoluteUrl('/articles/' . ($objArticle->alias ?: $objArticle->id)));
				}
				break;

			default:
				$link = sprintf(preg_replace('/%(?!s)/', '%%', $strUrl), ($objEvent->alias ?: $objEvent->id));
				break;
		}

		
		$arrEvent = $objEvent->row();

		
		$arrEvent['link'] = $link;
		$arrEvent['title'] = $title;

		
		$arrEvent['teaser'] = StringUtil::toHtml5($objEvent->teaser);

		
		$arrEvent['enclosure'] = array();
		$arrEvent['media:content'] = array();

		
		if ($objEvent->addImage)
		{
			$objFile = FilesModel::findByUuid($objEvent->singleSRC);

			if ($objFile !== null)
			{
				$arrEvent['media:content'][] = $objFile->path;
			}
		}

		
		if ($objEvent->addEnclosure)
		{
			$arrEnclosure = StringUtil::deserialize($objEvent->enclosure, true);

			if (\is_array($arrEnclosure))
			{
				$objFile = FilesModel::findMultipleByUuids($arrEnclosure);

				if ($objFile !== null)
				{
					while ($objFile->next())
					{
						$arrEvent['enclosure'][] = $objFile->path;
					}
				}
			}
		}

		$this->arrEvents[$intKey][$intStart][] = $arrEvent;
	}
protected function addEvent ( $ objEvent , $ intStart , $ intEnd , $ strUrl , $ strBase = '' ) { if ( $ intEnd < time ( ) ) // see #3917 { return ; } /** @var PageModel $objPage */ global $ objPage ; // Called in the back end (see #4026) if ( $ objPage === null ) { $ objPage = new \ stdClass ( ) ; $ objPage -> dateFormat = Config :: get ( 'dateFormat' ) ; $ objPage -> datimFormat = Config :: get ( 'datimFormat' ) ; $ objPage -> timeFormat = Config :: get ( 'timeFormat' ) ; } $ intKey = date ( 'Ymd' , $ intStart ) ; $ span = self :: calculateSpan ( $ intStart , $ intEnd ) ; $ format = $ objEvent -> addTime ? 'datimFormat' : 'dateFormat' ; // Add date if ( $ span > 0 ) { $ title = Date :: parse ( $ objPage -> $ format , $ intStart ) . $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'cal_timeSeparator' ] . Date :: parse ( $ objPage -> $ format , $ intEnd ) ; } else { $ title = Date :: parse ( $ objPage -> dateFormat , $ intStart ) . ( $ objEvent -> addTime ? ' (' . Date :: parse ( $ objPage -> timeFormat , $ intStart ) . ( ( $ intStart < $ intEnd ) ? $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'cal_timeSeparator' ] . Date :: parse ( $ objPage -> timeFormat , $ intEnd ) : '' ) . ')' : '' ) ; } // Add title and link $ title .= ' ' . $ objEvent -> title ; // Backwards compatibility (see #8329) if ( $ strBase != '' && ! preg_match ( '#^https?://#' , $ strUrl ) ) { $ strUrl = $ strBase . $ strUrl ; } $ link = '' ; switch ( $ objEvent -> source ) { case 'external' : $ link = $ objEvent -> url ; break ; case 'internal' : if ( ( $ objTarget = $ objEvent -> getRelated ( 'jumpTo' ) ) instanceof PageModel ) { /** @var PageModel $objTarget */ $ link = $ objTarget -> getAbsoluteUrl ( ) ; } break ; case 'article' : if ( ( $ objArticle = ArticleModel :: findByPk ( $ objEvent -> articleId ) ) instanceof ArticleModel && ( $ objPid = $ objArticle -> getRelated ( 'pid' ) ) instanceof PageModel ) { /** @var PageModel $objPid */ $ link = ampersand ( $ objPid -> getAbsoluteUrl ( '/articles/' . ( $ objArticle -> alias ? : $ objArticle -> id ) ) ) ; } break ; default : $ link = sprintf ( preg_replace ( '/%(?!s)/' , '%%' , $ strUrl ) , ( $ objEvent -> alias ? : $ objEvent -> id ) ) ; break ; } // Store the whole row (see #5085) $ arrEvent = $ objEvent -> row ( ) ; // Override link and title $ arrEvent [ 'link' ] = $ link ; $ arrEvent [ 'title' ] = $ title ; // Clean the RTE output $ arrEvent [ 'teaser' ] = StringUtil :: toHtml5 ( $ objEvent -> teaser ) ; // Reset the enclosures (see #5685) $ arrEvent [ 'enclosure' ] = array ( ) ; $ arrEvent [ 'media:content' ] = array ( ) ; // Add the article image as enclosure if ( $ objEvent -> addImage ) { $ objFile = FilesModel :: findByUuid ( $ objEvent -> singleSRC ) ; if ( $ objFile !== null ) { $ arrEvent [ 'media:content' ] [ ] = $ objFile -> path ; } } // Enclosures if ( $ objEvent -> addEnclosure ) { $ arrEnclosure = StringUtil :: deserialize ( $ objEvent -> enclosure , true ) ; if ( \ is_array ( $ arrEnclosure ) ) { $ objFile = FilesModel :: findMultipleByUuids ( $ arrEnclosure ) ; if ( $ objFile !== null ) { while ( $ objFile -> next ( ) ) { $ arrEvent [ 'enclosure' ] [ ] = $ objFile -> path ; } } } } $ this -> arrEvents [ $ intKey ] [ $ intStart ] [ ] = $ arrEvent ; }
Add an event to the array of active events

@param CalendarEventsModel $objEvent
@param integer             $intStart
@param integer             $intEnd
@param string              $strUrl
@param string              $strBase
Add an event to the array of active events