]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
fix tag cloud widget and add an option to filter latest.
authorPablo Martin <caedes@sindominio.net>
Wed, 24 Oct 2012 02:57:20 +0000 (02:57 +0000)
committerroot <root@migration.vz.lan>
Wed, 24 Oct 2012 02:57:35 +0000 (02:57 +0000)
languages/en.php
views/default/widgets/cloud_generic_index/content.php
views/default/widgets/cloud_generic_index/edit.php

index efab0aac13657c10184b8dba3b990f1b84858e68..9a930da9a72fa5d86e40ccf6d4b9914b315d1bbe 100644 (file)
                "custom_index_widgets:box_style" => "Box Style",\r
                "custom_index_widgets:social_share_index" => "Social Share",\r
                "custom_index_widgets:login_index"=>"Login",\r
-               "admin:appearance:custom_index_widgets" => "Index Widgets"\r
+               "admin:appearance:custom_index_widgets" => "Index Widgets",\r
+               // 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"
        \r
        );\r
                                        \r
index 1f4410f768fe9b833a4c4e08a831016444871b62..bee459e1d43f6eb314b2db15e812aa2eb9840ac7 100644 (file)
@@ -1,30 +1,59 @@
 <?php\r
-\r
 $maintype = "object";\r
 $subtype = $vars["entity"]->widget_subtype;\r
+if (empty($subtype) || $subtype == 'All') {\r
+       $subtype = ELGG_ENTITIES_ANY_VALUE;\r
+}\r
+\r
+if ($subtype == 'user') {$maintype='user';}\r
+if ($subtype == 'group') {$maintype='group';}\r
 \r
-if ($subtype == 'user') {$maintype='user'; $subtype='';}\r
-if ($subtype == 'group') {$maintype='group'; $subtype='';}\r
 \r
 $num_items = $vars['entity']->num_items;\r
 if (!isset($num_items))\r
     $num_items = 20;\r
+\r
+$created_time_limit = $vars['entity']->created_time_limit;\r
+if (!isset($created_time_limit)  || $created_time_limit == 'all') {\r
+    $created_time = ELGG_ENTITIES_ANY_VALUE;\r
+}\r
+elseif ($created_time_limit == 'day') {\r
+    $created_time = time()-(3600*24);\r
+}\r
+elseif ($created_time_limit == 'week') {\r
+    $created_time = time()-(3600*24*7);\r
+}\r
+elseif ($created_time_limit == 'month') {\r
+    $created_time = time()-(3600*24*30);\r
+}\r
        \r
 $metadata_name = $vars['entity']->metadata_name;\r
-if (!isset($metadata_name))\r
-    $metadata_name = "";\r
+if (!isset($metadata_name)) {\r
+    $metadata_name = 'tags';\r
+} else {\r
+    $metadata_name = $metadata_name;\r
+}\r
 \r
 $threshold = $vars['entity']->threshold;\r
 if (!isset($threshold))\r
     $threshold = 1;\r
        \r
 $widget_group = $vars["entity"]->widget_group;\r
-if (!isset($widget_group)) $widget_group = "";\r
+if (empty($widget_group)) $widget_group = ELGG_ENTITIES_ANY_VALUE;\r
 \r
 \r
-$options = array('type' => $maintype, 'subtype' => $subtype);\r
+elgg_push_context('tags');\r
+$options = array('threshold' => $threshold,\r
+               'limit' => $num_items,\r
+               'type' => $maintype,\r
+               'subtype' => $subtype,\r
+               'tag_name' => $metadata_name,\r
+               'created_time_lower' => $created_time,\r
+               'container_guid' => $widget_group);\r
+\r
 $body = elgg_view_tagcloud($options);\r
-//$body = elgg_view_tagcloud($threshold, $num_items, $metadata_name, $maintype, $subtype, $widget_group , -1);;\r
+elgg_pop_context();\r
+\r
 echo $body;\r
        \r
 ?>\r
index 674605568b5ffac49f7ac09050e7dba9eddaaef0..84b2fa861b9d7e8da6cbc6b761f428aaaec19a49 100644 (file)
@@ -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;
       echo elgg_view('input/dropdown', array('name'=>'params[widget_subtype]', 'options_values'=>$subtype_list, 'value'=>$widget_subtype));
       ?>
   </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'); ?>
       : 
                                                                                 'options_values'=>array('yes'=>'yes', 'no'=>'no'),
                                                                                         'value'=>$guest_only));
       ?>
-</p>
\ No newline at end of file
+</p>