Complex classes like HTML_QuickForm_date often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use HTML_QuickForm_date, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 36 | class HTML_QuickForm_date extends HTML_QuickForm_group |
||
| 37 | { |
||
| 38 | // {{{ properties |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Various options to control the element's display. |
||
| 42 | * |
||
| 43 | * @access private |
||
| 44 | * @var array |
||
| 45 | */ |
||
| 46 | var $_options = array( |
||
| 47 | 'language' => 'en', |
||
| 48 | 'format' => 'dMY', |
||
| 49 | 'minYear' => 2001, |
||
| 50 | 'maxYear' => 2090, |
||
| 51 | 'addEmptyOption' => false, |
||
| 52 | 'emptyOptionValue' => '', |
||
| 53 | 'emptyOptionText' => ' ', |
||
| 54 | 'optionIncrement' => array('i' => 1, 's' => 1) |
||
| 55 | ); |
||
| 56 | |||
| 57 | /** |
||
| 58 | * These complement separators, they are appended to the resultant HTML |
||
| 59 | * @access private |
||
| 60 | * @var array |
||
| 61 | */ |
||
| 62 | var $_wrap = array('', ''); |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Options in different languages |
||
| 66 | * |
||
| 67 | * Note to potential translators: to avoid encoding problems please send |
||
| 68 | * your translations with "weird" letters encoded as HTML Unicode entities |
||
| 69 | * |
||
| 70 | * @access private |
||
| 71 | * @var array |
||
| 72 | */ |
||
| 73 | var $_locale = array( |
||
| 74 | 'en' => array ( |
||
| 75 | 'weekdays_short'=> array ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'), |
||
| 76 | 'weekdays_long' => array ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'), |
||
| 77 | 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), |
||
| 78 | 'months_long' => array ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') |
||
| 79 | ), |
||
| 80 | 'de' => array ( |
||
| 81 | 'weekdays_short'=> array ('So', 'Mon', 'Di', 'Mi', 'Do', 'Fr', 'Sa'), |
||
| 82 | 'weekdays_long' => array ('Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'), |
||
| 83 | 'months_short' => array ('Jan', 'Feb', 'März', 'April', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'), |
||
| 84 | 'months_long' => array ('Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember') |
||
| 85 | ), |
||
| 86 | 'fr' => array ( |
||
| 87 | 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'), |
||
| 88 | 'weekdays_long' => array ('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'), |
||
| 89 | 'months_short' => array ('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sep', 'Oct', 'Nov', 'Déc'), |
||
| 90 | 'months_long' => array ('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre') |
||
| 91 | ), |
||
| 92 | 'hu' => array ( |
||
| 93 | 'weekdays_short'=> array ('V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'), |
||
| 94 | 'weekdays_long' => array ('vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'), |
||
| 95 | 'months_short' => array ('jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'), |
||
| 96 | 'months_long' => array ('január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december') |
||
| 97 | ), |
||
| 98 | 'pl' => array ( |
||
| 99 | 'weekdays_short'=> array ('Nie', 'Pn', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob'), |
||
| 100 | 'weekdays_long' => array ('Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'), |
||
| 101 | 'months_short' => array ('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'), |
||
| 102 | 'months_long' => array ('Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień') |
||
| 103 | ), |
||
| 104 | 'sl' => array ( |
||
| 105 | 'weekdays_short'=> array ('Ned', 'Pon', 'Tor', 'Sre', 'Cet', 'Pet', 'Sob'), |
||
| 106 | 'weekdays_long' => array ('Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'Cetrtek', 'Petek', 'Sobota'), |
||
| 107 | 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'), |
||
| 108 | 'months_long' => array ('Januar', 'Februar', 'Marec', 'April', 'Maj', 'Junij', 'Julij', 'Avgust', 'September', 'Oktober', 'November', 'December') |
||
| 109 | ), |
||
| 110 | 'ru' => array ( |
||
| 111 | 'weekdays_short'=> array ('Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'), |
||
| 112 | 'weekdays_long' => array ('Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'), |
||
| 113 | 'months_short' => array ('Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'), |
||
| 114 | 'months_long' => array ('Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь') |
||
| 115 | ), |
||
| 116 | 'es' => array ( |
||
| 117 | 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'), |
||
| 118 | 'weekdays_long' => array ('Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'), |
||
| 119 | 'months_short' => array ('Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'), |
||
| 120 | 'months_long' => array ('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre') |
||
| 121 | ), |
||
| 122 | 'da' => array ( |
||
| 123 | 'weekdays_short'=> array ('Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'), |
||
| 124 | 'weekdays_long' => array ('Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'), |
||
| 125 | 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'), |
||
| 126 | 'months_long' => array ('Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December') |
||
| 127 | ), |
||
| 128 | 'is' => array ( |
||
| 129 | 'weekdays_short'=> array ('Sun', 'Mán', 'Þri', 'Mið', 'Fim', 'Fös', 'Lau'), |
||
| 130 | 'weekdays_long' => array ('Sunnudagur', 'Mánudagur', 'Þriðjudagur', 'Miðvikudagur', 'Fimmtudagur', 'Föstudagur', 'Laugardagur'), |
||
| 131 | 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maí', 'Jún', 'Júl', 'Ágú', 'Sep', 'Okt', 'Nóv', 'Des'), |
||
| 132 | 'months_long' => array ('Janúar', 'Febrúar', 'Mars', 'Apríl', 'Maí', 'Júní', 'Júlí', 'Ágúst', 'September', 'Október', 'Nóvember', 'Desember') |
||
| 133 | ), |
||
| 134 | 'it' => array ( |
||
| 135 | 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'), |
||
| 136 | 'weekdays_long' => array ('Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'), |
||
| 137 | 'months_short' => array ('Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'), |
||
| 138 | 'months_long' => array ('Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre') |
||
| 139 | ), |
||
| 140 | 'sk' => array ( |
||
| 141 | 'weekdays_short'=> array ('Ned', 'Pon', 'Uto', 'Str', 'Štv', 'Pia', 'Sob'), |
||
| 142 | 'weekdays_long' => array ('Nedeža', 'Pondelok', 'Utorok', 'Streda', 'Štvrtok', 'Piatok', 'Sobota'), |
||
| 143 | 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Máj', 'Jún', 'Júl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'), |
||
| 144 | 'months_long' => array ('Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December') |
||
| 145 | ), |
||
| 146 | 'cs' => array ( |
||
| 147 | 'weekdays_short'=> array ('Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'), |
||
| 148 | 'weekdays_long' => array ('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'), |
||
| 149 | 'months_short' => array ('Led', 'Úno', 'Bře', 'Dub', 'Kvě', 'Čen', 'Čec', 'Srp', 'Zář', 'Říj', 'Lis', 'Pro'), |
||
| 150 | 'months_long' => array ('Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec') |
||
| 151 | ), |
||
| 152 | 'hy' => array ( |
||
| 153 | 'weekdays_short'=> array ('Կրկ', 'Երկ', 'Երք', 'Չրք', 'Հնգ', 'Ուր', 'Շբթ'), |
||
| 154 | 'weekdays_long' => array ('Կիրակի', 'Երկուշաբթի', 'Երեքշաբթի', 'Չորեքշաբթի', 'Հինգշաբթի', 'Ուրբաթ', 'Շաբաթ'), |
||
| 155 | 'months_short' => array ('Հնվ', 'Փտր', 'Մրտ', 'Ապր', 'Մյս', 'Հնս', 'Հլս', 'Օգս', 'Սպտ', 'Հկտ', 'Նյմ', 'Դկտ'), |
||
| 156 | 'months_long' => array ('Հունվար', 'Փետրվար', 'Մարտ', 'Ապրիլ', 'Մայիս', 'Հունիս', 'Հուլիս', 'Օգոստոս', 'Սեպտեմբեր', 'Հոկտեմբեր', 'Նոյեմբեր', 'Դեկտեմբեր') |
||
| 157 | ), |
||
| 158 | 'nl' => array ( |
||
| 159 | 'weekdays_short'=> array ('Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'), |
||
| 160 | 'weekdays_long' => array ('Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'), |
||
| 161 | 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'), |
||
| 162 | 'months_long' => array ('Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December') |
||
| 163 | ), |
||
| 164 | 'et' => array ( |
||
| 165 | 'weekdays_short'=> array ('P', 'E', 'T', 'K', 'N', 'R', 'L'), |
||
| 166 | 'weekdays_long' => array ('Pühapäev', 'Esmaspäev', 'Teisipäev', 'Kolmapäev', 'Neljapäev', 'Reede', 'Laupäev'), |
||
| 167 | 'months_short' => array ('Jaan', 'Veebr', 'Märts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'), |
||
| 168 | 'months_long' => array ('Jaanuar', 'Veebruar', 'Märts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'August', 'September', 'Oktoober', 'November', 'Detsember') |
||
| 169 | ), |
||
| 170 | 'tr' => array ( |
||
| 171 | 'weekdays_short'=> array ('Paz', 'Pzt', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'), |
||
| 172 | 'weekdays_long' => array ('Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'), |
||
| 173 | 'months_short' => array ('Ock', 'Şbt', 'Mrt', 'Nsn', 'Mys', 'Hzrn', 'Tmmz', 'Ağst', 'Eyl', 'Ekm', 'Ksm', 'Arlk'), |
||
| 174 | 'months_long' => array ('Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık') |
||
| 175 | ), |
||
| 176 | 'no' => array ( |
||
| 177 | 'weekdays_short'=> array ('Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'), |
||
| 178 | 'weekdays_long' => array ('Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'), |
||
| 179 | 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'), |
||
| 180 | 'months_long' => array ('Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember') |
||
| 181 | ), |
||
| 182 | 'eo' => array ( |
||
| 183 | 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Ĵaŭ', 'Ven', 'Sab'), |
||
| 184 | 'weekdays_long' => array ('Dimanĉo', 'Lundo', 'Mardo', 'Merkredo', 'Ĵaŭdo', 'Vendredo', 'Sabato'), |
||
| 185 | 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aŭg', 'Sep', 'Okt', 'Nov', 'Dec'), |
||
| 186 | 'months_long' => array ('Januaro', 'Februaro', 'Marto', 'Aprilo', 'Majo', 'Junio', 'Julio', 'Aŭgusto', 'Septembro', 'Oktobro', 'Novembro', 'Decembro') |
||
| 187 | ), |
||
| 188 | 'ua' => array ( |
||
| 189 | 'weekdays_short'=> array('Ндл', 'Пнд', 'Втр', 'Срд', 'Чтв', 'Птн', 'Сбт'), |
||
| 190 | 'weekdays_long' => array('Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', 'П\'ятниця', 'Субота'), |
||
| 191 | 'months_short' => array('Січ', 'Лют', 'Бер', 'Кві', 'Тра', 'Чер', 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Гру'), |
||
| 192 | 'months_long' => array('Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень') |
||
| 193 | ), |
||
| 194 | 'ro' => array ( |
||
| 195 | 'weekdays_short'=> array ('Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'), |
||
| 196 | 'weekdays_long' => array ('Duminica', 'Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sambata'), |
||
| 197 | 'months_short' => array ('Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), |
||
| 198 | 'months_long' => array ('Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Iunie', 'Iulie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie') |
||
| 199 | ), |
||
| 200 | 'he' => array ( |
||
| 201 | 'weekdays_short'=> array ('ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'), |
||
| 202 | 'weekdays_long' => array ('יום ראשון', 'יום שני', 'יום שלישי', 'יום רביעי', 'יום חמישי', 'יום שישי', 'שבת'), |
||
| 203 | 'months_short' => array ('ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'), |
||
| 204 | 'months_long' => array ('ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר') |
||
| 205 | ), |
||
| 206 | 'sv' => array ( |
||
| 207 | 'weekdays_short'=> array ('Sön', 'Mån', 'Tis', 'Ons', 'Tor', 'Fre', 'Lör'), |
||
| 208 | 'weekdays_long' => array ('Söndag', 'Måndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lördag'), |
||
| 209 | 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'), |
||
| 210 | 'months_long' => array ('Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December') |
||
| 211 | ), |
||
| 212 | 'pt' => array ( |
||
| 213 | 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'), |
||
| 214 | 'weekdays_long' => array ('Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'), |
||
| 215 | 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'), |
||
| 216 | 'months_long' => array ('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro') |
||
| 217 | ), |
||
| 218 | 'tw' => array ( |
||
| 219 | 'weekdays_short'=> array ('週日','週一', '週二','週三', '週四','週五', '週六'), |
||
| 220 | 'weekdays_long' => array ('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'), |
||
| 221 | 'months_short' => array ('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'), |
||
| 222 | 'months_long' => array ('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月') |
||
| 223 | ), |
||
| 224 | 'pt-br' => array ( |
||
| 225 | 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'), |
||
| 226 | 'weekdays_long' => array ('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'), |
||
| 227 | 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'), |
||
| 228 | 'months_long' => array ('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro') |
||
| 229 | ) |
||
| 230 | ); |
||
| 231 | |||
| 232 | // }}} |
||
| 233 | // {{{ constructor |
||
| 234 | |||
| 235 | /** |
||
| 236 | * Class constructor |
||
| 237 | * |
||
| 238 | * The following keys may appear in $options array: |
||
| 239 | * - 'language': date language |
||
| 240 | * - 'format': Format of the date, based on PHP's date() function. |
||
| 241 | * The following characters are currently recognised in format string: |
||
| 242 | * <pre> |
||
| 243 | * D => Short names of days |
||
| 244 | * l => Long names of days |
||
| 245 | * d => Day numbers |
||
| 246 | * M => Short names of months |
||
| 247 | * F => Long names of months |
||
| 248 | * m => Month numbers |
||
| 249 | * Y => Four digit year |
||
| 250 | * y => Two digit year |
||
| 251 | * h => 12 hour format |
||
| 252 | * H => 23 hour format |
||
| 253 | * i => Minutes |
||
| 254 | * s => Seconds |
||
| 255 | * a => am/pm |
||
| 256 | * A => AM/PM |
||
| 257 | * </pre> |
||
| 258 | * - 'minYear': Minimum year in year select |
||
| 259 | * - 'maxYear': Maximum year in year select |
||
| 260 | * - 'addEmptyOption': Should an empty option be added to the top of |
||
| 261 | * each select box? |
||
| 262 | * - 'emptyOptionValue': The value passed by the empty option. |
||
| 263 | * - 'emptyOptionText': The text displayed for the empty option. |
||
| 264 | * - 'optionIncrement': Step to increase the option values by (works for 'i' and 's') |
||
| 265 | * |
||
| 266 | * @access public |
||
| 267 | * @param string Element's name |
||
| 268 | * @param mixed Label(s) for an element |
||
| 269 | * @param array Options to control the element's display |
||
| 270 | * @param mixed Either a typical HTML attribute string or an associative array |
||
| 271 | */ |
||
| 272 | public function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null) |
||
| 273 | { |
||
| 274 | parent::__construct($elementName, $elementLabel, $attributes); |
||
| 275 | $this->_persistantFreeze = true; |
||
| 276 | $this->_appendName = true; |
||
| 277 | $this->_type = 'date'; |
||
| 278 | // Added by Ivan Tcholakov, 16-MAR-2010. |
||
| 279 | $current_year = intval(api_get_local_time()); |
||
| 280 | $this->_options['minYear'] = $current_year - 9; |
||
| 281 | $this->_options['maxYear'] = $current_year + 1; |
||
| 282 | // |
||
| 283 | // set the options, do not bother setting bogus ones |
||
| 284 | if (is_array($options)) { |
||
| 285 | foreach ($options as $name => $value) { |
||
| 286 | if ('language' == $name) { |
||
| 287 | $this->_options['language'] = isset($this->_locale[$value])? $value: 'en'; |
||
| 288 | } elseif (isset($this->_options[$name])) { |
||
| 289 | if (is_array($value) && is_array($this->_options[$name])) { |
||
| 290 | $this->_options[$name] = @array_merge($this->_options[$name], $value); |
||
| 291 | } else { |
||
| 292 | $this->_options[$name] = $value; |
||
| 293 | } |
||
| 294 | } |
||
| 295 | } |
||
| 296 | } |
||
| 297 | } |
||
| 298 | |||
| 299 | function _createElements() |
||
| 411 | |||
| 412 | // }}} |
||
| 413 | // {{{ _createOptionList() |
||
| 414 | |||
| 415 | /** |
||
| 416 | * Creates an option list containing the numbers from the start number to the end, inclusive |
||
| 417 | * |
||
| 418 | * @param int The start number |
||
| 419 | * @param int The end number |
||
| 420 | * @param int Increment by this value |
||
| 421 | * @access private |
||
| 422 | * @return array An array of numeric options. |
||
| 423 | */ |
||
| 424 | function _createOptionList($start, $end, $step = 1) |
||
| 431 | |||
| 432 | // }}} |
||
| 433 | // {{{ _trimLeadingZeros() |
||
| 434 | |||
| 435 | /** |
||
| 436 | * Trims leading zeros from the (numeric) string |
||
| 437 | * |
||
| 438 | * @param string A numeric string, possibly with leading zeros |
||
| 439 | * @return string String with leading zeros removed |
||
| 440 | */ |
||
| 441 | function _trimLeadingZeros($str) |
||
| 449 | |||
| 450 | // }}} |
||
| 451 | // {{{ setValue() |
||
| 452 | |||
| 453 | function setValue($value) |
||
| 486 | |||
| 487 | // }}} |
||
| 488 | // {{{ toHtml() |
||
| 489 | |||
| 490 | function toHtml() |
||
| 498 | |||
| 499 | // }}} |
||
| 500 | // {{{ accept() |
||
| 501 | |||
| 502 | function accept(&$renderer, $required = false, $error = null) |
||
| 506 | |||
| 507 | // }}} |
||
| 508 | // {{{ onQuickFormEvent() |
||
| 509 | |||
| 510 | function onQuickFormEvent($event, $arg, &$caller) |
||
| 520 | } |
||
| 521 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.