From 8a45f27fca39f0356987c011c80e07c0f0413d6a Mon Sep 17 00:00:00 2001 From: cash Date: Tue, 22 Mar 2011 10:55:51 +0000 Subject: Refs #2091 added a tagcloud block that accepts subtype git-svn-id: http://code.elgg.org/elgg/trunk@8814 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/output/tagcloud.php | 18 +------- views/default/page/elements/tagcloud_block.php | 57 ++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 views/default/page/elements/tagcloud_block.php (limited to 'views') diff --git a/views/default/output/tagcloud.php b/views/default/output/tagcloud.php index 3bc04a3fb..22b6cf49d 100644 --- a/views/default/output/tagcloud.php +++ b/views/default/output/tagcloud.php @@ -12,8 +12,6 @@ * @uses $vars['subtype'] Entity subtype */ -$context = elgg_get_context(); - if (!empty($vars['subtype'])) { $subtype = "&entity_subtype=" . urlencode($vars['subtype']); } else { @@ -53,22 +51,8 @@ if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) { $url = elgg_format_url($url); $cloud .= "tag)." ($tag->total)\">" . htmlspecialchars($tag->tag, ENT_QUOTES, 'UTF-8') . ""; } - - if ($context != 'tags') { - $cloud .= '

'; - $cloud .= elgg_view_icon('tag'); - $cloud .= elgg_view('output/url', array( - 'href' => 'tags', - 'text' => elgg_echo('tagcloud:allsitetags'), - )); - $cloud .= '

'; - } $cloud .= elgg_view('tagcloud/extend'); - if ($context != 'tags') { - echo elgg_view_module('aside', elgg_echo('tagcloud'), $cloud, array('class' => 'elgg-tagcloud')); - } else { - echo "
$cloud
"; - } + echo "
$cloud
"; } diff --git a/views/default/page/elements/tagcloud_block.php b/views/default/page/elements/tagcloud_block.php new file mode 100644 index 000000000..8b67c9e37 --- /dev/null +++ b/views/default/page/elements/tagcloud_block.php @@ -0,0 +1,57 @@ + 'object', + 'subtype' => elgg_extract('subtypes', $vars, ELGG_ENTITIES_ANY_VALUE), + 'owner_guid' => $owner_guid, + 'threshold' => 0, + 'limit' => elgg_extract('limit', $vars, 50), + 'tag_name' => 'tags', +); + +$title = elgg_echo('tagcloud'); +if (is_array($options['subtype']) && count($options['subtype']) > 1) { + // we cannot provide links to tagged objects with multiple types + $tag_data = elgg_get_tags($options); + $cloud = elgg_view("output/tagcloud", array( + 'value' => $tag_data, + 'type' => $type, + )); +} else { + $cloud = elgg_view_tagcloud($options); +} +if (!$cloud) { + return true; +} + +// add a link to all site tags +$cloud .= '

'; +$cloud .= elgg_view_icon('tag'); +$cloud .= elgg_view('output/url', array( + 'href' => 'tags', + 'text' => elgg_echo('tagcloud:allsitetags'), +)); +$cloud .= '

'; + + +echo elgg_view_module('aside', $title, $cloud); -- cgit v1.2.3