aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/elgglib.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-30 18:10:10 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-30 18:10:10 +0000
commited101d29e590d2babf965e9ba7599a1269c05369 (patch)
tree12e765ee06a05336c59ab3694ea38dc6a08d01e7 /engine/lib/elgglib.php
parentdf94762e70f5c143b728a62d90c298fb887231c6 (diff)
downloadelgg-ed101d29e590d2babf965e9ba7599a1269c05369.tar.gz
elgg-ed101d29e590d2babf965e9ba7599a1269c05369.tar.bz2
Gallery vs list view, first commit
git-svn-id: https://code.elgg.org/elgg/trunk@1212 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r--engine/lib/elgglib.php34
1 files changed, 28 insertions, 6 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 7b05ca9f6..aedfdb856 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -351,9 +351,10 @@
* @param int $offset The current indexing offset
* @param int $limit The number of entities to display per page
* @param true|false $fullview Whether or not to display the full view (default: true)
+ * @param string $viewtype "list" or "gallery" for search pages only (default: "list")
* @return string The list of entities
*/
- function elgg_view_entity_list($entities, $count, $offset, $limit, $fullview = true) {
+ function elgg_view_entity_list($entities, $count, $offset, $limit, $fullview = true, $viewtype = "list") {
$count = (int) $count;
$offset = (int) $offset;
@@ -361,7 +362,23 @@
$html = "";
- $nav = elgg_view('navigation/pagination',array(
+ $context = get_context();
+
+ $nav = "";
+
+ if ($context == "search" && $count > 0) {
+ $viewtype = get_input('search_viewtype','list');
+ $nav .= elgg_view("navigation/viewtype",array(
+
+ 'baseurl' => $_SERVER['REQUEST_URI'],
+ 'offset' => $offset,
+ 'count' => $count,
+ 'viewtype' => $viewtype,
+
+ ));
+ }
+
+ $nav .= elgg_view('navigation/pagination',array(
'baseurl' => $_SERVER['REQUEST_URI'],
'offset' => $offset,
@@ -370,11 +387,16 @@
));
$html .= $nav;
-
- if (is_array($entities) && sizeof($entities) > 0) {
- foreach($entities as $entity) {
- $html .= elgg_view_entity($entity, "", $fullview);
+
+ if ($viewtype == "list") {
+ if (is_array($entities) && sizeof($entities) > 0) {
+ foreach($entities as $entity) {
+ $html .= elgg_view_entity($entity, "", $fullview);
+ }
}
+ } else {
+ if (is_array($entities) && sizeof($entities) > 0)
+ $html .= elgg_view("navigation/gallery",array('entities' => $entities));
}
if ($count)