calendar-bundle/src/Resources/contao/classes/Events.php
protected function sortOutProtected($arrCalendars)
	{
		if (empty($arrCalendars) || !\is_array($arrCalendars))
		{
			return $arrCalendars;
		}

		$this->import(FrontendUser::class, 'User');
		$objCalendar = CalendarModel::findMultipleByIds($arrCalendars);
		$arrCalendars = array();

		if ($objCalendar !== null)
		{
			while ($objCalendar->next())
			{
				if ($objCalendar->protected)
				{
					if (!FE_USER_LOGGED_IN || !\is_array($this->User->groups))
					{
						continue;
					}

					$groups = StringUtil::deserialize($objCalendar->groups);

					if (empty($groups) || !\is_array($groups) || \count(array_intersect($groups, $this->User->groups)) < 1)
					{
						continue;
					}
				}

				$arrCalendars[] = $objCalendar->id;
			}
		}

		return $arrCalendars;
	}
protected function sortOutProtected($arrCalendars)
	{
		if (empty($arrCalendars) || !\is_array($arrCalendars))
		{
			return $arrCalendars;
		}

		$this->import(FrontendUser::class, 'User');
		$objCalendar = CalendarModel::findMultipleByIds($arrCalendars);
		$arrCalendars = array();

		if ($objCalendar !== null)
		{
			while ($objCalendar->next())
			{
				if ($objCalendar->protected)
				{
					if (!FE_USER_LOGGED_IN || !\is_array($this->User->groups))
					{
						continue;
					}

					$groups = StringUtil::deserialize($objCalendar->groups);

					if (empty($groups) || !\is_array($groups) || \count(array_intersect($groups, $this->User->groups)) < 1)
					{
						continue;
					}
				}

				$arrCalendars[] = $objCalendar->id;
			}
		}

		return $arrCalendars;
	}
protected function sortOutProtected ( $ arrCalendars ) { if ( empty ( $ arrCalendars ) || ! \ is_array ( $ arrCalendars ) ) { return $ arrCalendars ; } $ this -> import ( FrontendUser :: class , 'User' ) ; $ objCalendar = CalendarModel :: findMultipleByIds ( $ arrCalendars ) ; $ arrCalendars = array ( ) ; if ( $ objCalendar !== null ) { while ( $ objCalendar -> next ( ) ) { if ( $ objCalendar -> protected ) { if ( ! FE_USER_LOGGED_IN || ! \ is_array ( $ this -> User -> groups ) ) { continue ; } $ groups = StringUtil :: deserialize ( $ objCalendar -> groups ) ; if ( empty ( $ groups ) || ! \ is_array ( $ groups ) || \ count ( array_intersect ( $ groups , $ this -> User -> groups ) ) < 1 ) { continue ; } } $ arrCalendars [ ] = $ objCalendar -> id ; } } return $ arrCalendars ; }
Sort out protected archives

@param array $arrCalendars

@return array
Sort out protected archives