Yii 1.1: TimeZone dropDown

3 followers

I spend a bit of time looking for the this piece of code while building time feature on a site this tutorial also helped Local time zones and locales

<?php echo CHtml::label(Yii::t(PTranslate::CAT_USER,UserPref::PREF_USER_TIME_ZONE),UserPref::PREF_USER_TIME_ZONE);
                     echo CHtml::dropDownList(UserPref::PREF_USER_TIME_ZONE, UserPref::getValue(UserPref::PREF_USER_TIME_ZONE),array(
                        "America/Noronha"=> Yii::t(PTranslate::CAT_USER,"Brazil"),
                        "America/Nassau"=> Yii::t(PTranslate::CAT_USER,"Bahamas"),
                        "Asia/Thimphu"=> Yii::t(PTranslate::CAT_USER,"Bhutan"),
                        "Africa/Gaborone"=> Yii::t(PTranslate::CAT_USER,"Botswana"),
                        "Europe/Minsk"=> Yii::t(PTranslate::CAT_USER,"Belarus"),
                        "America/Belize"=> Yii::t(PTranslate::CAT_USER,"Belize"),
                        "America/St_Johns"=> Yii::t(PTranslate::CAT_USER,"Canada"),
                        "Indian/Cocos"=> Yii::t(PTranslate::CAT_USER,"Cocos Islands"),
                        "Africa/Kinshasa"=> Yii::t(PTranslate::CAT_USER,"Democratic Republic of the Congo"),
                        "Africa/Bangui"=> Yii::t(PTranslate::CAT_USER,"Central African Republic"),
                        "Africa/Brazzaville"=> Yii::t(PTranslate::CAT_USER,"Republic of the Congo"),
                        "Europe/Zurich"=> Yii::t(PTranslate::CAT_USER,"Switzerland"),
                        "Africa/Abidjan"=> Yii::t(PTranslate::CAT_USER,"Ivory Coast"),
                        "Pacific/Rarotonga"=> Yii::t(PTranslate::CAT_USER,"Cook Islands"),
                        "America/Santiago"=> Yii::t(PTranslate::CAT_USER,"Chile"),
                        "Africa/Douala"=> Yii::t(PTranslate::CAT_USER,"Cameroon"),
                        "Asia/Shanghai"=> Yii::t(PTranslate::CAT_USER,"China"),
                        "America/Bogota"=> Yii::t(PTranslate::CAT_USER,"Colombia"),
                        "America/Costa_Rica"=> Yii::t(PTranslate::CAT_USER,"Costa Rica"),
                        "America/Havana"=> Yii::t(PTranslate::CAT_USER,"Cuba"),
                        "Atlantic/Cape_Verde"=> Yii::t(PTranslate::CAT_USER,"Cape Verde"),
                        "America/Curacao"=> Yii::t(PTranslate::CAT_USER,"CuraƧao"),
                        "Indian/Christmas"=> Yii::t(PTranslate::CAT_USER,"Christmas Island"),
                        "Asia/Nicosia"=> Yii::t(PTranslate::CAT_USER,"Cyprus"),
                        "Europe/Prague"=> Yii::t(PTranslate::CAT_USER,"Czech Republic"),
                        "Europe/Berlin"=> Yii::t(PTranslate::CAT_USER,"Germany"),
                        "Africa/Djibouti"=> Yii::t(PTranslate::CAT_USER,"Djibouti"),
                        "Europe/Copenhagen"=> Yii::t(PTranslate::CAT_USER,"Denmark"),
                        "America/Dominica"=> Yii::t(PTranslate::CAT_USER,"Dominica"),
                        "America/Santo_Domingo"=> Yii::t(PTranslate::CAT_USER,"Dominican Republic"),
                        "Africa/Algiers"=> Yii::t(PTranslate::CAT_USER,"Algeria"),
                        "America/Guayaquil"=> Yii::t(PTranslate::CAT_USER,"Ecuador"),
                        "Europe/Tallinn"=> Yii::t(PTranslate::CAT_USER,"Estonia"),
                        "Africa/Cairo"=> Yii::t(PTranslate::CAT_USER,"Egypt"),
                        "Africa/El_Aaiun"=> Yii::t(PTranslate::CAT_USER,"Western Sahara"),
                        "Africa/Asmara"=> Yii::t(PTranslate::CAT_USER,"Eritrea"),
                        "Europe/Madrid"=> Yii::t(PTranslate::CAT_USER,"Spain"),
                        "Africa/Addis_Ababa"=> Yii::t(PTranslate::CAT_USER,"Ethiopia"),
                        "Europe/Helsinki"=> Yii::t(PTranslate::CAT_USER,"Finland"),
                        "Pacific/Fiji"=> Yii::t(PTranslate::CAT_USER,"Fiji"),
                        "Atlantic/Stanley"=> Yii::t(PTranslate::CAT_USER,"Falkland Islands"),
                        "Pacific/Chuuk"=> Yii::t(PTranslate::CAT_USER,"Micronesia"),
                        "Atlantic/Faroe"=> Yii::t(PTranslate::CAT_USER,"Faroe Islands"),
                        "Europe/Paris"=> Yii::t(PTranslate::CAT_USER,"France"),
                        "Africa/Libreville"=> Yii::t(PTranslate::CAT_USER,"Gabon"),
                        "Europe/London"=> Yii::t(PTranslate::CAT_USER,"United Kingdom"),
                        "America/Grenada"=> Yii::t(PTranslate::CAT_USER,"Grenada"),
                        "Asia/Tbilisi"=> Yii::t(PTranslate::CAT_USER,"Georgia"),
                        "America/Cayenne"=> Yii::t(PTranslate::CAT_USER,"French Guiana"),
                        "Europe/Guernsey"=> Yii::t(PTranslate::CAT_USER,"Guernsey"),
                        "Africa/Accra"=> Yii::t(PTranslate::CAT_USER,"Ghana"),
                        "Europe/Gibraltar"=> Yii::t(PTranslate::CAT_USER,"Gibraltar"),
                        "America/Godthab"=> Yii::t(PTranslate::CAT_USER,"Greenland"),
                        "Africa/Banjul"=> Yii::t(PTranslate::CAT_USER,"Gambia"),
                        "Africa/Conakry"=> Yii::t(PTranslate::CAT_USER,"Guinea"),
                        "America/Guadeloupe"=> Yii::t(PTranslate::CAT_USER,"Guadeloupe"),
                        "Africa/Malabo"=> Yii::t(PTranslate::CAT_USER,"Equatorial Guinea"),
                        "Europe/Athens"=> Yii::t(PTranslate::CAT_USER,"Greece"),
                        "Atlantic/South_Georgia"=> Yii::t(PTranslate::CAT_USER,"South Georgia and the South Sandwich Islands"),
                        "America/Guatemala"=> Yii::t(PTranslate::CAT_USER,"Guatemala"),
                        "Pacific/Guam"=> Yii::t(PTranslate::CAT_USER,"Guam"),
                        "Africa/Bissau"=> Yii::t(PTranslate::CAT_USER,"Guinea-Bissau"),
                        "America/Guyana"=> Yii::t(PTranslate::CAT_USER,"Guyana"),
                        "Asia/Hong_Kong"=> Yii::t(PTranslate::CAT_USER,"Hong Kong"),
                        "America/Tegucigalpa"=> Yii::t(PTranslate::CAT_USER,"Honduras"),
                        "Europe/Zagreb"=> Yii::t(PTranslate::CAT_USER,"Croatia"),
                        "America/Port-au-Prince"=> Yii::t(PTranslate::CAT_USER,"Haiti"),
                        "Europe/Budapest"=> Yii::t(PTranslate::CAT_USER,"Hungary"),
                        "Asia/Jakarta"=> Yii::t(PTranslate::CAT_USER,"Indonesia"),
                        "Europe/Dublin"=> Yii::t(PTranslate::CAT_USER,"Ireland"),
                        "Asia/Jerusalem"=> Yii::t(PTranslate::CAT_USER,"Israel"),
                        "Europe/Isle_of_Man"=> Yii::t(PTranslate::CAT_USER,"Isle of Man"),
                        "Asia/Kolkata"=> Yii::t(PTranslate::CAT_USER,"India"),
                        "Indian/Chagos"=> Yii::t(PTranslate::CAT_USER,"British Indian Ocean Territory"),
                        "Asia/Baghdad"=> Yii::t(PTranslate::CAT_USER,"Iraq"),
                        "Asia/Tehran"=> Yii::t(PTranslate::CAT_USER,"Iran"),
                        "Atlantic/Reykjavik"=> Yii::t(PTranslate::CAT_USER,"Iceland"),
                        "Europe/Rome"=> Yii::t(PTranslate::CAT_USER,"Italy"),
                        "Europe/Jersey"=> Yii::t(PTranslate::CAT_USER,"Jersey"),
                        "America/Jamaica"=> Yii::t(PTranslate::CAT_USER,"Jamaica"),
                        "Asia/Amman"=> Yii::t(PTranslate::CAT_USER,"Jordan"),
                        "Asia/Tokyo"=> Yii::t(PTranslate::CAT_USER,"Japan"),
                        "Africa/Nairobi"=> Yii::t(PTranslate::CAT_USER,"Kenya"),
                        "Asia/Bishkek"=> Yii::t(PTranslate::CAT_USER,"Kyrgyzstan"),
                        "Asia/Phnom_Penh"=> Yii::t(PTranslate::CAT_USER,"Cambodia"),
                        "Pacific/Tarawa"=> Yii::t(PTranslate::CAT_USER,"Kiribati"),
                        "Indian/Comoro"=> Yii::t(PTranslate::CAT_USER,"Comoros"),
                        "America/St_Kitts"=> Yii::t(PTranslate::CAT_USER,"Saint Kitts and Nevis"),
                        "Asia/Pyongyang"=> Yii::t(PTranslate::CAT_USER,"North Korea"),
                        "Asia/Seoul"=> Yii::t(PTranslate::CAT_USER,"South Korea"),
                        "Asia/Kuwait"=> Yii::t(PTranslate::CAT_USER,"Kuwait"),
                        "America/Cayman"=> Yii::t(PTranslate::CAT_USER,"Cayman Islands"),
                        "Asia/Almaty"=> Yii::t(PTranslate::CAT_USER,"Kazakhstan"),
                        "Asia/Vientiane"=> Yii::t(PTranslate::CAT_USER,"Laos"),
                        "Asia/Beirut"=> Yii::t(PTranslate::CAT_USER,"Lebanon"),
                        "America/St_Lucia"=> Yii::t(PTranslate::CAT_USER,"Saint Lucia"),
                        "Europe/Vaduz"=> Yii::t(PTranslate::CAT_USER,"Liechtenstein"),
                        "Asia/Colombo"=> Yii::t(PTranslate::CAT_USER,"Sri Lanka"),
                        "Africa/Monrovia"=> Yii::t(PTranslate::CAT_USER,"Liberia"),
                        "Africa/Maseru"=> Yii::t(PTranslate::CAT_USER,"Lesotho"),
                        "zone_name"=> Yii::t(PTranslate::CAT_USER,"country_name"),
                        "Europe/Vilnius"=> Yii::t(PTranslate::CAT_USER,"Lithuania"),
                        "Europe/Luxembourg"=> Yii::t(PTranslate::CAT_USER,"Luxembourg"),
                        "Europe/Riga"=> Yii::t(PTranslate::CAT_USER,"Latvia"),
                        "Africa/Tripoli"=> Yii::t(PTranslate::CAT_USER,"Libya"),
                        "Africa/Casablanca"=> Yii::t(PTranslate::CAT_USER,"Morocco"),
                        "Europe/Monaco"=> Yii::t(PTranslate::CAT_USER,"Monaco"),
                        "Europe/Chisinau"=> Yii::t(PTranslate::CAT_USER,"Moldova"),
                        "Europe/Podgorica"=> Yii::t(PTranslate::CAT_USER,"Montenegro"),
                        "America/Marigot"=> Yii::t(PTranslate::CAT_USER,"Saint Martin"),
                        "Indian/Antananarivo"=> Yii::t(PTranslate::CAT_USER,"Madagascar"),
                        "Pacific/Majuro"=> Yii::t(PTranslate::CAT_USER,"Marshall Islands"),
                        "Europe/Skopje"=> Yii::t(PTranslate::CAT_USER,"Macedonia"),
                        "Africa/Bamako"=> Yii::t(PTranslate::CAT_USER,"Mali"),
                        "Asia/Rangoon"=> Yii::t(PTranslate::CAT_USER,"Myanmar"),
                        "Asia/Ulaanbaatar"=> Yii::t(PTranslate::CAT_USER,"Mongolia"),
                        "Asia/Macau"=> Yii::t(PTranslate::CAT_USER,"Macao"),
                        "Pacific/Saipan"=> Yii::t(PTranslate::CAT_USER,"Northern Mariana Islands"),
                        "America/Martinique"=> Yii::t(PTranslate::CAT_USER,"Martinique"),
                        "Africa/Nouakchott"=> Yii::t(PTranslate::CAT_USER,"Mauritania"),
                        "America/Montserrat"=> Yii::t(PTranslate::CAT_USER,"Montserrat"),
                        "Europe/Malta"=> Yii::t(PTranslate::CAT_USER,"Malta"),
                        "Indian/Mauritius"=> Yii::t(PTranslate::CAT_USER,"Mauritius"),
                        "Indian/Maldives"=> Yii::t(PTranslate::CAT_USER,"Maldives"),
                        "Africa/Blantyre"=> Yii::t(PTranslate::CAT_USER,"Malawi"),
                        "America/Mexico_City"=> Yii::t(PTranslate::CAT_USER,"Mexico"),
                        "Asia/Kuala_Lumpur"=> Yii::t(PTranslate::CAT_USER,"Malaysia"),
                        "Africa/Maputo"=> Yii::t(PTranslate::CAT_USER,"Mozambique"),
                        "Africa/Windhoek"=> Yii::t(PTranslate::CAT_USER,"Namibia"),
                        "Pacific/Noumea"=> Yii::t(PTranslate::CAT_USER,"New Caledonia"),
                        "Africa/Niamey"=> Yii::t(PTranslate::CAT_USER,"Niger"),
                        "Pacific/Norfolk"=> Yii::t(PTranslate::CAT_USER,"Norfolk Island"),
                        "Africa/Lagos"=> Yii::t(PTranslate::CAT_USER,"Nigeria"),
                        "America/Managua"=> Yii::t(PTranslate::CAT_USER,"Nicaragua"),
                        "Europe/Amsterdam"=> Yii::t(PTranslate::CAT_USER,"Netherlands"),
                        "Europe/Oslo"=> Yii::t(PTranslate::CAT_USER,"Norway"),
                        "Asia/Kathmandu"=> Yii::t(PTranslate::CAT_USER,"Nepal"),
                        "Pacific/Nauru"=> Yii::t(PTranslate::CAT_USER,"Nauru"),
                        "Pacific/Niue"=> Yii::t(PTranslate::CAT_USER,"Niue"),
                        "Pacific/Auckland"=> Yii::t(PTranslate::CAT_USER,"New Zealand"),
                        "Asia/Muscat"=> Yii::t(PTranslate::CAT_USER,"Oman"),
                        "America/Panama"=> Yii::t(PTranslate::CAT_USER,"Panama"),
                        "America/Lima"=> Yii::t(PTranslate::CAT_USER,"Peru"),
                        "Pacific/Tahiti"=> Yii::t(PTranslate::CAT_USER,"French Polynesia"),
                        "Pacific/Port_Moresby"=> Yii::t(PTranslate::CAT_USER,"Papua New Guinea"),
                        "Asia/Manila"=> Yii::t(PTranslate::CAT_USER,"Philippines"),
                        "Asia/Karachi"=> Yii::t(PTranslate::CAT_USER,"Pakistan"),
                        "Europe/Warsaw"=> Yii::t(PTranslate::CAT_USER,"Poland"),
                        "America/Miquelon"=> Yii::t(PTranslate::CAT_USER,"Saint Pierre and Miquelon"),
                        "Pacific/Pitcairn"=> Yii::t(PTranslate::CAT_USER,"Pitcairn"),
                        "America/Puerto_Rico"=> Yii::t(PTranslate::CAT_USER,"Puerto Rico"),
                        "Asia/Gaza"=> Yii::t(PTranslate::CAT_USER,"Palestinian Territory"),
                        "Europe/Lisbon"=> Yii::t(PTranslate::CAT_USER,"Portugal"),
                        "Pacific/Palau"=> Yii::t(PTranslate::CAT_USER,"Palau"),
                        "America/Asuncion"=> Yii::t(PTranslate::CAT_USER,"Paraguay"),
                        "Asia/Qatar"=> Yii::t(PTranslate::CAT_USER,"Qatar"),
                        "Indian/Reunion"=> Yii::t(PTranslate::CAT_USER,"Reunion"),
                        "Europe/Bucharest"=> Yii::t(PTranslate::CAT_USER,"Romania"),
                        "Europe/Belgrade"=> Yii::t(PTranslate::CAT_USER,"Serbia"),
                        "Europe/Kaliningrad"=> Yii::t(PTranslate::CAT_USER,"Russia"),
                        "Africa/Kigali"=> Yii::t(PTranslate::CAT_USER,"Rwanda"),
                        "Asia/Riyadh"=> Yii::t(PTranslate::CAT_USER,"Saudi Arabia"),
                        "Pacific/Guadalcanal"=> Yii::t(PTranslate::CAT_USER,"Solomon Islands"),
                        "Indian/Mahe"=> Yii::t(PTranslate::CAT_USER,"Seychelles"),
                        "Africa/Khartoum"=> Yii::t(PTranslate::CAT_USER,"Sudan"),
                        "Europe/Stockholm"=> Yii::t(PTranslate::CAT_USER,"Sweden"),
                        "Asia/Singapore"=> Yii::t(PTranslate::CAT_USER,"Singapore"),
                        "Atlantic/St_Helena"=> Yii::t(PTranslate::CAT_USER,"Saint Helena"),
                        "Europe/Ljubljana"=> Yii::t(PTranslate::CAT_USER,"Slovenia"),
                        "Arctic/Longyearbyen"=> Yii::t(PTranslate::CAT_USER,"Svalbard and Jan Mayen"),
                        "Europe/Bratislava"=> Yii::t(PTranslate::CAT_USER,"Slovakia"),
                        "Africa/Freetown"=> Yii::t(PTranslate::CAT_USER,"Sierra Leone"),
                        "Europe/San_Marino"=> Yii::t(PTranslate::CAT_USER,"San Marino"),
                        "Africa/Dakar"=> Yii::t(PTranslate::CAT_USER,"Senegal"),
                        "Africa/Mogadishu"=> Yii::t(PTranslate::CAT_USER,"Somalia"),
                        "America/Paramaribo"=> Yii::t(PTranslate::CAT_USER,"Suriname"),
                        "Africa/Juba"=> Yii::t(PTranslate::CAT_USER,"South Sudan"),
                        "Africa/Sao_Tome"=> Yii::t(PTranslate::CAT_USER,"Sao Tome and Principe"),
                        "America/El_Salvador"=> Yii::t(PTranslate::CAT_USER,"El Salvador"),
                        "America/Lower_Princes"=> Yii::t(PTranslate::CAT_USER,"Sint Maarten"),
                        "Asia/Damascus"=> Yii::t(PTranslate::CAT_USER,"Syria"),
                        "Africa/Mbabane"=> Yii::t(PTranslate::CAT_USER,"Swaziland"),
                        "America/Grand_Turk"=> Yii::t(PTranslate::CAT_USER,"Turks and Caicos Islands"),
                        "Africa/Ndjamena"=> Yii::t(PTranslate::CAT_USER,"Chad"),
                        "Indian/Kerguelen"=> Yii::t(PTranslate::CAT_USER,"French Southern Territories"),
                        "Africa/Lome"=> Yii::t(PTranslate::CAT_USER,"Togo"),
                        "Asia/Bangkok"=> Yii::t(PTranslate::CAT_USER,"Thailand"),
                        "Asia/Dushanbe"=> Yii::t(PTranslate::CAT_USER,"Tajikistan"),
                        "Pacific/Fakaofo"=> Yii::t(PTranslate::CAT_USER,"Tokelau"),
                        "Asia/Dili"=> Yii::t(PTranslate::CAT_USER,"East Timor"),
                        "Asia/Ashgabat"=> Yii::t(PTranslate::CAT_USER,"Turkmenistan"),
                        "Africa/Tunis"=> Yii::t(PTranslate::CAT_USER,"Tunisia"),
                        "Pacific/Tongatapu"=> Yii::t(PTranslate::CAT_USER,"Tonga"),
                        "Europe/Istanbul"=> Yii::t(PTranslate::CAT_USER,"Turkey"),
                        "America/Port_of_Spain"=> Yii::t(PTranslate::CAT_USER,"Trinidad and Tobago"),
                        "Pacific/Funafuti"=> Yii::t(PTranslate::CAT_USER,"Tuvalu"),
                        "Asia/Taipei"=> Yii::t(PTranslate::CAT_USER,"Taiwan"),
                        "Africa/Dar_es_Salaam"=> Yii::t(PTranslate::CAT_USER,"Tanzania"),
                        "Europe/Kiev"=> Yii::t(PTranslate::CAT_USER,"Ukraine"),
                        "Africa/Kampala"=> Yii::t(PTranslate::CAT_USER,"Uganda"),
                        "Pacific/Johnston"=> Yii::t(PTranslate::CAT_USER,"United States Minor Outlying Islands"),
                        "zone_name"=> Yii::t(PTranslate::CAT_USER,"country_name"),
                        "America/New_York"=> Yii::t(PTranslate::CAT_USER,"United States"),
                        "America/Montevideo"=> Yii::t(PTranslate::CAT_USER,"Uruguay"),
                        "Asia/Samarkand"=> Yii::t(PTranslate::CAT_USER,"Uzbekistan"),
                        "Europe/Vatican"=> Yii::t(PTranslate::CAT_USER,"Vatican"),
                        "America/St_Vincent"=> Yii::t(PTranslate::CAT_USER,"Saint Vincent and the Grenadines"),
                        "America/Caracas"=> Yii::t(PTranslate::CAT_USER,"Venezuela"),
                        "America/Tortola"=> Yii::t(PTranslate::CAT_USER,"British Virgin Islands"),
                        "America/St_Thomas"=> Yii::t(PTranslate::CAT_USER,"U.S. Virgin Islands"),
                        "Asia/Ho_Chi_Minh"=> Yii::t(PTranslate::CAT_USER,"Vietnam"),
                        "Pacific/Efate"=> Yii::t(PTranslate::CAT_USER,"Vanuatu"),
                        "Pacific/Wallis"=> Yii::t(PTranslate::CAT_USER,"Wallis and Futuna"),
                        "Pacific/Apia"=> Yii::t(PTranslate::CAT_USER,"Samoa"),
                        "Asia/Aden"=> Yii::t(PTranslate::CAT_USER,"Yemen"),
                        "Indian/Mayotte"=> Yii::t(PTranslate::CAT_USER,"Mayotte"),
                        "Africa/Johannesburg"=> Yii::t(PTranslate::CAT_USER,"South Africa"),
                        "Africa/Lusaka"=> Yii::t(PTranslate::CAT_USER,"Zambia"),
                        "Africa/Harare"=> Yii::t(PTranslate::CAT_USER,"Zimbabwe")
                    ),array('class'=>"admin")); 
                     echo $form->error($model,'priority'); ?>

Be the first person to leave a comment

Please to leave your comment.

Write new article