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

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

		try {
			$calendar = new Calendar();
			$calendar->access_id = ACCESS_PUBLIC;
			$calendar->owner_guid = $container->guid;
			$calendar->container_guid = $container->guid;
			$calendar->__public_calendar = true; // flag we can use to manipulate permissions

			$ia = elgg_set_ignore_access(true);
			$calendar->save();
			elgg_set_ignore_access($ia);

			elgg_log("Created public calendar for $container->name [$container->guid]", 'NOTICE');
		} catch (Exception $ex) {
			elgg_log($ex->getMessage(), 'ERROR');
		}

		return $calendar;
	}
public static function createPublicCalendar($container) {

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

		try {
			$calendar = new Calendar();
			$calendar->access_id = ACCESS_PUBLIC;
			$calendar->owner_guid = $container->guid;
			$calendar->container_guid = $container->guid;
			$calendar->__public_calendar = true; // flag we can use to manipulate permissions

			$ia = elgg_set_ignore_access(true);
			$calendar->save();
			elgg_set_ignore_access($ia);

			elgg_log("Created public calendar for $container->name [$container->guid]", 'NOTICE');
		} catch (Exception $ex) {
			elgg_log($ex->getMessage(), 'ERROR');
		}

		return $calendar;
	}
public static function createPublicCalendar ( $ container ) { if ( ! $ container instanceof ElggEntity ) { return false ; } try { $ calendar = new Calendar ( ) ; $ calendar -> access_id = ACCESS_PUBLIC ; $ calendar -> owner_guid = $ container -> guid ; $ calendar -> container_guid = $ container -> guid ; $ calendar -> __public_calendar = true ; // flag we can use to manipulate permissions $ ia = elgg_set_ignore_access ( true ) ; $ calendar -> save ( ) ; elgg_set_ignore_access ( $ ia ) ; elgg_log ( "Created public calendar for $container->name [$container->guid]" , 'NOTICE' ) ; } catch ( Exception $ ex ) { elgg_log ( $ ex -> getMessage ( ) , 'ERROR' ) ; } return $ calendar ; }
Creates a public calendar for a container

@param ElggEntity $container User or group
@return Calendar
Creates a public calendar for a container