Dotclear

source: plugins/advancedTagList/_widget.php @ 1704

Revision 1704, 1.9 KB checked in by kozlika, 13 years ago (diff)

Spéciale cassededi pour Philippe le Rebelle histoire que je puisse corriger ses plougs.

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3#
4# This file is part of AdvancedTagList, a plugin for Dotclear 2.
5#
6# Copyright (c) 2009 Philippe Amalgame and contributors
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK ------------------------------------
12
13$core->addBehavior('initWidgets',array('avancedTagListBehaviors','initWidgets'));
14
15class avancedTagListBehaviors
16{
17     
18     public static function initWidgets(&$w)
19     {
20          global $core;
21          $w->create('AdvancedTagList',__('Advanced tags list'),array('publicAdvancedTagList','advancedTagList'));
22          $w->AdvancedTagList->setting('homeonly',__('Home page only'),1,'check');
23          $w->AdvancedTagList->setting('postcount',__('With entries counts'),0,'check');
24          $w->AdvancedTagList->setting('title',__('Title:'),__('Tags'));
25          $w->AdvancedTagList->setting('limit',__('Limit (empty means no limit):'),'20');
26          $w->AdvancedTagList->setting('sortby',__('Order by:'),'meta_id_lower','combo',
27               array(__('Tag name') => 'meta_id_lower', __('Entries count') => 'count')
28          );
29          $w->AdvancedTagList->setting('orderby',__('Sort:'),'asc','combo',
30               array(__('Ascending') => 'asc', __('Descending') => 'desc')
31          );
32         
33          $limit = '';
34         
35          $objMeta = new dcMeta($core);
36          $rs = $objMeta->getMeta('tag',$limit);
37         
38          if ($rs->isEmpty()) {
39               return;
40          }
41         
42          $sort = $w->sortby;
43          if (!in_array($sort,array('meta_id_lower','count'))) {
44               $sort = 'meta_id_lower';
45          }
46         
47          $order = $w->orderby;
48          if ($order != 'asc') {
49               $order = 'desc';
50          }
51         
52          $rs->sort($sort,$order);
53         
54          #$rs = $core->blog->getCategories($params);
55          if (!$rs->isEmpty()) {
56             while ($rs->fetch()) {
57                    $w->AdvancedTagList->setting($rs->meta_id,html::escapeHTML($rs->meta_id),true,'check');             
58               }
59          }
60     }
61}
62?>
Note: See TracBrowser for help on using the repository browser.

Sites map