예제 #1
0
 /**
  * Retrieves user's or group's public calendar
  *
  * @param ElggEntity $container User or group
  * @return Calendar|false
  */
 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'));
     return empty($calendars) ? Calendar::createPublicCalendar($container) : $calendars[0];
 }