From 8151550fc7966f9c0b039bc585d344b90548c6cc Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Wed, 24 Oct 2012 02:57:20 +0000 Subject: fix tag cloud widget and add an option to filter latest. --- .../widgets/cloud_generic_index/content.php | 45 ++++++++++++++++++---- views/default/widgets/cloud_generic_index/edit.php | 19 ++++++++- 2 files changed, 55 insertions(+), 9 deletions(-) (limited to 'views/default/widgets') diff --git a/views/default/widgets/cloud_generic_index/content.php b/views/default/widgets/cloud_generic_index/content.php index 1f4410f76..bee459e1d 100644 --- a/views/default/widgets/cloud_generic_index/content.php +++ b/views/default/widgets/cloud_generic_index/content.php @@ -1,30 +1,59 @@ widget_subtype; +if (empty($subtype) || $subtype == 'All') { + $subtype = ELGG_ENTITIES_ANY_VALUE; +} + +if ($subtype == 'user') {$maintype='user';} +if ($subtype == 'group') {$maintype='group';} -if ($subtype == 'user') {$maintype='user'; $subtype='';} -if ($subtype == 'group') {$maintype='group'; $subtype='';} $num_items = $vars['entity']->num_items; if (!isset($num_items)) $num_items = 20; + +$created_time_limit = $vars['entity']->created_time_limit; +if (!isset($created_time_limit) || $created_time_limit == 'all') { + $created_time = ELGG_ENTITIES_ANY_VALUE; +} +elseif ($created_time_limit == 'day') { + $created_time = time()-(3600*24); +} +elseif ($created_time_limit == 'week') { + $created_time = time()-(3600*24*7); +} +elseif ($created_time_limit == 'month') { + $created_time = time()-(3600*24*30); +} $metadata_name = $vars['entity']->metadata_name; -if (!isset($metadata_name)) - $metadata_name = ""; +if (!isset($metadata_name)) { + $metadata_name = 'tags'; +} else { + $metadata_name = $metadata_name; +} $threshold = $vars['entity']->threshold; if (!isset($threshold)) $threshold = 1; $widget_group = $vars["entity"]->widget_group; -if (!isset($widget_group)) $widget_group = ""; +if (empty($widget_group)) $widget_group = ELGG_ENTITIES_ANY_VALUE; -$options = array('type' => $maintype, 'subtype' => $subtype); +elgg_push_context('tags'); +$options = array('threshold' => $threshold, + 'limit' => $num_items, + 'type' => $maintype, + 'subtype' => $subtype, + 'tag_name' => $metadata_name, + 'created_time_lower' => $created_time, + 'container_guid' => $widget_group); + $body = elgg_view_tagcloud($options); -//$body = elgg_view_tagcloud($threshold, $num_items, $metadata_name, $maintype, $subtype, $widget_group , -1);; +elgg_pop_context(); + echo $body; ?> diff --git a/views/default/widgets/cloud_generic_index/edit.php b/views/default/widgets/cloud_generic_index/edit.php index 674605568..84b2fa861 100644 --- a/views/default/widgets/cloud_generic_index/edit.php +++ b/views/default/widgets/cloud_generic_index/edit.php @@ -1,6 +1,9 @@ num_items; if (!isset($num_items)) $num_items = 10; + + $created_time_limit = $vars['entity']->created_time_limit; + if (!isset($created_time_limit)) $created_time_limit = 'all'; $widget_group = $vars["entity"]->widget_group; if (!isset($widget_group)) $widget_group = ELGG_ENTITIES_ANY_VALUE; @@ -47,6 +50,20 @@ echo elgg_view('input/dropdown', array('name'=>'params[widget_subtype]', 'options_values'=>$subtype_list, 'value'=>$widget_subtype)); ?>

+

+ + : + '.elgg_view('input/dropdown', array('name'=>'params[created_time_limit]', 'options_values'=>$limit_list, 'value'=>$created_time_limit))."

"; + ?> +

+

: @@ -100,4 +117,4 @@ 'options_values'=>array('yes'=>'yes', 'no'=>'no'), 'value'=>$guest_only)); ?> -

\ No newline at end of file +

-- cgit v1.2.3