root/trunk/patForms/Datasource/Countries.php

Revision 267, 49.6 kB (checked in by schst, 3 years ago)

Pass the element to the datasource, to allow context-sensitive datasources (as requested #151)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 /**
3  * Datasource for Country selectors
4  *
5  * This class is used to autmatically populate form elements like select boxes
6  * with countries
7  *
8  * $Id$
9  *
10  * @author        Stephan Schmidt <schst@php-tools.net>
11  * @package        patForms
12  * @subpackage    Datasource
13  * @license        LGPL
14  * @copyright    PHP Application Tools <http://www.php-tools.net>
15  */
16
17 /**
18  * Datasource for Country selectors
19  *
20  * This class is used to autmatically populate form elements like select boxes
21  * with countries
22  *
23  * @author        Stephan Schmidt <schst@php-tools.net>
24  * @package        patForms
25  * @subpackage    Datasource
26  * @license        LGPL
27  * @copyright    PHP Application Tools <http://www.php-tools.net>
28  */
29 class patForms_Datasource_Countries
30 {
31     var $countryList = array(
32                             'C' => array(
33                                         array('value' => 'AF', 'label' => 'Afghanistan'),
34                                         array('value' => 'AL', 'label' => 'Albania, People\'s Socialist Republic of'),
35                                         array('value' => 'DZ', 'label' => 'Algeria, People\'s Democratic Republic of'),
36                                         array('value' => 'AS', 'label' => 'American Samoa'),
37                                         array('value' => 'AD', 'label' => 'Andorra, Principality of'),
38                                         
39                                         array('value' => 'AO', 'label' => 'Angola, Republic of'),
40                                         array('value' => 'AI', 'label' => 'Anguilla'),
41                                         array('value' => 'AQ', 'label' => 'Antarctica (the territory South of 60 deg S)'),
42                                         array('value' => 'AG', 'label' => 'Antigua and Barbuda'),
43                                         array('value' => 'AR', 'label' => 'Argentina, Argentine Republic'),
44                                         array('value' => 'AM', 'label' => 'Armenia'),
45                                         
46                                         array('value' => 'AW', 'label' => 'Aruba'),
47                                         array('value' => 'AU', 'label' => 'Australia, Commonwealth of'),
48                                         array('value' => 'AT', 'label' => 'Austria, Republic of'),
49                                         array('value' => 'AZ', 'label' => 'Azerbaijan, Republic of'),
50                                         array('value' => 'BS', 'label' => 'Bahamas, Commonwealth of the'),
51                                         array('value' => 'BH', 'label' => 'Bahrain, Kingdom of'),
52                                         
53                                         array('value' => 'BD', 'label' => 'Bangladesh, People\'s Republic of'),
54                                         array('value' => 'BB', 'label' => 'Barbados'),
55                                         array('value' => 'BY', 'label' => 'Belarus'),
56                                         array('value' => 'BE', 'label' => 'Belgium, Kingdom of'),
57                                         array('value' => 'BZ', 'label' => 'Belize'),
58                                         array('value' => 'BJ', 'label' => 'Benin, People\'s Republic of'),
59                                         
60                                         array('value' => 'BM', 'label' => 'Bermuda'),
61                                         array('value' => 'BT', 'label' => 'Bhutan, Kingdom of'),
62                                         array('value' => 'BO', 'label' => 'Bolivia, Republic of'),
63                                         array('value' => 'BA', 'label' => 'Bosnia and Herzegovina'),
64                                         array('value' => 'BW', 'label' => 'Botswana, Republic of'),
65                                         array('value' => 'BV', 'label' => 'Bouvet Island (Bouvetoya)'),
66                                         
67                                         array('value' => 'BR', 'label' => 'Brazil, Federative Republic of'),
68                                         array('value' => 'IO', 'label' => 'British Indian Ocean Territory (Chagos Archipelago)'),
69                                         array('value' => 'VG', 'label' => 'British Virgin Islands'),
70                                         array('value' => 'BN', 'label' => 'Brunei Darussalam'),
71                                         array('value' => 'BG', 'label' => 'Bulgaria, People\'s Republic of'),
72                                         array('value' => 'BF', 'label' => 'Burkina Faso'),
73                                         
74                                         array('value' => 'BI', 'label' => 'Burundi, Republic of'),
75                                         array('value' => 'KH', 'label' => 'Cambodia, Kingdom of'),
76                                         array('value' => 'CM', 'label' => 'Cameroon, United Republic of'),
77                                         array('value' => 'CA', 'label' => 'Canada'),
78                                         array('value' => 'CV', 'label' => 'Cape Verde, Republic of'),
79                                         array('value' => 'KY', 'label' => 'Cayman Islands'),
80                                         
81                                         array('value' => 'CF', 'label' => 'Central African Republic'),
82                                         array('value' => 'TD', 'label' => 'Chad, Republic of'),
83                                         array('value' => 'CL', 'label' => 'Chile, Republic of'),
84                                         array('value' => 'CN', 'label' => 'China, People\'s Republic of'),
85                                         array('value' => 'CX', 'label' => 'Christmas Island'),
86                                         array('value' => 'CC', 'label' => 'Cocos (Keeling) Islands'),
87                                         
88                                         array('value' => 'CO', 'label' => 'Colombia, Republic of'),
89                                         array('value' => 'KM', 'label' => 'Comoros, Federal and Islamic Republic of'),
90                                         array('value' => 'CD', 'label' => 'Congo, Democratic Republic of'),
91                                         array('value' => 'CG', 'label' => 'Congo, People\'s Republic of'),
92                                         array('value' => 'CK', 'label' => 'Cook Islands'),
93                                         array('value' => 'CR', 'label' => 'Costa Rica, Republic of'),
94                                         
95                                         array('value' => 'CI', 'label' => 'Cote D\'Ivoire, Ivory Coast, Republic of the'),
96                                         array('value' => 'CU', 'label' => 'Cuba, Republic of'),
97                                         array('value' => 'CY', 'label' => 'Cyprus, Republic of'),
98                                         array('value' => 'CZ', 'label' => 'Czech Republic'),
99                                         array('value' => 'DK', 'label' => 'Denmark, Kingdom of'),
100                                         array('value' => 'DJ', 'label' => 'Djibouti, Republic of'),
101                                         
102                                         array('value' => 'DM', 'label' => 'Dominica, Commonwealth of'),
103                                         array('value' => 'DO', 'label' => 'Dominican Republic'),
104                                         array('value' => 'TL', 'label' => 'East Timor, Democratic Republic of'),
105                                         array('value' => 'EC', 'label' => 'Ecuador, Republic of'),
106                                         array('value' => 'EG', 'label' => 'Egypt, Arab Republic of'),
107                                         array('value' => 'SV', 'label' => 'El Salvador, Republic of'),
108                                         
109                                         array('value' => 'GQ', 'label' => 'Equatorial Guinea, Republic of'),
110                                         array('value' => 'ER', 'label' => 'Eritrea'),
111                                         array('value' => 'EE', 'label' => 'Estonia'),
112                                         array('value' => 'ET', 'label' => 'Ethiopia'),
113                                         array('value' => 'FO', 'label' => 'Faeroe Islands'),
114                                         array('value' => 'FK', 'label' => 'Falkland Islands (Malvinas)'),
115                                         
116                                         array('value' => 'FJ', 'label' => 'Fiji, Republic of the Fiji Islands'),
117                                         array('value' => 'FI', 'label' => 'Finland, Republic of'),
118                                         array('value' => 'FR', 'label' => 'France, French Republic'),
119                                         array('value' => 'GF', 'label' => 'French Guiana'),
120                                         array('value' => 'PF', 'label' => 'French Polynesia'),
121                                         array('value' => 'TF', 'label' => 'French Southern Territories'),
122                                         
123                                         array('value' => 'GA', 'label' => 'Gabon, Gabonese Republic'),
124                                         array('value' => 'GM', 'label' => 'Gambia, Republic of the'),
125                                         array('value' => 'GE', 'label' => 'Georgia'),
126                                         array('value' => 'DE', 'label' => 'Germany'),
127                                         array('value' => 'GH', 'label' => 'Ghana, Republic of'),
128                                         array('value' => 'GI', 'label' => 'Gibraltar'),
129                                         
130                                         array('value' => 'GR', 'label' => 'Greece, Hellenic Republic'),
131                                         array('value' => 'GL', 'label' => 'Greenland'),
132                                         array('value' => 'GD', 'label' => 'Grenada'),
133                                         array('value' => 'GP', 'label' => 'Guadaloupe'),
134                                         array('value' => 'GU', 'label' => 'Guam'),
135                                         array('value' => 'GT', 'label' => 'Guatemala, Republic of'),
136                                         
137                                         array('value' => 'GN', 'label' => 'Guinea, Revolutionary People\'s Rep\'c of'),
138                                         array('value' => 'GW', 'label' => 'Guinea-Bissau, Republic of'),
139                                         array('value' => 'GY', 'label' => 'Guyana, Republic of'),
140                                         array('value' => 'HT', 'label' => 'Haiti, Republic of'),
141                                         array('value' => 'HM', 'label' => 'Heard and McDonald Islands'),
142                                         array('value' => 'VA', 'label' => 'Holy See (Vatican City State)'),
143                                         
144                                         array('value' => 'HN', 'label' => 'Honduras, Republic of'),
145                                         array('value' => 'HK', 'label' => 'Hong Kong, Special Administrative Region of China'),
146                                         array('value' => 'HR', 'label' => 'Hrvatska (Croatia)'),
147                                         array('value' => 'HU', 'label' => 'Hungary, Hungarian People\'s Republic'),
148                                         array('value' => 'IS', 'label' => 'Iceland, Republic of'),
149                                         array('value' => 'IN', 'label' => 'India, Republic of'),
150                                         
151                                         array('value' => 'ID', 'label' => 'Indonesia, Republic of'),
152                                         array('value' => 'IR', 'label' => 'Iran, Islamic Republic of'),
153                                         array('value' => 'IQ', 'label' => 'Iraq, Republic of'),
154                                         array('value' => 'IE', 'label' => 'Ireland'),
155                                         array('value' => 'IL', 'label' => 'Israel, State of'),
156                                         array('value' => 'IT', 'label' => 'Italy, Italian Republic'),
157                                         
158                                         array('value' => 'JM', 'label' => 'Jamaica'),
159                                         array('value' => 'JP', 'label' => 'Japan'),
160                                         array('value' => 'JO', 'label' => 'Jordan, Hashemite Kingdom of'),
161                                         array('value' => 'KZ', 'label' => 'Kazakhstan, Republic of'),
162                                         array('value' => 'KE', 'label' => 'Kenya, Republic of'),
163                                         array('value' => 'KI', 'label' => 'Kiribati, Republic of'),
164                                         
165                                         array('value' => 'KP', 'label' => 'Korea, Democratic People\'s Republic of'),
166                                         array('value' => 'KR', 'label' => 'Korea, Republic of'),
167                                         array('value' => 'KW', 'label' => 'Kuwait, State of'),
168                                         array('value' => 'KG', 'label' => 'Kyrgyz Republic'),
169                                         array('value' => 'LA', 'label' => 'Lao People\'s Democratic Republic'),
170                                         array('value' => 'LV', 'label' => 'Latvia'),
171                                         
172                                         array('value' => 'LB', 'label' => 'Lebanon, Lebanese Republic'),
173                                         array('value' => 'LS', 'label' => 'Lesotho, Kingdom of'),
174                                         array('value' => 'LR', 'label' => 'Liberia, Republic of'),
175                                         array('value' => 'LY', 'label' => 'Libyan Arab Jamahiriya'),
176                                         array('value' => 'LI', 'label' => 'Liechtenstein, Principality of'),
177                                         array('value' => 'LT', 'label' => 'Lithuania'),
178                                         
179                                         array('value' => 'LU', 'label' => 'Luxembourg, Grand Duchy of'),
180                                         array('value' => 'MO', 'label' => 'Macao, Special Administrative Region of China'),
181                                         array('value' => 'MK', 'label' => 'Macedonia, the former Yugoslav Republic of'),
182                                         array('value' => 'MG', 'label' => 'Madagascar, Republic of'),
183                                         array('value' => 'MW', 'label' => 'Malawi, Republic of'),
184                                         array('value' => 'MY', 'label' => 'Malaysia'),
185                                         
186                                         array('value' => 'MV', 'label' => 'Maldives, Republic of'),
187                                         array('value' => 'ML', 'label' => 'Mali, Republic of'),
188                                         array('value' => 'MT', 'label' => 'Malta, Republic of'),
189                                         array('value' => 'MH', 'label' => 'Marshall Islands'),
190                                         array('value' => 'MQ', 'label' => 'Martinique'),
191                                         array('value' => 'MR', 'label' => 'Mauritania, Islamic Republic of'),
192                                         
193                                         array('value' => 'MU', 'label' => 'Mauritius'),
194                                         array('value' => 'YT', 'label' => 'Mayotte'),
195                                         array('value' => 'MX', 'label' => 'Mexico, United Mexican States'),
196                                         array('value' => 'FM', 'label' => 'Micronesia, Federated States of'),
197                                         array('value' => 'MD', 'label' => 'Moldova, Republic of'),
198                                         array('value' => 'MC', 'label' => 'Monaco, Principality of'),
199                                         
200                                         array('value' => 'MN', 'label' => 'Mongolia, Mongolian People\'s Republic'),
201                                         array('value' => 'MS', 'label' => 'Montserrat'),
202                                         array('value' => 'MA', 'label' => 'Morocco, Kingdom of'),
203                                         array('value' => 'MZ', 'label' => 'Mozambique, People\'s Republic of'),
204                                         array('value' => 'MM', 'label' => 'Myanmar'),
205                                         array('value' => 'NA', 'label' => 'Namibia'),
206                                         
207                                         array('value' => 'NR', 'label' => 'Nauru, Republic of'),
208                                         array('value' => 'NP', 'label' => 'Nepal, Kingdom of'),
209                                         array('value' => 'AN', 'label' => 'Netherlands Antilles'),
210                                         array('value' => 'NL', 'label' => 'Netherlands, Kingdom of the'),
211                                         array('value' => 'NC', 'label' => 'New Caledonia'),
212                                         array('value' => 'NZ', 'label' => 'New Zealand'),
213                                         
214                                         array('value' => 'NI', 'label' => 'Nicaragua, Republic of'),
215                                         array('value' => 'NE', 'label' => 'Niger, Republic of the'),
216                                         array('value' => 'NG', 'label' => 'Nigeria, Federal Republic of'),
217                                         array('value' => 'NU', 'label' => 'Niue, Republic of'),
218                                         array('value' => 'NF', 'label' => 'Norfolk Island'),
219                                         array('value' => 'MP', 'label' => 'Northern Mariana Islands'),
220                                         
221                                         array('value' => 'NO', 'label' => 'Norway, Kingdom of'),
222                                         array('value' => 'OM', 'label' => 'Oman, Sultanate of'),
223                                         array('value' => 'PK', 'label' => 'Pakistan, Islamic Republic of'),
224                                         array('value' => 'PW', 'label' => 'Palau'),
225                                         array('value' => 'PS', 'label' => 'Palestinian Territory, Occupied'),
226                                         array('value' => 'PA', 'label' => 'Panama, Republic of'),
227                                         
228                                         array('value' => 'PG', 'label' => 'Papua New Guinea'),
229                                         array('value' => 'PY', 'label' => 'Paraguay, Republic of'),
230                                         array('value' => 'PE', 'label' => 'Peru, Republic of'),
231                                         array('value' => 'PH', 'label' => 'Philippines, Republic of the'),
232                                         array('value' => 'PN', 'label' => 'Pitcairn Island'),
233                                         array('value' => 'PL', 'label' => 'Poland, Polish People\'s Republic'),
234                                         
235                                         array('value' => 'PT', 'label' => 'Portugal, Portuguese Republic'),
236                                         array('value' => 'PR', 'label' => 'Puerto Rico'),
237                                         array('value' => 'QA', 'label' => 'Qatar, State of'),
238                                         array('value' => 'RE', 'label' => 'Reunion'),
239                                         array('value' => 'RO', 'label' => 'Romania, Socialist Republic of'),
240                                         array('value' => 'RU', 'label' => 'Russian Federation'),
241                                         
242                                         array('value' => 'RW', 'label' => 'Rwanda, Rwandese Republic'),
243                                         array('value' => 'SH', 'label' => 'St. Helena'),
244                                         array('value' => 'KN', 'label' => 'St. Kitts and Nevis'),
245                                         array('value' => 'LC', 'label' => 'St. Lucia'),
246                                         array('value' => 'PM', 'label' => 'St. Pierre and Miquelon'),
247                                         array('value' => 'VC', 'label' => 'St. Vincent and the Grenadines'),
248                                         
249                                         array('value' => 'WS', 'label' => 'Samoa, Independent State of'),
250                                         array('value' => 'SM', 'label' => 'San Marino, Republic of'),
251                                         array('value' => 'ST', 'label' => 'Sao Tome and Principe, Democratic Republic of'),
252                                         array('value' => 'SA', 'label' => 'Saudi Arabia, Kingdom of'),
253                                         array('value' => 'SN', 'label' => 'Senegal, Republic of'),
254                                         array('value' => 'SC', 'label' => 'Seychelles, Republic of'),
255                                         
256                                         array('value' => 'SL', 'label' => 'Sierra Leone, Republic of'),
257                                         array('value' => 'SG', 'label' => 'Singapore, Republic of'),
258                                         array('value' => 'SK', 'label' => 'Slovakia (Slovak Republic)'),
259                                         array('value' => 'SI', 'label' => 'Slovenia'),
260                                         array('value' => 'SB', 'label' => 'Solomon Islands'),
261                                         array('value' => 'SO', 'label' => 'Somalia, Somali Republic'),
262                                         
263                                         array('value' => 'ZA', 'label' => 'South Africa, Republic of'),
264                                         array('value' => 'GS'