1 | <?php
|
---|
2 | /* vim: set expandtab tabstop=4 shiftwidth=4: */
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Contains the Calendar_Decorator_Wrapper class
|
---|
6 | *
|
---|
7 | * PHP versions 4 and 5
|
---|
8 | *
|
---|
9 | * LICENSE: Redistribution and use in source and binary forms, with or without
|
---|
10 | * modification, are permitted provided that the following conditions are met:
|
---|
11 | * 1. Redistributions of source code must retain the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer.
|
---|
13 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
14 | * notice, this list of conditions and the following disclaimer in the
|
---|
15 | * documentation and/or other materials provided with the distribution.
|
---|
16 | * 3. The name of the author may not be used to endorse or promote products
|
---|
17 | * derived from this software without specific prior written permission.
|
---|
18 | *
|
---|
19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
---|
20 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
---|
21 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
22 | * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
|
---|
23 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
---|
24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
26 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
29 | *
|
---|
30 | * @category Date and Time
|
---|
31 | * @package Calendar
|
---|
32 | * @author Harry Fuecks <hfuecks@phppatterns.com>
|
---|
33 | * @author Lorenzo Alberton <l.alberton@quipo.it>
|
---|
34 | * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
---|
35 | * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
---|
36 | * @version CVS: $Id: Textual.php 246907 2007-11-24 11:04:24Z quipo $
|
---|
37 | * @link http://pear.php.net/package/Calendar
|
---|
38 | */
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Allows Calendar include path to be redefined
|
---|
42 | * @ignore
|
---|
43 | */
|
---|
44 | if (!defined('CALENDAR_ROOT')) {
|
---|
45 | define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
|
---|
46 | }
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Load Calendar decorator base class
|
---|
50 | */
|
---|
51 | require_once CALENDAR_ROOT.'Decorator.php';
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Load the Uri utility
|
---|
55 | */
|
---|
56 | require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php';
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * Decorator to help with fetching textual representations of months and
|
---|
60 | * days of the week.
|
---|
61 | * <b>Note:</b> for performance you should prefer Calendar_Util_Textual unless you
|
---|
62 | * have a specific need to use a decorator
|
---|
63 | *
|
---|
64 | * @category Date and Time
|
---|
65 | * @package Calendar
|
---|
66 | * @author Harry Fuecks <hfuecks@phppatterns.com>
|
---|
67 | * @author Lorenzo Alberton <l.alberton@quipo.it>
|
---|
68 | * @copyright 2003-2007 Harry Fuecks, Lorenzo Alberton
|
---|
69 | * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause)
|
---|
70 | * @link http://pear.php.net/package/Calendar
|
---|
71 | * @access public
|
---|
72 | */
|
---|
73 | class Calendar_Decorator_Textual extends Calendar_Decorator
|
---|
74 | {
|
---|
75 | /**
|
---|
76 | * Constructs Calendar_Decorator_Textual
|
---|
77 | *
|
---|
78 | * @param object &$Calendar subclass of Calendar
|
---|
79 | *
|
---|
80 | * @access public
|
---|
81 | */
|
---|
82 | function Calendar_Decorator_Textual(&$Calendar)
|
---|
83 | {
|
---|
84 | parent::Calendar_Decorator($Calendar);
|
---|
85 | }
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Returns an array of 12 month names (first index = 1)
|
---|
89 | *
|
---|
90 | * @param string $format (optional) format of returned months (one|two|short|long)
|
---|
91 | *
|
---|
92 | * @return array
|
---|
93 | * @access public
|
---|
94 | * @static
|
---|
95 | */
|
---|
96 | function monthNames($format = 'long')
|
---|
97 | {
|
---|
98 | return Calendar_Util_Textual::monthNames($format);
|
---|
99 | }
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Returns an array of 7 week day names (first index = 0)
|
---|
103 | *
|
---|
104 | * @param string $format (optional) format of returned days (one|two|short|long)
|
---|
105 | *
|
---|
106 | * @return array
|
---|
107 | * @access public
|
---|
108 | * @static
|
---|
109 | */
|
---|
110 | function weekdayNames($format = 'long')
|
---|
111 | {
|
---|
112 | return Calendar_Util_Textual::weekdayNames($format);
|
---|
113 | }
|
---|
114 |
|
---|
115 | /**
|
---|
116 | * Returns textual representation of the previous month of the decorated calendar object
|
---|
117 | *
|
---|
118 | * @param string $format (optional) format of returned months (one|two|short|long)
|
---|
119 | *
|
---|
120 | * @return string
|
---|
121 | * @access public
|
---|
122 | */
|
---|
123 | function prevMonthName($format = 'long')
|
---|
124 | {
|
---|
125 | return Calendar_Util_Textual::prevMonthName($this->calendar, $format);
|
---|
126 | }
|
---|
127 |
|
---|
128 | /**
|
---|
129 | * Returns textual representation of the month of the decorated calendar object
|
---|
130 | *
|
---|
131 | * @param string $format (optional) format of returned months (one|two|short|long)
|
---|
132 | *
|
---|
133 | * @return string
|
---|
134 | * @access public
|
---|
135 | */
|
---|
136 | function thisMonthName($format = 'long')
|
---|
137 | {
|
---|
138 | return Calendar_Util_Textual::thisMonthName($this->calendar, $format);
|
---|
139 | }
|
---|
140 |
|
---|
141 | /**
|
---|
142 | * Returns textual representation of the next month of the decorated calendar object
|
---|
143 | *
|
---|
144 | * @param string $format (optional) format of returned months (one|two|short|long)
|
---|
145 | *
|
---|
146 | * @return string
|
---|
147 | * @access public
|
---|
148 | */
|
---|
149 | function nextMonthName($format = 'long')
|
---|
150 | {
|
---|
151 | return Calendar_Util_Textual::nextMonthName($this->calendar, $format);
|
---|
152 | }
|
---|
153 |
|
---|
154 | /**
|
---|
155 | * Returns textual representation of the previous day of week of the decorated calendar object
|
---|
156 | *
|
---|
157 | * @param string $format (optional) format of returned months (one|two|short|long)
|
---|
158 | *
|
---|
159 | * @return string
|
---|
160 | * @access public
|
---|
161 | */
|
---|
162 | function prevDayName($format = 'long')
|
---|
163 | {
|
---|
164 | return Calendar_Util_Textual::prevDayName($this->calendar, $format);
|
---|
165 | }
|
---|
166 |
|
---|
167 | /**
|
---|
168 | * Returns textual representation of the day of week of the decorated calendar object
|
---|
169 | *
|
---|
170 | * @param string $format (optional) format of returned months (one|two|short|long)
|
---|
171 | *
|
---|
172 | * @return string
|
---|
173 | * @access public
|
---|
174 | */
|
---|
175 | function thisDayName($format = 'long')
|
---|
176 | {
|
---|
177 | return Calendar_Util_Textual::thisDayName($this->calendar, $format);
|
---|
178 | }
|
---|
179 |
|
---|
180 | /**
|
---|
181 | * Returns textual representation of the next day of week of the decorated calendar object
|
---|
182 | *
|
---|
183 | * @param string $format (optional) format of returned months (one|two|short|long)
|
---|
184 | *
|
---|
185 | * @return string
|
---|
186 | * @access public
|
---|
187 | */
|
---|
188 | function nextDayName($format = 'long')
|
---|
189 | {
|
---|
190 | return Calendar_Util_Textual::nextDayName($this->calendar, $format);
|
---|
191 | }
|
---|
192 |
|
---|
193 | /**
|
---|
194 | * Returns the days of the week using the order defined in the decorated
|
---|
195 | * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks
|
---|
196 | * and Calendar_Week. Otherwise the returned array will begin on Sunday
|
---|
197 | *
|
---|
198 | * @param string $format (optional) format of returned months (one|two|short|long)
|
---|
199 | *
|
---|
200 | * @return array ordered array of week day names
|
---|
201 | * @access public
|
---|
202 | */
|
---|
203 | function orderedWeekdays($format = 'long')
|
---|
204 | {
|
---|
205 | return Calendar_Util_Textual::orderedWeekdays($this->calendar, $format);
|
---|
206 | }
|
---|
207 | }
|
---|
208 | ?> |
---|