aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Martin <caedes@sindominio.net>2012-10-24 02:57:20 +0000
committerroot <root@migration.vz.lan>2012-10-24 02:57:35 +0000
commit8151550fc7966f9c0b039bc585d344b90548c6cc (patch)
treef78cbd70f2a886b05a72b1ef81ab1e25e89e3182
parentc2e217c291872cfad308c19707843dceecd233eb (diff)
downloadelgg-8151550fc7966f9c0b039bc585d344b90548c6cc.tar.gz
elgg-8151550fc7966f9c0b039bc585d344b90548c6cc.tar.bz2
fix tag cloud widget and add an option to filter latest.
-rw-r--r--languages/en.php8
-rw-r--r--views/default/widgets/cloud_generic_index/content.php45
-rw-r--r--views/default/widgets/cloud_generic_index/edit.php19
3 files changed, 62 insertions, 10 deletions
diff --git a/languages/en.php b/languages/en.php
index efab0aac1..9a930da9a 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -70,7 +70,13 @@
"custom_index_widgets:box_style" => "Box Style",
"custom_index_widgets:social_share_index" => "Social Share",
"custom_index_widgets:login_index"=>"Login",
- "admin:appearance:custom_index_widgets" => "Index Widgets"
+ "admin:appearance:custom_index_widgets" => "Index Widgets",
+ // time limit
+ "custom_index_widgets:widget_created_time_limit" => "Time lapse",
+ "custom_index_widgets:time_limit:all" => "All time",
+ "custom_index_widgets:time_limit:day" => "Last day",
+ "custom_index_widgets:time_limit:week" => "Last week",
+ "custom_index_widgets:time_limit:month" => "Last month"
);
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>