diff options
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/access.php | 45 | ||||
-rw-r--r-- | engine/lib/annotations.php | 15 | ||||
-rw-r--r-- | engine/lib/entities.php | 35 | ||||
-rw-r--r-- | engine/lib/metadata.php | 16 |
4 files changed, 47 insertions, 64 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php index 5b67afbd1..78f933b27 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -843,29 +843,36 @@ function elgg_get_entities_from_access_id(array $options = array()) { /** * Lists entities from an access collection * - * @param int $collection_id ID of collection - * @param string $entity_type Type of entities - * @param string $entity_subtype Subtype of entities - * @param int $owner_guid Guid of owner - * @param int $limit Limit of number of entities to return - * @param bool $fullview Show a full view - * @param bool $viewtypetoggle Allow to toggle between views - * @param bool $pagination Show pagination - * + * @param array $options See elgg_list_entities() and elgg_get_entities_from_access_id() + * + * @see elgg_list_entities() + * @see elgg_get_entities_from_access_id() + * + * @return str + */ +function elgg_list_entities_from_access_id(array $options = array()) { + return elgg_list_entities($options, 'elgg_get_entities_from_access_id'); +} + +/** * @return str - * @todo deprecate with elgg_list_entities_from_access_id() function + * @deprecated 1.8 Use elgg_list_entities_from_access_id() */ function list_entities_from_access_id($collection_id, $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = true, $pagination = true) { - $offset = (int) get_input('offset'); - $limit = (int) $limit; - $count = get_entities_from_access_id($collection_id, $entity_type, $entity_subtype, - $owner_guid, $limit, $offset, "", 0, true); - $entities = get_entities_from_access_id($collection_id, $entity_type, $entity_subtype, - $owner_guid, $limit, $offset, "", 0, false); - - return elgg_view_entity_list($entities, $count, $offset, $limit, - $fullview, $viewtypetoggle, $pagination); + + elgg_deprecated_notice("All list_entities* functions were deprecated in 1.8. Use elgg_list_entities* instead.", 1.8); + + echo elgg_list_entities_from_access_id(array( + 'collection_id' => $collection_id, + 'types' => $entity_type, + 'subtypes' => $entity_subtype, + 'owner_guids' => $owner_guid, + 'limit' => $limit, + 'full_view' => $fullview, + 'view_type_toggle' => $viewtypetoggle, + 'pagination' => $pagination, + )); } /** diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 48421b2d6..78ad7a1b1 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -561,20 +561,7 @@ $viewtypetoggle = false) { * @return str */ function elgg_list_entities_from_annotations($options = array()) { - $defaults = array( - 'offset' => (int) max(get_input('offset', 0), 0), - 'limit' => (int) max(get_input('limit', 10), 0), - 'full_view' => TRUE, - 'view_type_toggle' => FALSE, - 'pagination' => TRUE - ); - $options = array_merge($defaults, $options); - - $count = elgg_get_entities_from_annotations(array_merge(array('count' => TRUE), $options)); - $entities = elgg_get_entities_from_annotations($options); - - return elgg_view_entity_list($entities, $count, $options['offset'], - $options['limit'], $options['full_view'], $options['view_type_toggle'], $options['pagination']); + return elgg_list_entities($options, 'elgg_get_entities_from_annotations'); } /** diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 1fe657808..4a971eb57 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1314,35 +1314,38 @@ function elgg_get_entity_site_where_sql($table, $site_guids) { * * @tip Pagination is handled automatically. * - * @param array $options Any elgg_get_entity() options plus: - * - * full_view => BOOL Display full view entities - * - * view_type_toggle => BOOL Display gallery / list switch - * - * pagination => BOOL Display pagination links + * @param array $options Any options from $getter options plus: + * full_view => BOOL Display full view entities + * view_type_toggle => BOOL Display gallery / list switch + * pagination => BOOL Display pagination links + * + * @param mixed $getter The entity getter function to use to fetch the entities * - * @return str - * @since 1.7.0 - * @see elgg_view_entity_list() + * @return string + * @since 1.7 * @see elgg_get_entities() + * @see elgg_view_entity_list() * @link http://docs.elgg.org/Entities/Output */ -function elgg_list_entities($options) { +function elgg_list_entities(array $options = array(), $getter = 'elgg_get_entities') { $defaults = array( 'offset' => (int) max(get_input('offset', 0), 0), 'limit' => (int) max(get_input('limit', 10), 0), 'full_view' => TRUE, 'view_type_toggle' => FALSE, - 'pagination' => TRUE + 'pagination' => TRUE, ); + $options = array_merge($defaults, $options); - $count = elgg_get_entities(array_merge(array('count' => TRUE), $options)); - $entities = elgg_get_entities($options); + $options['count'] = TRUE; + $count = $getter($options); + + $options['count'] = FALSE; + $entities = $getter($options); - return elgg_view_entity_list($entities, $count, $options['offset'], - $options['limit'], $options['full_view'], $options['view_type_toggle'], $options['pagination']); + return elgg_view_entity_list($entities, $count, $options['offset'], $options['limit'], + $options['full_view'], $options['view_type_toggle'], $options['pagination']); } /** diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index b0117bfd0..77267d8a2 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -1021,21 +1021,7 @@ $pagination = true, $case_sensitive = true) { * @since 1.7.0 */ function elgg_list_entities_from_metadata($options) { - $defaults = array( - 'offset' => (int) max(get_input('offset', 0), 0), - 'limit' => (int) max(get_input('limit', 10), 0), - 'full_view' => TRUE, - 'view_type_toggle' => FALSE, - 'pagination' => TRUE - ); - - $options = array_merge($defaults, $options); - - $count = elgg_get_entities_from_metadata(array_merge(array('count' => TRUE), $options)); - $entities = elgg_get_entities_from_metadata($options); - - return elgg_view_entity_list($entities, $count, $options['offset'], $options['limit'], - $options['full_view'], $options['view_type_toggle'], $options['pagination']); + return elgg_list_entities($options, 'elgg_get_entities_from_metadata'); } /** |