aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-27 11:16:45 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-27 11:16:45 +0000
commit689c997f58b25df81164df9acdf5ebd9c1ad2bc9 (patch)
treeed9e21ec733b56eef45fc7b314c38a3e6896d2df
parentb649c933a9cfbaf4909030d2f7454fea29086a3a (diff)
downloadelgg-689c997f58b25df81164df9acdf5ebd9c1ad2bc9.tar.gz
elgg-689c997f58b25df81164df9acdf5ebd9c1ad2bc9.tar.bz2
Introducing elgg_view_listing
git-svn-id: https://code.elgg.org/elgg/trunk@1169 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/elgglib.php11
-rw-r--r--mod/profile/views/default/profile/listing.php46
-rw-r--r--views/default/search/listing.php33
3 files changed, 59 insertions, 31 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index bd1f12448..166757ea4 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -463,6 +463,17 @@
}
/**
+ * Wrapper function to display search listings.
+ *
+ * @param string $icon The icon for the listing
+ * @param string $info Any information that needs to be displayed.
+ * @return string The HTML (etc) representing the listing
+ */
+ function elgg_view_listing($icon, $info) {
+ return elgg_view('search/listing',array('icon' => $icon, 'info' => $info));
+ }
+
+ /**
* Sets an alternative function to handle templates, which will be passed to by elgg_view.
* This function must take the $view and $vars parameters from elgg_view:
*
diff --git a/mod/profile/views/default/profile/listing.php b/mod/profile/views/default/profile/listing.php
index 6b6381f64..3b322f799 100644
--- a/mod/profile/views/default/profile/listing.php
+++ b/mod/profile/views/default/profile/listing.php
@@ -12,36 +12,20 @@
* @uses $vars['entity'] The user entity
*/
-?>
-
- <div class="search_listing">
+ $icon = elgg_view(
+ "profile/icon", array(
+ 'entity' => $vars['entity'],
+ 'size' => 'small',
+ )
+ );
- <div class="search_listing_icon">
- <?php
-
- echo elgg_view(
- "profile/icon", array(
- 'entity' => $vars['entity'],
- 'size' => 'small',
- )
- );
-
- ?>
- </div>
- <div class="search_listing_info">
- <p><b><?php
-
- echo "<a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->name . "</a>";
-
- ?></b></p>
- <?php
-
- $location = $vars['entity']->location;
- if (!empty($location)) {
- echo "<p>" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "</p>";
- }
-
- ?>
- </div>
+ $info = "<p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $vars['entity']->name . "</a></b></p>";
- </div> \ No newline at end of file
+ $location = $vars['entity']->location;
+ if (!empty($location)) {
+ $info .= "<p>" . elgg_echo("profile:location") . ": " . elgg_view("output/tags",array('value' => $vars['entity']->location)) . "</p>";
+ }
+
+ echo elgg_view_listing($icon, $info);
+
+?> \ No newline at end of file
diff --git a/views/default/search/listing.php b/views/default/search/listing.php
new file mode 100644
index 000000000..8ffad8ffa
--- /dev/null
+++ b/views/default/search/listing.php
@@ -0,0 +1,33 @@
+<?php
+
+ /**
+ * Elgg search listing
+ *
+ * @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/
+ */
+
+?>
+
+ <div class="search_listing">
+
+ <div class="search_listing_icon">
+ <?php
+
+ echo $vars['icon'];
+
+ ?>
+ </div>
+ <div class="search_listing_info">
+ <?php
+
+ echo $vars['info'];
+
+ ?>
+ </div>
+
+ </div> \ No newline at end of file