aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/elgglib.php34
-rw-r--r--languages/en.php4
-rw-r--r--search/index.php2
-rw-r--r--views/default/css.php26
-rw-r--r--views/default/navigation/gallery.php49
-rw-r--r--views/default/navigation/viewtype.php34
6 files changed, 142 insertions, 7 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)
diff --git a/languages/en.php b/languages/en.php
index b792b2fc5..a13476ae6 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -229,6 +229,10 @@
'next' => "Next",
'previous' => "Previous",
+ 'viewtype:change' => "Change listing type",
+ 'viewtype:list' => "List view",
+ 'viewtype:gallery' => "Gallery",
+
/**
* Account
*/
diff --git a/search/index.php b/search/index.php
index 30ed459e8..0553879b2 100644
--- a/search/index.php
+++ b/search/index.php
@@ -33,7 +33,7 @@
}
if (!empty($tag)) {
- $body = elgg_view_title(elgg_echo('searchtitle'),$tag);
+ $body = elgg_view_title(sprintf(elgg_echo('searchtitle'),$tag));
$body .= list_entities_from_metadata($md_type, $tag, $objecttype, $subtype, $owner_guid, 10, false);
$body = elgg_view_layout('one_column',$body);
}
diff --git a/views/default/css.php b/views/default/css.php
index 802a38e51..82fcc2597 100644
--- a/views/default/css.php
+++ b/views/default/css.php
@@ -959,6 +959,32 @@ p.user_menu_friends_of {
.search_listing_info p {
margin:0 0 3px 0;
line-height:1.2em;
+}
+
+.search_gallery_item {
+ border:1px dotted silver;
+ background-color: white;
+ width: 210px;
+ height: 200px;
+}
+
+.search_gallery_item .search_listing {
+ background: none;
+ text-align: center;
+}
+
+.search_gallery_item .search_listing_icon {
+ position: absolute;
+ margin-bottom: 20px;
+}
+
+.search_gallery_item .search_listing_info {
+ margin: 5px;
+}
+
+.search_gallery_item .search_listing_info p {
+ margin: 5px;
+ margin-bottom: 10px;
}
diff --git a/views/default/navigation/gallery.php b/views/default/navigation/gallery.php
new file mode 100644
index 000000000..4c099e603
--- /dev/null
+++ b/views/default/navigation/gallery.php
@@ -0,0 +1,49 @@
+<?php
+
+ /**
+ * Elgg gallery view
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ $entities = $vars['entities'];
+ if (is_array($entities) && sizeof($entities) > 0) {
+
+?>
+
+ <table class="search_gallery">
+
+<?php
+
+ $col = 0;
+ foreach($entities as $entity) {
+ if ($col == 0) {
+
+ echo "<tr>";
+
+ }
+ echo "<td class=\"search_gallery_item\">";
+ echo elgg_view_entity($entity);
+ echo "</td>";
+ $col++;
+ if ($col > 4) {
+ echo "</tr>";
+ $col = 0;
+ }
+ }
+ if ($col > 0) echo "</tr>";
+
+?>
+
+ </table>
+
+<?php
+
+ }
+
+?> \ No newline at end of file
diff --git a/views/default/navigation/viewtype.php b/views/default/navigation/viewtype.php
new file mode 100644
index 000000000..103e9c450
--- /dev/null
+++ b/views/default/navigation/viewtype.php
@@ -0,0 +1,34 @@
+<?php
+
+ /**
+ * Elgg list view switcher
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+
+ $baseurl = preg_replace('/[\&\?]search\_viewtype\=[A-Za-z0-9]*/',"",$vars['baseurl']);
+
+ if ($vars['viewtype'] == "list") {
+ $viewtype = "gallery";
+ } else {
+ $viewtype = "list";
+ }
+
+ if (substr_count($baseurl,'?')) {
+ $baseurl .= "&search_viewtype=" . $viewtype;
+ } else {
+ $baseurl .= "?search_viewtype=" . $viewtype;
+ }
+
+?>
+
+ <p>
+ <?php echo elgg_echo("viewtype:change") ?>:
+ <a href="<?php echo $baseurl; ?>"><?php echo elgg_echo("viewtype:{$viewtype}"); ?></a>
+ </p> \ No newline at end of file