Dotclear

source: plugins/dayMode/_widgets.php @ 939

Revision 939, 1.9 KB checked in by pep, 15 years ago (diff)

dayMode : initial import in DC Lab.

Line 
1<?php
2# ***** BEGIN LICENSE BLOCK *****
3# This file is part of dayMode, a plugin for DotClear2.
4# Copyright (c) 2006-2008 Pep and contributors. All rights
5# reserved.
6#
7# This plugin is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This plugin is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this plugin; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20#
21# ***** END LICENSE BLOCK *****
22
23$core->addBehavior('initWidgets',array('widgetsDayMode','init'));
24
25class widgetsDayMode
26{
27     public static function calendar(&$w)
28     {
29          global $core;
30
31          if (!$core->blog->settings->daymode_active) return;
32         
33          if ($w->archiveonly && $core->url->type != 'archive') {
34               return;
35          }
36
37          $calendar = new dcCalendar($GLOBALS['core'], $GLOBALS['_ctx']);
38          $calendar->weekstart = $w->weekstart;
39
40          $res =
41          '<div id="calendar">'.
42          ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : '').
43          $calendar->draw().
44          '</div>';
45          return $res;
46     }
47
48     public static function init(&$w)
49     {
50         $w->create('calendar',__('Calendar'),array('widgetsDayMode','calendar'));
51         $w->calendar->setting('title',__('Title:'),__('Calendar'));
52         $w->calendar->setting(
53          'weekstart',
54          __('Week start'),
55          0,
56          'combo',
57          array_flip(array(
58               __('Sunday'),
59               __('Monday'),
60               __('Tuesday'),
61               __('Wednesday'),
62               __('Thursday'),
63               __('Friday'),
64               __('Saturday')
65          ))
66         );
67         $w->calendar->setting('archiveonly',__('Archives only'),1,'check');
68     }
69}
70?>
Note: See TracBrowser for help on using the repository browser.

Sites map