aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/relationships.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-18 13:34:58 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-18 13:34:58 +0000
commit269386b9cfa0e1558edde89442c6f571ef32c645 (patch)
tree8714e84ec6bcfca99bf3ee560024090d36cc6543 /engine/lib/relationships.php
parentc3a4bafc3f3f0984e8751e00e024ab8c09e0ff1b (diff)
downloadelgg-269386b9cfa0e1558edde89442c6f571ef32c645.tar.gz
elgg-269386b9cfa0e1558edde89442c6f571ef32c645.tar.bz2
Added generic listing and pagination functions
git-svn-id: https://code.elgg.org/elgg/trunk@964 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/relationships.php')
-rw-r--r--engine/lib/relationships.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index ebcd1ef88..f715f4a58 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -485,6 +485,31 @@
}
return false;
+ }
+
+ /**
+ * Returns a viewable list of entities by relationship
+ *
+ * @see elgg_view_entity_list
+ *
+ * @param string $relationship The relationship eg "friends_of"
+ * @param int $relationship_guid The guid of the entity to use query
+ * @param bool $inverse_relationship Reverse the normal function of the query to instead say "give me all entities for whome $relationship_guid is a $relationship of"
+ * @param string $type The type of entity (eg 'object')
+ * @param string $subtype The entity subtype
+ * @param int $owner_guid The owner (default: all)
+ * @param int $limit The number of entities to display on a page
+ * @return string The viewable list of entities
+ */
+ function list_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship = false, $type = "", $subtype = "", $owner_guid = 0, $limit = 0) {
+
+ $limit = (int) $limit;
+ $offset = (int) get_input('offset');
+ $count = get_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship, $type, $subtype, $owner_guid, "", $limit, 0, true);
+ $entities = get_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship, $type, $subtype, $owner_guid, "", $limit, 0, true);
+
+ return elgg_view_entity_list($entities, $count, $offset, $Limit);
+
}
/**** HELPER FUNCTIONS FOR RELATIONSHIPS OF TYPE 'ATTACHED' ****/