Framework  3.9
timezone_field_renderer.inc
Go to the documentation of this file.
1 <?php
6 /**************************************************************
7 
8  Copyright (c) 2007-2010 Sonjara, Inc
9 
10  Permission is hereby granted, free of charge, to any person
11  obtaining a copy of this software and associated documentation
12  files (the "Software"), to deal in the Software without
13  restriction, including without limitation the rights to use,
14  copy, modify, merge, publish, distribute, sublicense, and/or sell
15  copies of the Software, and to permit persons to whom the
16  Software is furnished to do so, subject to the following
17  conditions:
18 
19  The above copyright notice and this permission notice shall be
20  included in all copies or substantial portions of the Software.
21 
22  Except as contained in this notice, the name(s) of the above
23  copyright holders shall not be used in advertising or otherwise
24  to promote the sale, use or other dealings in this Software
25  without prior written authorization.
26 
27  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
29  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
31  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
32  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
34  OTHER DEALINGS IN THE SOFTWARE.
35 
36 *****************************************************************/
37 
38 require_once realpath(dirname(__FILE__))."/../field_renderers.inc";
39 
41  "Pacific/Midway" => "(GMT-11:00) Midway Island, Samoa",
42  "America/Adak" => "(GMT-10:00) Hawaii-Aleutian",
43  "Etc/GMT+10" => "(GMT-10:00) Hawaii",
44  "Pacific/Marquesas" => "(GMT-09:30) Marquesas Islands",
45  "Pacific/Gambier" => "(GMT-09:00) Gambier Islands",
46  "America/Anchorage" => "(GMT-09:00) Alaska",
47  "America/Ensenada" => "(GMT-08:00) Tijuana, Baja California",
48  "Etc/GMT+8" => "(GMT-08:00) Pitcairn Islands",
49  "America/Los_Angeles" => "(GMT-08:00) Pacific Time (US & Canada)",
50  "America/Denver" => "(GMT-07:00) Mountain Time (US & Canada)",
51  "America/Chihuahua" => "(GMT-07:00) Chihuahua, La Paz, Mazatlan",
52  "America/Dawson_Creek" => "(GMT-07:00) Arizona",
53  "America/Belize" => "(GMT-06:00) Saskatchewan, Central America",
54  "America/Cancun" => "(GMT-06:00) Guadalajara, Mexico City, Monterrey",
55  "Chile/EasterIsland" => "(GMT-06:00) Easter Island",
56  "America/Chicago" => "(GMT-06:00) Central Time (US & Canada)",
57  "America/New_York" => "(GMT-05:00) Eastern Time (US & Canada)",
58  "America/Havana" => "(GMT-05:00) Cuba",
59  "America/Bogota" => "(GMT-05:00) Bogota, Lima, Quito, Rio Branco",
60  "America/Caracas" => "(GMT-04:30) Caracas",
61  "America/Santiago" => "(GMT-04:00) Santiago",
62  "America/La_Paz" => "(GMT-04:00) La Paz",
63  "Atlantic/Stanley" => "(GMT-04:00) Faukland Islands",
64  "America/Campo_Grande" => "(GMT-04:00) Brazil",
65  "America/Goose_Bay" => "(GMT-04:00) Atlantic Time (Goose Bay)",
66  "America/Glace_Bay" => "(GMT-04:00) Atlantic Time (Canada)",
67  "America/St_Johns" => "(GMT-03:30) Newfoundland",
68  "America/Araguaina" => "(GMT-03:00) UTC-3",
69  "America/Montevideo" => "(GMT-03:00) Montevideo",
70  "America/Miquelon" => "(GMT-03:00) Miquelon, St. Pierre",
71  "America/Godthab" => "(GMT-03:00) Greenland",
72  "America/Argentina/Buenos_Aires" => "(GMT-03:00) Buenos Aires",
73  "America/Sao_Paulo" => "(GMT-03:00) Brasilia",
74  "America/Noronha" => "(GMT-02:00) Mid-Atlantic",
75  "Atlantic/Cape_Verde" => "(GMT-01:00) Cape Verde Is.",
76  "Atlantic/Azores" => "(GMT-01:00) Azores",
77  "Europe/Belfast" => "(GMT) Greenwich Mean Time : Belfast",
78  "Europe/Dublin" => "(GMT) Greenwich Mean Time : Dublin",
79  "Europe/Lisbon" => "(GMT) Greenwich Mean Time : Lisbon",
80  "Europe/London" => "(GMT) Greenwich Mean Time : London",
81  "Africa/Abidjan" => "(GMT) Monrovia, Reykjavik",
82  "Europe/Amsterdam" => "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",
83  "Europe/Belgrade" => "(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague",
84  "Europe/Brussels" => "(GMT+01:00) Brussels, Copenhagen, Madrid, Paris",
85  "Africa/Algiers" => "(GMT+01:00) West Central Africa",
86  "Africa/Windhoek" => "(GMT+01:00) Windhoek",
87  "Asia/Beirut" => "(GMT+02:00) Beirut",
88  "Africa/Cairo" => "(GMT+02:00) Cairo",
89  "Asia/Gaza" => "(GMT+02:00) Gaza",
90  "Africa/Blantyre" => "(GMT+02:00) Harare, Pretoria",
91  "Asia/Jerusalem" => "(GMT+02:00) Jerusalem",
92  "Europe/Minsk" => "(GMT+02:00) Minsk",
93  "Asia/Damascus" => "(GMT+02:00) Syria",
94  "Europe/Moscow" => "(GMT+03:00) Moscow, St. Petersburg, Volgograd",
95  "Africa/Addis_Ababa" => "(GMT+03:00) Nairobi",
96  "Asia/Tehran" => "(GMT+03:30) Tehran",
97  "Asia/Dubai" => "(GMT+04:00) Abu Dhabi, Muscat",
98  "Asia/Yerevan" => "(GMT+04:00) Yerevan",
99  "Asia/Kabul" => "(GMT+04:30) Kabul",
100  "Asia/Yekaterinburg" => "(GMT+05:00) Ekaterinburg",
101  "Asia/Tashkent" => "(GMT+05:00) Tashkent",
102  "Asia/Kolkata" => "(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi",
103  "Asia/Katmandu" => "(GMT+05:45) Kathmandu",
104  "Asia/Dhaka" => "(GMT+06:00) Astana, Dhaka",
105  "Asia/Novosibirsk" => "(GMT+06:00) Novosibirsk",
106  "Asia/Rangoon" => "(GMT+06:30) Yangon (Rangoon)",
107  "Asia/Bangkok" => "(GMT+07:00) Bangkok, Hanoi, Jakarta",
108  "Asia/Krasnoyarsk" => "(GMT+07:00) Krasnoyarsk",
109  "Asia/Hong_Kong" => "(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi",
110  "Asia/Irkutsk" => "(GMT+08:00) Irkutsk, Ulaan Bataar",
111  "Australia/Perth" => "(GMT+08:00) Perth",
112  "Australia/Eucla" => "(GMT+08:45) Eucla",
113  "Asia/Tokyo" => "(GMT+09:00) Osaka, Sapporo, Tokyo",
114  "Asia/Seoul" => "(GMT+09:00) Seoul",
115  "Asia/Yakutsk" => "(GMT+09:00) Yakutsk",
116  "Australia/Adelaide" => "(GMT+09:30) Adelaide",
117  "Australia/Darwin" => "(GMT+09:30) Darwin",
118  "Australia/Brisbane" => "(GMT+10:00) Brisbane",
119  "Australia/Hobart" => "(GMT+10:00) Hobart",
120  "Asia/Vladivostok" => "(GMT+10:00) Vladivostok",
121  "Australia/Lord_Howe" => "(GMT+10:30) Lord Howe Island",
122  "Etc/GMT-11" => "(GMT+11:00) Solomon Is., New Caledonia",
123  "Asia/Magadan" => "(GMT+11:00) Magadan",
124  "Pacific/Norfolk" => "(GMT+11:30) Norfolk Island",
125  "Asia/Anadyr" => "(GMT+12:00) Anadyr, Kamchatka",
126  "Pacific/Auckland" => "(GMT+12:00) Auckland, Wellington",
127  "Etc/GMT-12" => "(GMT+12:00) Fiji, Kamchatka, Marshall Is.",
128  "Pacific/Chatham" => "(GMT+12:45) Chatham Islands",
129  "Pacific/Tongatapu" => "(GMT+13:00) Nuku'alofa",
130  "Pacific/Kiritimati" => "(GMT+14:00) Kiritimati");
131 
133 {
135  {
136  $this->FieldRenderer($parent);
137  }
138 
139  function renderField($field)
140  {
141  $this->_startField($field);
142 
143  if ($this->abbreviated)
144  {
145  $options = $abbreviatedTimezones;
146  }
147  else
148  {
149  $options = DateTimeZone::listIdentifiers();
150  $options = array_combine($options, $options);
151  }
152 
153  echo "<select id='{$this->parent->id}_{$field}'>";
154 
155  $value = $this->parent->data->get($field);
156 
157  foreach($options as $zone=>$description)
158  {
159  option($zone, $description, $value);
160  }
161 
162  $this->_endField($field);
163  }
164 
165  function renderSearchField($field, $mode)
166  {
167  $this->renderField($field);
168  }
169 
170  function renderReadOnly($field)
171  {
172  $this->_startField($field);
173 
174  if ($this->abbreviated)
175  {
176  echo $abbreviatedTimezones[$this->parent->get($field)];
177  }
178  else
179  {
180  echo $this->parent->get($field);
181  }
182 
183  $this->_endField($field);
184  }
185 }
186 
FieldRenderer is the abstract base class for all FieldRenderers.
_startField($field, $styles="")
Internal method to generate the starting HTML for the field (including the label)
_endField($field)
Internal method to generate the closing HTML for the field.
FieldRenderer($parent)
Constructor.
renderSearchField($field, $mode)
FieldRenderers must override this method to provide the HTML implementation of the control displayed ...
renderField($field)
FieldRenderers must override this method to provide the HTML implementation of the control used to ed...
option($value, $text, $sel="")
Write out an option tag, marking as selected if applicable.
Definition: functions.inc:888