Dotclear

source: plugins/advancedTagList/_widget.php @ 1347

Revision 1347, 1.5 KB checked in by philippe, 14 years ago (diff)

New plugin Advanced Tags List created

Line 
1<?php
2
3$core->addBehavior('initWidgets',array('avancedTagListBehaviors','initWidgets'));
4
5class avancedTagListBehaviors
6{
7     
8     public static function initWidgets(&$w)
9     {
10          global $core;
11          $w->create('AdvancedTagList',__('Advanced tags list'),array('publicAdvancedTagList','advancedTagList'));
12          $w->AdvancedTagList->setting('homeonly',__('Home page only'),1,'check');
13          $w->AdvancedTagList->setting('postcount',__('With entries counts'),0,'check');
14          $w->AdvancedTagList->setting('title',__('Title:'),__('Tags'));
15          $w->AdvancedTagList->setting('limit',__('Limit (empty means no limit):'),'20');
16          $w->AdvancedTagList->setting('sortby',__('Order by:'),'meta_id_lower','combo',
17               array(__('Tag name') => 'meta_id_lower', __('Entries count') => 'count')
18          );
19          $w->AdvancedTagList->setting('orderby',__('Sort:'),'asc','combo',
20               array(__('Ascending') => 'asc', __('Descending') => 'desc')
21          );
22         
23          $limit = '';
24         
25          $objMeta = new dcMeta($core);
26          $rs = $objMeta->getMeta('tag',$limit);
27         
28          if ($rs->isEmpty()) {
29               return;
30          }
31         
32          $sort = $w->sortby;
33          if (!in_array($sort,array('meta_id_lower','count'))) {
34               $sort = 'meta_id_lower';
35          }
36         
37          $order = $w->orderby;
38          if ($order != 'asc') {
39               $order = 'desc';
40          }
41         
42          $rs->sort($sort,$order);
43         
44          #$rs = $core->blog->getCategories($params);
45          if (!$rs->isEmpty()) {
46             while ($rs->fetch()) {
47                    $w->AdvancedTagList->setting($rs->meta_id,html::escapeHTML($rs->meta_id),true,'check');             
48               }
49          }
50     }
51}
52?>
Note: See TracBrowser for help on using the repository browser.

Sites map