aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/elgglib.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/elgglib.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/elgglib.php')
-rw-r--r--engine/lib/elgglib.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 3670cd884..dae53daa9 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -239,6 +239,54 @@
}
/**
+ * Returns a view of a list of entities, plus navigation. It is intended that this function
+ * be called from other wrapper functions.
+ *
+ * @see list_entities
+ * @see list_user_objects
+ * @see list_user_friends_objects
+ * @see list_entities_from_metadata
+ * @see list_entities_from_metadata_multi
+ * @see list_entities_from_relationships
+ * @see list_site_members
+ *
+ * @param array $entities List of entities
+ * @param int $count The total number of entities across all pages
+ * @param int $offset The current indexing offset
+ * @param int $limit The number of entities to display per page
+ * @return string The list of entities
+ */
+ function elgg_view_entity_list($entities, $count, $offset, $limit) {
+
+ $count = (int) $count;
+ $offset = (int) $offset;
+ $limit = (int) $limit;
+
+ $html = "";
+
+ $nav = elgg_view('navigation/pagination',array(
+
+ 'baseurl' => $_SERVER['REQUEST_URI'],
+ 'offset' => $offset,
+ 'count' => $count,
+
+ ));
+
+ $html .= $nav;
+
+ if (is_array($entities) && sizeof($entities) > 0) {
+ foreach($entities as $entity) {
+ $html .= elgg_view_entity($entity, "", false);
+ }
+ }
+
+ $html .= $nav;
+
+ return $html;
+
+ }
+
+ /**
* Displays an internal layout for the use of a plugin canvas.
* Takes a variable number of parameters, which are made available
* in the views as $vars['area1'] .. $vars['areaN'].