diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-07 02:38:51 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-07 02:38:51 +0000 |
commit | ccca9564b23d6f860d46ccdb86a7578e74b7a534 (patch) | |
tree | 72fbe19572d8006a0babb8782cd514bb8d05a731 /mod/search/views | |
parent | cb5ecaff25b858117a57ede78f353661a520c9d4 (diff) | |
download | elgg-ccca9564b23d6f860d46ccdb86a7578e74b7a534.tar.gz elgg-ccca9564b23d6f860d46ccdb86a7578e74b7a534.tar.bz2 |
Fixes #2335 #2336 clean up and minor standardization of search plugin - needs html/css clean up
git-svn-id: http://code.elgg.org/elgg/trunk@8057 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/search/views')
-rw-r--r-- | mod/search/views/default/search/comments/entity.php | 12 | ||||
-rw-r--r-- | mod/search/views/default/search/entity.php | 23 | ||||
-rw-r--r-- | mod/search/views/default/search/entity_list.php | 64 | ||||
-rw-r--r-- | mod/search/views/default/search/gallery.php | 53 | ||||
-rw-r--r-- | mod/search/views/default/search/gallery_listing.php | 14 | ||||
-rw-r--r-- | mod/search/views/default/search/layout.php | 9 | ||||
-rw-r--r-- | mod/search/views/default/search/listing.php | 20 | ||||
-rw-r--r-- | mod/search/views/default/search/search_box.php | 7 | ||||
-rw-r--r-- | mod/search/views/default/search/startblurb.php | 3 | ||||
-rw-r--r-- | mod/search/views/rss/search/comments/entity.php | 6 | ||||
-rw-r--r-- | mod/search/views/rss/search/entity.php | 4 | ||||
-rw-r--r-- | mod/search/views/rss/search/layout.php | 5 | ||||
-rw-r--r-- | mod/search/views/rss/search/listing.php | 7 |
13 files changed, 56 insertions, 171 deletions
diff --git a/mod/search/views/default/search/comments/entity.php b/mod/search/views/default/search/comments/entity.php index 6e267fe7a..eddb36547 100644 --- a/mod/search/views/default/search/comments/entity.php +++ b/mod/search/views/default/search/comments/entity.php @@ -1,16 +1,16 @@ <?php /** - * Elgg search entity + * Default view for a comment * - * @package Elgg - * @subpackage Core + * @uses $vars['entity'] */ + $entity = $vars['entity']; $owner = get_entity($entity->getVolatileData('search_matched_comment_owner_guid')); if ($owner instanceof ElggUser) { - $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny')); + $icon = elgg_view_entity_icon($owner, 'tiny'); } else { $icon = ''; } @@ -36,6 +36,8 @@ if ($entity->getVolatileData('search_unavailable_entity')) { } $title = elgg_echo('search:comment_on', array($title)); + + // @todo this should use something like $comment->getURL() $url = $entity->getURL() . '#comment_' . $entity->getVolatileData('search_match_annotation_id'); $title = "<a href=\"$url\">$title</a>"; } @@ -54,4 +56,4 @@ echo <<<___END </div> ___END; -?> +?>
\ No newline at end of file diff --git a/mod/search/views/default/search/entity.php b/mod/search/views/default/search/entity.php index a967853a3..ae3d43e01 100644 --- a/mod/search/views/default/search/entity.php +++ b/mod/search/views/default/search/entity.php @@ -1,6 +1,6 @@ <?php /** - * Elgg search entity + * Default view for an entity returned in a search * * Display largely controlled by a set of overrideable volatile data: * - search_icon (defaults to entity icon) @@ -10,8 +10,7 @@ * - search_url (defaults to entity->getURL()) * - search_time (defaults to entity->time_updated or entity->time_created) * - * @package Elgg - * @subpackage Core + * @uses $vars['entity'] Entity returned in a search */ $entity = $vars['entity']; @@ -49,18 +48,20 @@ if (!$time) { $time = elgg_view_friendly_time(($tu > $tc) ? $tu : $tc); } ?> - <div class="search_listing clearfix"> - <div class="search_listing_icon"><?php echo $icon; ?></div> - <div class="search_listing_info"> - <p class="entity-title"><?php echo $title; ?></p> - <?php echo $description; ?> +<div class="search_listing clearfix"> + <div class="search_listing_icon"> + <?php echo $icon; ?> + </div> + <div class="search_listing_info"> + <p class="entity-title"><?php echo $title; ?></p> + <?php echo $description; ?> <?php if ($extra_info) { ?> - <p class="entity-subtext"><?php echo $extra_info; ?></p> + <p class="entity-subtext"><?php echo $extra_info; ?></p> <?php } ?> - <p class="entity-subtext"><?php echo $time; ?></p> - </div> + <p class="entity-subtext"><?php echo $time; ?></p> </div> +</div> diff --git a/mod/search/views/default/search/entity_list.php b/mod/search/views/default/search/entity_list.php deleted file mode 100644 index f9105c711..000000000 --- a/mod/search/views/default/search/entity_list.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -$context = $vars['context']; -$offset = $vars['offset']; -$entities = $vars['entities']; -$limit = $vars['limit']; -$count = $vars['count']; -$baseurl = $vars['baseurl']; -$context = $vars['context']; -$listtype = $vars['listtype']; -$pagination = $vars['pagination']; -$fullview = $vars['fullview']; - -$html = ""; -$nav = ""; -if (isset($vars['listtypetoggle'])) { - $listtypetoggle = $vars['listtypetoggle']; -} else { - $listtypetoggle = true; -} - -if ($context == "search" && $count > 0 && $listtypetoggle) { - $nav .= elgg_view("navigation/listtype",array( - - 'baseurl' => $baseurl, - 'offset' => $offset, - 'count' => $count, - 'listtype' => $listtype, - - )); -} - -if ($pagination) - $nav .= elgg_view('navigation/pagination',array( - - 'baseurl' => $baseurl, - 'offset' => $offset, - 'count' => $count, - 'limit' => $limit, - - )); - -if ($listtype == "list") { - if (is_array($entities) && sizeof($entities) > 0) { - foreach($entities as $entity) { - // print out the entity - $ev = elgg_view_entity($entity, $fullview); - // then add the search decorations around it - $html .= elgg_view('search/listing', array('entity_view' => $ev, - 'search_types' => $entity->getVolatileData('search'))); - - } - } -} else if ($listtype == "gallery") { - if (is_array($entities) && sizeof($entities) > 0) { - $html .= elgg_view("search/gallery",array('entities' => $entities)); - } -} - -if ($count) { - $html .= $nav; -} -echo $html; - -?> diff --git a/mod/search/views/default/search/gallery.php b/mod/search/views/default/search/gallery.php deleted file mode 100644 index e2c6875e0..000000000 --- a/mod/search/views/default/search/gallery.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - - /** - * Elgg gallery view - * - * @package Elgg - * @subpackage Core - - - */ - - $entities = $vars['entities']; - if (is_array($entities) && sizeof($entities) > 0) { - -?> - - <table class="entity_gallery"> - -<?php - - $col = 0; - foreach($entities as $entity) { - if ($col == 0) { - - echo "<tr>"; - - } - echo "<td class='entity_gallery_item'>"; - - $ev = elgg_view_entity($entity, $fullview); - - echo elgg_view('search/listing', array('entity_view' => $ev, - 'search_types' => $entity->getVolatileData('search'))); - - - echo "</td>"; - $col++; - if ($col > 3) { - echo "</tr>"; - $col = 0; - } - } - if ($col > 0) echo "</tr>"; - -?> - - </table> - -<?php - - } - -?>
\ No newline at end of file diff --git a/mod/search/views/default/search/gallery_listing.php b/mod/search/views/default/search/gallery_listing.php deleted file mode 100644 index e4b723242..000000000 --- a/mod/search/views/default/search/gallery_listing.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php -/** - * Elgg search listing: gallery view - * - * DEPRECATED VIEW: use entities/gallery_listing instead - * - * @package Elgg - * @subpackage Core - */ - - - echo elgg_view('entities/gallery_listing', $vars); - -?>
\ No newline at end of file diff --git a/mod/search/views/default/search/layout.php b/mod/search/views/default/search/layout.php index 6882f252d..eb597836e 100644 --- a/mod/search/views/default/search/layout.php +++ b/mod/search/views/default/search/layout.php @@ -1,9 +1,8 @@ <?php /** - * Elgg core search listing. - * - * @package Elgg - * @subpackage Core - */ + * The default search layout + * + * @uses $vars['body'] + */ echo elgg_view_layout('one_sidebar', array('content' => $vars['body']));
\ No newline at end of file diff --git a/mod/search/views/default/search/listing.php b/mod/search/views/default/search/listing.php index d84d567d4..27916a363 100644 --- a/mod/search/views/default/search/listing.php +++ b/mod/search/views/default/search/listing.php @@ -1,9 +1,18 @@ <?php /** - * Elgg search listing + * List a section of search results corresponding in a particular type/subtype + * or search type (comments for example) * - * @package Elgg - * @subpackage Core + * @uses $vars['results'] Array of data related to search results including: + * - 'entities' Array of entities to be displayed + * - 'count' Total number of results + * @uses $vars['params'] Array of parameters including: + * - 'type' Entity type + * - 'subtype' Entity subtype + * - 'search_type' Type of search: 'entities', 'comments', 'tags' + * - 'offset' + * - 'limit' + * - 'pagination' Display pagination? */ $entities = $vars['results']['entities']; @@ -13,6 +22,7 @@ if (!is_array($entities) || !count($entities)) { return FALSE; } +// @todo why are limit and offset pulled from input here and from $vars['params'] later $query = http_build_query( array( 'q' => $vars['params']['query'], @@ -25,7 +35,7 @@ $query = http_build_query( ) ); -$url = elgg_get_site_url()."pg/search?$query"; +$url = elgg_get_site_url() . "pg/search?$query"; // get pagination if (array_key_exists('pagination', $vars) && $vars['pagination']) { @@ -90,7 +100,7 @@ if ($more) { $more_link = ''; } -$body = "<div class='search_listing_category_title'>".elgg_view_title($type_str)."</div>"; +$body = "<div class='search_listing_category_title'>" . elgg_view_title($type_str) . "</div>"; foreach ($entities as $entity) { if ($view = search_get_search_view($vars['params'], 'entity')) { diff --git a/mod/search/views/default/search/search_box.php b/mod/search/views/default/search/search_box.php index 1a02a9861..9de861179 100644 --- a/mod/search/views/default/search/search_box.php +++ b/mod/search/views/default/search/search_box.php @@ -1,4 +1,11 @@ <?php +/** + * Search box + * + * @uses $vars['value'] Current search query + * + * @todo Move javascript into something that extends elgg.js + */ if (array_key_exists('value', $vars)) { $value = $vars['value']; diff --git a/mod/search/views/default/search/startblurb.php b/mod/search/views/default/search/startblurb.php index 3ffa39e68..d6394da0d 100644 --- a/mod/search/views/default/search/startblurb.php +++ b/mod/search/views/default/search/startblurb.php @@ -1,7 +1,6 @@ <?php /** - * @package Elgg - * @subpackage Core + * @todo This doesn't appear to be called by anything. Look into removing. */ echo elgg_echo("tag:search:startblurb", array($vars['query'])); diff --git a/mod/search/views/rss/search/comments/entity.php b/mod/search/views/rss/search/comments/entity.php index 46ef87a14..869779f35 100644 --- a/mod/search/views/rss/search/comments/entity.php +++ b/mod/search/views/rss/search/comments/entity.php @@ -1,10 +1,10 @@ <?php /** - * Elgg search comment view + * Search comment view for RSS feeds. * - * @package Elgg - * @subpackage Core + * @uses $vars['entity'] */ + $entity = $vars['entity']; $author_name = ''; diff --git a/mod/search/views/rss/search/entity.php b/mod/search/views/rss/search/entity.php index 54f241982..10d28e8e1 100644 --- a/mod/search/views/rss/search/entity.php +++ b/mod/search/views/rss/search/entity.php @@ -1,10 +1,8 @@ <?php /** - * Elgg core search. * Search entity view for RSS feeds. * - * @package Elgg - * @subpackage Core + * @uses $vars['entity'] */ if (!array_key_exists('entity', $vars) || !($vars['entity'] instanceof ElggEntity)) { diff --git a/mod/search/views/rss/search/layout.php b/mod/search/views/rss/search/layout.php index d722ccaeb..2c255a9cc 100644 --- a/mod/search/views/rss/search/layout.php +++ b/mod/search/views/rss/search/layout.php @@ -1,5 +1,6 @@ <?php +/** + * Search layout for RSS + */ echo $vars['body']; - -?>
\ No newline at end of file diff --git a/mod/search/views/rss/search/listing.php b/mod/search/views/rss/search/listing.php index 92f6553b9..32082fd31 100644 --- a/mod/search/views/rss/search/listing.php +++ b/mod/search/views/rss/search/listing.php @@ -1,10 +1,9 @@ <?php /** - * Elgg core search. - * Search listing view for RSS feeds. + * List a section of search results for RSS feeds. * - * @package Elgg - * @subpackage Core + * @uses $vars['results'] + * @uses $vars['params'] */ $entities = $vars['results']['entities']; |