classes/Events/API/Calendar.php
public static function getPublicCalendar($container) {

		if (!$container instanceof ElggEntity) {
			return false;
		}

		$calendars = elgg_get_entities(array(
			'type' => 'object',
			'subtype' => Calendar::SUBTYPE,
			'container_guid' => $container->guid,
			'limit' => 1,
			'metadata_name_value_pairs' => array(
				'name' => '__public_calendar',
				'value' => true,
			),
			'order_by' => 'e.time_created ASC', // get the first one
		));

		return (empty($calendars)) ? Calendar::createPublicCalendar($container) : $calendars[0];
	}
public static function getPublicCalendar($container) {

		if (!$container instanceof ElggEntity) {
			return false;
		}

		$calendars = elgg_get_entities(array(
			'type' => 'object',
			'subtype' => Calendar::SUBTYPE,
			'container_guid' => $container->guid,
			'limit' => 1,
			'metadata_name_value_pairs' => array(
				'name' => '__public_calendar',
				'value' => true,
			),
			'order_by' => 'e.time_created ASC', // get the first one
		));

		return (empty($calendars)) ? Calendar::createPublicCalendar($container) : $calendars[0];
	}
public static function getPublicCalendar ( $ container ) { if ( ! $ container instanceof ElggEntity ) { return false ; } $ calendars = elgg_get_entities ( array ( 'type' => 'object' , 'subtype' => Calendar :: SUBTYPE , 'container_guid' => $ container -> guid , 'limit' => 1 , 'metadata_name_value_pairs' => array ( 'name' => '__public_calendar' , 'value' => true , ) , 'order_by' => 'e.time_created ASC' , // get the first one ) ) ; return ( empty ( $ calendars ) ) ? Calendar :: createPublicCalendar ( $ container ) : $ calendars [ 0 ] ; }
Retrieves user's or group's public calendar

@param ElggEntity $container User or group
@return Calendar|false
Retrieves user s or group s public calendar