Dotclear

source: plugins/dayMode/_widgets.php @ 3347

Revision 3347, 2.0 KB checked in by brol, 9 years ago (diff)

voir changelog

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3#
4# This file is part of dayMode, a plugin for Dotclear 2.
5#
6# Copyright (c) 2006-2010 Pep 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 ------------------------------------
12if (!defined('DC_RC_PATH')) return;
13
14$core->addBehavior('initWidgets',array('widgetsDayMode','init'));
15
16class widgetsDayMode
17{
18     public static function calendar($w)
19     {
20          global $core;
21
22          if (!$core->blog->settings->daymode->daymode_active) return;
23
24          if ($w->offline)
25               return;
26
27          if (($w->homeonly == 1 && $core->url->type != 'default') ||
28               ($w->homeonly == 2 && $core->url->type == 'default') ||
29      ($w->homeonly == 3 && $core->url->type != 'archive'))
30               return;
31
32          $calendar = new dcCalendar($GLOBALS['core'], $GLOBALS['_ctx']);
33          $calendar->weekstart = $w->weekstart;
34
35          $res =
36          ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
37          $calendar->draw();
38
39          return $w->renderDiv($w->content_only,'calendar '.$w->class,'',$res);
40     }
41
42     public static function init($w)
43     {
44         $w->create('calendar',__('DayMode: calendar'),array('widgetsDayMode','calendar'),
45               null,
46               __('Tickets calendar'));
47         $w->calendar->setting('title',__('Title:'),__('Calendar'));
48         $w->calendar->setting(
49          'weekstart',
50          __('First day:'),
51          0,
52          'combo',
53          array_flip(array(
54               __('Sunday'),
55               __('Monday'),
56               __('Tuesday'),
57               __('Wednesday'),
58               __('Thursday'),
59               __('Friday'),
60               __('Saturday')
61          ))
62         );
63          $w->calendar->setting('homeonly',__('Display on:'),3,'combo',
64               array(
65                    __('All pages') => 0,
66                    __('Home page only') => 1,
67                    __('Except on home page') => 2,
68                    __('Archives only') => 3
69                    )
70          );
71          $w->calendar->setting('content_only',__('Content only'),0,'check');
72          $w->calendar->setting('class',__('CSS class:'),'');
73          $w->calendar->setting('offline',__('Offline'),0,'check');
74     }
75}
Note: See TracBrowser for help on using the repository browser.

Sites map