| 1 | <?php |
|---|
| 2 | /* vim: set expandtab tabstop=4 shiftwidth=4: */ |
|---|
| 3 | // |
|---|
| 4 | // +----------------------------------------------------------------------+ |
|---|
| 5 | // | PHP Version 4 | |
|---|
| 6 | // +----------------------------------------------------------------------+ |
|---|
| 7 | // | Copyright (c) 1997-2002 The PHP Group | |
|---|
| 8 | // +----------------------------------------------------------------------+ |
|---|
| 9 | // | This source file is subject to version 2.02 of the PHP license, | |
|---|
| 10 | // | that is bundled with this package in the file LICENSE, and is | |
|---|
| 11 | // | available at through the world-wide-web at | |
|---|
| 12 | // | http://www.php.net/license/3_0.txt. | |
|---|
| 13 | // | If you did not receive a copy of the PHP license and are unable to | |
|---|
| 14 | // | obtain it through the world-wide-web, please send a note to | |
|---|
| 15 | // | [email protected] so we can mail you a copy immediately. | |
|---|
| 16 | // +----------------------------------------------------------------------+ |
|---|
| 17 | // | Authors: Harry Fuecks <[email protected]> | |
|---|
| 18 | // | Lorenzo Alberton <l dot alberton at quipo dot it> | |
|---|
| 19 | // +----------------------------------------------------------------------+ |
|---|
| 20 | // |
|---|
| 21 | // $Id: Textual.php,v 1.3 2004/08/16 13:02:44 hfuecks Exp $ |
|---|
| 22 | // |
|---|
| 23 | /** |
|---|
| 24 | * @package Calendar |
|---|
| 25 | * @version $Id: Textual.php,v 1.3 2004/08/16 13:02:44 hfuecks Exp $ |
|---|
| 26 | */ |
|---|
| 27 | |
|---|
| 28 | /** |
|---|
| 29 | * Allows Calendar include path to be redefined |
|---|
| 30 | * @ignore |
|---|
| 31 | */ |
|---|
| 32 | if (!defined('CALENDAR_ROOT')) { |
|---|
| 33 | define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR); |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | /** |
|---|
| 37 | * Load Calendar decorator base class |
|---|
| 38 | */ |
|---|
| 39 | require_once CALENDAR_ROOT.'Decorator.php'; |
|---|
| 40 | |
|---|
| 41 | /** |
|---|
| 42 | * Load the Uri utility |
|---|
| 43 | */ |
|---|
| 44 | require_once CALENDAR_ROOT.'Util'.DIRECTORY_SEPARATOR.'Textual.php'; |
|---|
| 45 | |
|---|
| 46 | /** |
|---|
| 47 | * Decorator to help with fetching textual representations of months and |
|---|
| 48 | * days of the week. |
|---|
| 49 | * <b>Note:</b> for performance you should prefer Calendar_Util_Textual unless you |
|---|
| 50 | * have a specific need to use a decorator |
|---|
| 51 | * @package Calendar |
|---|
| 52 | * @access public |
|---|
| 53 | */ |
|---|
| 54 | class Calendar_Decorator_Textual extends Calendar_Decorator |
|---|
| 55 | { |
|---|
| 56 | /** |
|---|
| 57 | * Constructs Calendar_Decorator_Textual |
|---|
| 58 | * @param object subclass of Calendar |
|---|
| 59 | * @access public |
|---|
| 60 | */ |
|---|
| 61 | function Calendar_Decorator_Textual(&$Calendar) |
|---|
| 62 | { |
|---|
| 63 | parent::Calendar_Decorator($Calendar); |
|---|
| 64 | } |
|---|
| 65 | |
|---|
| 66 | /** |
|---|
| 67 | * Returns an array of 12 month names (first index = 1) |
|---|
| 68 | * @param string (optional) format of returned months (one,two,short or long) |
|---|
| 69 | * @return array |
|---|
| 70 | * @access public |
|---|
| 71 | * @static |
|---|
| 72 | */ |
|---|
| 73 | function monthNames($format='long') |
|---|
| 74 | { |
|---|
| 75 | return Calendar_Util_Textual::monthNames($format); |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | /** |
|---|
| 79 | * Returns an array of 7 week day names (first index = 0) |
|---|
| 80 | * @param string (optional) format of returned days (one,two,short or long) |
|---|
| 81 | * @return array |
|---|
| 82 | * @access public |
|---|
| 83 | * @static |
|---|
| 84 | */ |
|---|
| 85 | function weekdayNames($format='long') |
|---|
| 86 | { |
|---|
| 87 | return Calendar_Util_Textual::weekdayNames($format); |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | /** |
|---|
| 91 | * Returns textual representation of the previous month of the decorated calendar object |
|---|
| 92 | * @param string (optional) format of returned months (one,two,short or long) |
|---|
| 93 | * @return string |
|---|
| 94 | * @access public |
|---|
| 95 | */ |
|---|
| 96 | function prevMonthName($format='long') |
|---|
| 97 | { |
|---|
| 98 | return Calendar_Util_Textual::prevMonthName($this->calendar,$format); |
|---|
| 99 | } |
|---|
| 100 | |
|---|
| 101 | /** |
|---|
| 102 | * Returns textual representation of the month of the decorated calendar object |
|---|
| 103 | * @param string (optional) format of returned months (one,two,short or long) |
|---|
| 104 | * @return string |
|---|
| 105 | * @access public |
|---|
| 106 | */ |
|---|
| 107 | function thisMonthName($format='long') |
|---|
| 108 | { |
|---|
| 109 | return Calendar_Util_Textual::thisMonthName($this->calendar,$format); |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | /** |
|---|
| 113 | * Returns textual representation of the next month of the decorated calendar object |
|---|
| 114 | * @param string (optional) format of returned months (one,two,short or long) |
|---|
| 115 | * @return string |
|---|
| 116 | * @access public |
|---|
| 117 | */ |
|---|
| 118 | function nextMonthName($format='long') |
|---|
| 119 | { |
|---|
| 120 | return Calendar_Util_Textual::nextMonthName($this->calendar,$format); |
|---|
| 121 | } |
|---|
| 122 | |
|---|
| 123 | /** |
|---|
| 124 | * Returns textual representation of the previous day of week of the decorated calendar object |
|---|
| 125 | * @param string (optional) format of returned months (one,two,short or long) |
|---|
| 126 | * @return string |
|---|
| 127 | * @access public |
|---|
| 128 | */ |
|---|
| 129 | function prevDayName($format='long') |
|---|
| 130 | { |
|---|
| 131 | return Calendar_Util_Textual::prevDayName($this->calendar,$format); |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | /** |
|---|
| 135 | * Returns textual representation of the day of week of the decorated calendar object |
|---|
| 136 | * @param string (optional) format of returned months (one,two,short or long) |
|---|
| 137 | * @return string |
|---|
| 138 | * @access public |
|---|
| 139 | */ |
|---|
| 140 | function thisDayName($format='long') |
|---|
| 141 | { |
|---|
| 142 | return Calendar_Util_Textual::thisDayName($this->calendar,$format); |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | /** |
|---|
| 146 | * Returns textual representation of the next day of week of the decorated calendar object |
|---|
| 147 | * @param string (optional) format of returned months (one,two,short or long) |
|---|
| 148 | * @return string |
|---|
| 149 | * @access public |
|---|
| 150 | */ |
|---|
| 151 | function nextDayName($format='long') |
|---|
| 152 | { |
|---|
| 153 | return Calendar_Util_Textual::nextDayName($this->calendar,$format); |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | /** |
|---|
| 157 | * Returns the days of the week using the order defined in the decorated |
|---|
| 158 | * calendar object. Only useful for Calendar_Month_Weekdays, Calendar_Month_Weeks |
|---|
| 159 | * and Calendar_Week. Otherwise the returned array will begin on Sunday |
|---|
| 160 | * @param string (optional) format of returned months (one,two,short or long) |
|---|
| 161 | * @return array ordered array of week day names |
|---|
| 162 | * @access public |
|---|
| 163 | */ |
|---|
| 164 | function orderedWeekdays($format='long') |
|---|
| 165 | { |
|---|
| 166 | return Calendar_Util_Textual::orderedWeekdays($this->calendar,$format); |
|---|
| 167 | } |
|---|
| 168 | } |
|---|
| 169 | ?> |
|---|