diff options
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r-- | engine/lib/elgglib.php | 48 |
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'].
|