Dotclear

source: plugins/rateIt/_widgets.php @ 1865

Revision 1865, 4.2 KB checked in by JcDenis, 13 years ago (diff)

rateIt 0.9.7:

  • Added entryFirstImage to wigdet
  • Fixed bug with date sorting on widget
  • Fixed bug with plugin ativityReport
  • Removed about tabs and fixed typo
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of rateIt, a plugin for Dotclear 2.
4#
5# Copyright (c) 2009 JC Denis and contributors
6# jcdenis@gdwd.com
7#
8# Licensed under the GPL version 2.0 license.
9# A copy of this license is available in LICENSE file or at
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11# -- END LICENSE BLOCK ------------------------------------
12
13if (!defined('DC_RC_PATH')){return;}
14
15$core->addBehavior('initWidgets',array('rateItAdminWidget','vote'));
16$core->addBehavior('initWidgets',array('rateItAdminWidget','rank'));
17
18class rateItAdminWidget
19{
20     public static function vote($w)
21     {
22          global $core;
23
24          $w->create('rateit',__('Rating'),
25               array('rateItPublicWidget','vote'));
26          $w->rateit->setting('enable_post',__('Enable vote for entries'),
27               1,'check');
28          $w->rateit->setting('title_post',__('Title for entries:'),
29               __('Rate this entry'),'text');
30
31          $w->rateit->setting('enable_cat',__('Enable vote for categories'),
32               0,'check');
33          $w->rateit->setting('title_cat',__('Title for categories:'),
34               __('Rate this category'),'text');
35
36          if ($core->plugins->moduleExists('metadata')) {
37               $w->rateit->setting('enable_tag',__('Enable vote for tags'),
38                    0,'check');
39               $w->rateit->setting('title_tag',__('Title for tags:'),
40                    __('Rate this tag'),'text');
41          }
42
43          if ($core->plugins->moduleExists('gallery')) {
44               $w->rateit->setting('enable_gal',__('Enable vote for gallery'),
45                    0,'check');
46               $w->rateit->setting('title_gal',__('Title for gallery:'),
47                    __('Rate this gallery'),'text');
48               $w->rateit->setting('enable_galitem',__('Enable vote for gallery item'),
49                    0,'check');
50               $w->rateit->setting('title_galitem',__('Title for gallery item:'),
51                    __('Rate this gallery item'),'text');
52          }
53
54          # --BEHAVIOR-- initWidgetRateItVote
55          $core->callBehavior('initWidgetRateItVote',$w);
56
57
58          $w->rateit->setting('show_fullnote',__('Show full note'),'full','combo',
59               array(__('Hidden')=>'hide',__('Full note (5/20)')=>'full',__('Percent (25%)')=>'percent'));
60          $w->rateit->setting('show_note',__('Show note'),
61               1,'check');
62          $w->rateit->setting('show_vote',__('Show the count of vote'),
63               1,'check');
64          $w->rateit->setting('show_higher',__('Show the highest rate'),
65               1,'check');
66          $w->rateit->setting('show_lower',__('Show the lowest rate'),
67               1,'check');
68          $w->rateit->setting('type','type','','hidden');
69          $w->rateit->setting('id','id','0','hidden');
70          $w->rateit->setting('title','title','rateIt','hidden');
71     }
72
73     public static function rank($w)
74     {
75          global $core;
76
77          $w->create('rateitrank',__('Top rating'),
78               array('rateItPublicWidget','rank'));
79          $w->rateitrank->setting('title',__('Title:'),
80               __('Top rated entries'),'text');
81
82          $types = new ArrayObject();
83
84
85          # --BEHAVIOR-- initWidgetRateItRank
86          $core->callBehavior('initWidgetRateItRank',$types);
87
88
89          $types[] = array(__('entries')=>'post');
90          $types[] = array(__('Comments')=>'comment');
91          $types[] = array(__('Categories')=>'category');
92
93          if ($core->plugins->moduleExists('metadata')) {
94               $types[] = array(__('Tag')=>'tag');
95          }
96          if ($core->plugins->moduleExists('gallery')) {
97               $types[] = array(__('Gallery')=>'gal');
98               $types[] = array(__('Gallery item')=>'galitem');
99          }
100
101          $types = (array) $types;
102          $combo = array();
103          foreach($types as $k => $v){
104               $combo = array_merge($v,$combo);
105          }
106
107          $w->rateitrank->setting('type',__('Type:'),'post','combo',$combo);
108         
109          $w->rateitrank->setting('limit',__('Length:'),3,'combo',array(
110               1=>1,2=>2,3=>3,4=>4,5=>5,10=>10,15=>15,20=>20));
111          $w->rateitrank->setting('sortby',__('Order by:'),'rateit_avg','combo',array(
112               __('Note') => 'rateit_avg',
113               __('Votes') => 'rateit_total',
114               __('Date') => 'rateit_time'));
115          $w->rateitrank->setting('sort',__('Sort:'),'desc','combo',array(
116               __('Ascending') => 'asc',
117               __('Descending') => 'desc'));
118          $w->rateitrank->setting('text',__('Text'),'%rank% %title% (%note%/%quotient%)','text');
119          $w->rateitrank->setting('titlelen',__('Title length (if truncate)'),100);
120          $w->rateitrank->setting('homeonly',__('Home page only'),1,'check');
121          $w->rateitrank->setting('sql','sql','','hidden');
122     }
123}
124?>
Note: See TracBrowser for help on using the repository browser.

Sites map