diff options
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/widgets/cloud_generic_index/content.php | 45 | ||||
-rw-r--r-- | views/default/widgets/cloud_generic_index/edit.php | 19 |
2 files changed, 55 insertions, 9 deletions
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 @@ <?php
-
$maintype = "object";
$subtype = $vars["entity"]->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 @@ <?php $num_items = $vars['entity']->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; @@ -48,6 +51,20 @@ ?> </p> <p> + <?php echo elgg_echo('custom_index_widgets:widget_created_time_limit'); ?> + : + <?php + + $limits = array('all', 'month', 'week', 'day'); + $limit_list = array(); + foreach($limits as $limit) { + $limit_list[$limit] = elgg_echo("custom_index_widgets:time_limit:$limit"); + } + echo '<p>'.elgg_view('input/dropdown', array('name'=>'params[created_time_limit]', 'options_values'=>$limit_list, 'value'=>$created_time_limit))."</p>"; + ?> + </p> + + <p> <?php echo elgg_echo('group'); ?> : <?php @@ -100,4 +117,4 @@ 'options_values'=>array('yes'=>'yes', 'no'=>'no'), 'value'=>$guest_only)); ?> -</p>
\ No newline at end of file +</p> |