aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php2
-rw-r--r--engine/lib/entities.php6
-rw-r--r--engine/lib/views.php87
3 files changed, 62 insertions, 33 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index bc0b1b5af..59e641da2 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1709,7 +1709,7 @@ function elgg_http_add_url_query_elements($url, array $elements) {
}
$url_array['query'] = http_build_query($query);
- $string = elgg_http_build_url($url_array);
+ $string = elgg_http_build_url($url_array, false);
return $string;
}
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index ddbdbe9ab..339b7755d 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1305,6 +1305,7 @@ function elgg_list_entities(array $options = array(), $getter = 'elgg_get_entiti
'full_view' => TRUE,
'list_type_toggle' => FALSE,
'pagination' => TRUE,
+ 'gallery' => FALSE,
);
$options = array_merge($defaults, $options);
@@ -1320,8 +1321,9 @@ function elgg_list_entities(array $options = array(), $getter = 'elgg_get_entiti
$options['count'] = FALSE;
$entities = $getter($options);
- return elgg_view_entity_list($entities, $count, $options['offset'], $options['limit'],
- $options['full_view'], $options['list_type_toggle'], $options['pagination']);
+ $options['count'] = $count;
+
+ return elgg_view_entity_list($entities, $options);
}
/**
diff --git a/engine/lib/views.php b/engine/lib/views.php
index 87d1a3836..942f1b6a7 100644
--- a/engine/lib/views.php
+++ b/engine/lib/views.php
@@ -843,13 +843,16 @@ function elgg_view_annotation(ElggAnnotation $annotation, $full = true, $bypass
* @see elgg_list_entities_from_relationships()
* @see elgg_list_entities_from_annotations()
*
- * @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
- * @param bool $full_view Whether or not to display the full view (default: true)
- * @param bool $list_type_toggle Whether or not to allow users to toggle to gallery view
- * @param bool $pagination Whether pagination is offered.
+ * @param array $entities Array of entities
+ * @param array $vars Display variables
+ * 'count' The total number of entities across all pages
+ * 'offset' The current indexing offset
+ * 'limit' The number of entities to display per page
+ * 'full_view' Display the full view of the entities?
+ * 'list_class' CSS Class applied to the list
+ * 'pagination' Display pagination?
+ * 'gallery' Display as gallery?
+ * 'list_type_toggle' Display the list type toggle?
*
* @return string The list of entities
* @access private
@@ -857,41 +860,65 @@ function elgg_view_annotation(ElggAnnotation $annotation, $full = true, $bypass
function elgg_view_entity_list($entities, $count, $offset, $limit, $full_view = true,
$list_type_toggle = true, $pagination = true) {
- $count = (int) $count;
- $limit = (int) $limit;
-
- // do not require views to explicitly pass in the offset
if (!is_int($offset)) {
$offset = (int)get_input('offset', 0);
}
- $context = elgg_get_context();
+ if (func_num_args() == 2) {
+ // new function
+ $defaults = array(
+ 'items' => $entities,
+ 'list_class' => 'elgg-entity-list',
+ 'full_view' => true,
+ 'pagination' => true,
+ 'gallery' => false,
+ 'list_type_toggle' => false,
+ 'offset' => $offset,
+ );
+
+ $vars = array_merge($defaults, $count);
- $html = elgg_view('layout/objects/list', array(
- 'items' => $entities,
- 'count' => $count,
- 'offset' => $offset,
- 'limit' => $limit,
- 'full_view' => $full_view,
- 'context' => $context,
- 'pagination' => $pagination,
- 'list_type_toggle' => $list_type_toggle,
- 'list_type' => get_input('listtype', 'list'),
- 'list_class' => 'elgg-entity-list',
- ));
+ } else {
+ // old function - because this is an internal function we can remove
+ // this in Elgg 1.9 without following the normal deprecation procedures
+ $vars = array(
+ 'items' => $entities,
+ 'count' => (int) $count,
+ 'offset' => $offset,
+ 'limit' => (int) $limit,
+ 'full_view' => $full_view,
+ 'pagination' => $pagination,
+ 'gallery' => false,
+ 'list_type_toggle' => $list_type_toggle,
+ 'list_class' => 'elgg-entity-list',
+ );
+ }
+
+ $listtype = get_input('listtype', 'list');
+ if ($listtype != 'list') {
+ $vars['gallery'] = true;
+ }
- return $html;
+ if ($vars['gallery']) {
+ return elgg_view('layout/objects/gallery', $vars);
+ } else {
+ return elgg_view('layout/objects/list', $vars);
+ }
}
/**
* Returns a rendered list of annotations, plus pagination. This function
* should be called by wrapper functions.
*
- * @param array $annotations List of annotations
- * @param int $count The total number of annotations across all pages
- * @param int $offset The current indexing offset
- * @param int $limit The number of annotations to display per page
- *
+ * @param array $annotations Array of annotations
+ * @param array $vars Display variables
+ * 'count' The total number of annotations across all pages
+ * 'offset' The current indexing offset
+ * 'limit' The number of annotations to display per page
+ * 'full_view' Display the full view of the annotation?
+ * 'list_class' CSS Class applied to the list
+ * 'offset_key' The url parameter key used for offset
+ *
* @return string The list of annotations
* @access private
*/