Index: trunk/extensions/EducationProgram/specials/SpecialInstitutions.php |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | $this->displayAddNewControl(); |
62 | 62 | } |
63 | 63 | |
64 | | - $pager = new EPOrgPager( ); |
| 64 | + $pager = new EPOrgPager( $this->getContext() ); |
65 | 65 | |
66 | 66 | if ( $pager->getNumRows() ) { |
67 | 67 | $this->getOutput()->addHTML( |
Index: trunk/extensions/EducationProgram/specials/SpecialEditInstitution.php |
— | — | @@ -48,14 +48,27 @@ |
49 | 49 | }, |
50 | 50 | ); |
51 | 51 | |
| 52 | + $countries = efEpGetCountries(); |
| 53 | + |
52 | 54 | $fields['country'] = array ( |
53 | 55 | 'type' => 'select', |
54 | 56 | 'label-message' => 'educationprogram-org-edit-country', |
55 | 57 | 'required' => true, |
56 | | - 'options' => array( 'foo' => 'foo', 'bar' => 'bar' ), // TODO |
| 58 | + 'options' => efEpGetCountryOptions(), |
| 59 | + 'validation-callback' => array( $this, 'countryIsValid' ), |
57 | 60 | ); |
58 | 61 | |
59 | 62 | return $this->processFormFields( $fields ); |
60 | 63 | } |
| 64 | + |
| 65 | + public function countryIsValid( $value, array $alldata = null ) { |
| 66 | + $countries = array_keys( efEpGetCountries() ); |
| 67 | + |
| 68 | + if ( $this->isNew() ) { |
| 69 | + array_unshift( $countries, '' ); |
| 70 | + } |
| 71 | + |
| 72 | + return in_array( $value, $countries ) ? true : wfMsg( 'educationprogram-org-invalid-country' ); |
| 73 | + } |
61 | 74 | |
62 | 75 | } |
Index: trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | public function execute( $subPage ) { |
89 | 89 | parent::execute( $subPage ); |
90 | 90 | |
91 | | - if ( $this->isNew() ) { |
| 91 | + if ( $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) { |
92 | 92 | $this->showForm(); |
93 | 93 | } |
94 | 94 | else { |
— | — | @@ -96,6 +96,43 @@ |
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
| 100 | + * @since 0.1 |
| 101 | + */ |
| 102 | + protected function showContent() { |
| 103 | + $c = $this->itemClass; // Yeah, this is needed in PHP 5.3 >_> |
| 104 | + |
| 105 | + if ( $this->isNew() ) { |
| 106 | + $data = $this->getNewData(); |
| 107 | + |
| 108 | + $object = $c::selectRow( null, $data ); |
| 109 | + |
| 110 | + if ( $object === false ) { |
| 111 | + $object = new $c( $data, true ); |
| 112 | + } |
| 113 | + else { |
| 114 | + $this->showWarning( 'educationprogram-' . strtolower( $this->getName() ) . '-exists-already' ); |
| 115 | + } |
| 116 | + } |
| 117 | + else { |
| 118 | + $object = $c::selectRow( null, array( 'name' => $this->subPage ) ); |
| 119 | + } |
| 120 | + |
| 121 | + if ( $object === false ) { |
| 122 | + $this->getOutput()->redirect( SpecialPage::getTitleFor( $this->listPage )->getLocalURL() ); |
| 123 | + } |
| 124 | + else { |
| 125 | +// if ( !$this->isNew() ) { |
| 126 | +// $this->getOutput()->addHTML( |
| 127 | +// SpecialContestPage::getNavigation( $contest->getField( 'name' ), $this->getUser(), $this->getLanguage(), $this->getName() ) |
| 128 | +// ); |
| 129 | +// } |
| 130 | + |
| 131 | + $this->item = $object; |
| 132 | + $this->showForm(); |
| 133 | + } |
| 134 | + } |
| 135 | + |
| 136 | + /** |
100 | 137 | * Returns if the page should work in insertion mode rather then modification mode. |
101 | 138 | * |
102 | 139 | * @since 0.1 |
— | — | @@ -143,47 +180,7 @@ |
144 | 181 | protected function getNewData() { |
145 | 182 | return array( 'name' => $this->getRequest()->getVal( 'newname' ) ); |
146 | 183 | } |
147 | | - |
148 | | - /** |
149 | | - * Attempt to get the contest to be edited or create the one to be added. |
150 | | - * If this works, show the form, if not, redirect to special:contests. |
151 | | - * |
152 | | - * @since 0.1 |
153 | | - */ |
154 | | - protected function showContent() { |
155 | | - $c = $this->itemClass; |
156 | | - |
157 | | - if ( $this->isNew() ) { |
158 | | - $data = $this->getNewData(); |
159 | 184 | |
160 | | - $object = $c::selectRow( null, $data ); |
161 | | - |
162 | | - if ( $object === false ) { |
163 | | - $object = new Contest( $data, true ); |
164 | | - } |
165 | | - else { |
166 | | - $this->showWarning( 'educationprogram-' . strtolower( $this->getName() ) . '-exists-already' ); |
167 | | - } |
168 | | - } |
169 | | - else { |
170 | | - $object = $c::selectRow( null, array( 'name' => $this->subPage ) ); |
171 | | - } |
172 | | - |
173 | | - if ( $object === false ) { |
174 | | - $this->getOutput()->redirect( SpecialPage::getTitleFor( $this->listPage )->getLocalURL() ); |
175 | | - } |
176 | | - else { |
177 | | -// if ( !$this->isNew() ) { |
178 | | -// $this->getOutput()->addHTML( |
179 | | -// SpecialContestPage::getNavigation( $contest->getField( 'name' ), $this->getUser(), $this->getLanguage(), $this->getName() ) |
180 | | -// ); |
181 | | -// } |
182 | | - |
183 | | - $this->item = $object; |
184 | | - $this->showForm(); |
185 | | - } |
186 | | - } |
187 | | - |
188 | 185 | /** |
189 | 186 | * (non-PHPdoc) |
190 | 187 | * @see FormSpecialPage::getForm() |
— | — | @@ -240,8 +237,9 @@ |
241 | 238 | protected function processFormFields( array $fields ) { |
242 | 239 | if ( $this->item !== false ) { |
243 | 240 | foreach ( $fields as $name => &$data ) { |
244 | | - $default = $this->item->getField( $name ); |
245 | | - $data['default'] = $default; |
| 241 | + if ( !array_key_exists( 'default', $data ) ) { |
| 242 | + $data['default'] = $this->item->getField( $name ); |
| 243 | + } |
246 | 244 | } |
247 | 245 | } |
248 | 246 | |
— | — | @@ -252,6 +250,7 @@ |
253 | 251 | // HTML form is being a huge pain in running the validation on post, |
254 | 252 | // so just remove it if when not appropriate. |
255 | 253 | unset( $field['validation-callback'] ); |
| 254 | + unset( $field['required'] ); |
256 | 255 | } |
257 | 256 | |
258 | 257 | $mappedFields['item-' . $name] = $field; |
— | — | @@ -278,21 +277,25 @@ |
279 | 278 | * |
280 | 279 | * @return Bool|Array |
281 | 280 | */ |
282 | | - public function onSubmit( array $data ) { |
| 281 | + public function handleSubmission( array $data ) { |
283 | 282 | $fields = array(); |
284 | 283 | |
285 | 284 | foreach ( $data as $name => $value ) { |
286 | 285 | $matches = array(); |
287 | 286 | |
288 | 287 | if ( preg_match( '/item-(.+)/', $name, $matches ) ) { |
| 288 | + if ( $matches[1] === 'id' && $value === '' ) { |
| 289 | + $value = null; |
| 290 | + } |
| 291 | + |
289 | 292 | $fields[$matches[1]] = $value; |
290 | 293 | } |
291 | 294 | } |
292 | 295 | |
293 | | - $c = $this->itemClass; |
294 | | - $item = new $c( $fields, is_null( $fields['id'] ) ); |
| 296 | + $c = $this->itemClass; // Yeah, this is needed in PHP 5.3 >_> |
| 297 | + /* EPDBObject */ $item = new $c( $fields, is_null( $fields['id'] ) ); |
295 | 298 | |
296 | | - $success = $item->writeAllToDB(); |
| 299 | + $success = $item->writeToDB(); |
297 | 300 | |
298 | 301 | if ( $success ) { |
299 | 302 | return true; |
Index: trunk/extensions/EducationProgram/includes/EPStudentPager.php |
— | — | @@ -16,13 +16,14 @@ |
17 | 17 | /** |
18 | 18 | * Constructor. |
19 | 19 | * |
| 20 | + * @param IContextSource $context |
20 | 21 | * @param array $conds |
21 | 22 | */ |
22 | | - public function __construct( array $conds = array() ) { |
| 23 | + public function __construct( IContextSource $context, array $conds = array() ) { |
23 | 24 | $this->mDefaultDirection = true; |
24 | 25 | |
25 | 26 | // when MW 1.19 becomes min, we want to pass an IContextSource $context here. |
26 | | - parent::__construct( $conds, 'EPStudent' ); |
| 27 | + parent::__construct( $context, $conds, 'EPStudent' ); |
27 | 28 | } |
28 | 29 | |
29 | 30 | /** |
Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php |
— | — | @@ -16,13 +16,14 @@ |
17 | 17 | /** |
18 | 18 | * Constructor. |
19 | 19 | * |
| 20 | + * @param IContextSource $context |
20 | 21 | * @param array $conds |
21 | 22 | */ |
22 | | - public function __construct( array $conds = array() ) { |
| 23 | + public function __construct( IContextSource $context, array $conds = array() ) { |
23 | 24 | $this->mDefaultDirection = true; |
24 | 25 | |
25 | 26 | // when MW 1.19 becomes min, we want to pass an IContextSource $context here. |
26 | | - parent::__construct( $conds, 'EPOrg' ); |
| 27 | + parent::__construct( $context, $conds, 'EPOrg' ); |
27 | 28 | } |
28 | 29 | |
29 | 30 | /** |
— | — | @@ -31,7 +32,9 @@ |
32 | 33 | */ |
33 | 34 | public function getFieldNames() { |
34 | 35 | return parent::getFieldNameList( array( |
35 | | - // TODO |
| 36 | + 'name', |
| 37 | + 'city', |
| 38 | + 'country', |
36 | 39 | ) ); |
37 | 40 | } |
38 | 41 | |
— | — | @@ -65,8 +68,12 @@ |
66 | 69 | return $value; |
67 | 70 | } |
68 | 71 | |
| 72 | + /** |
| 73 | + * (non-PHPdoc) |
| 74 | + * @see TablePager::getDefaultSort() |
| 75 | + */ |
69 | 76 | function getDefaultSort() { |
70 | | - return ''; // TODO |
| 77 | + return 'asc'; |
71 | 78 | } |
72 | 79 | |
73 | 80 | /** |
— | — | @@ -74,7 +81,25 @@ |
75 | 82 | * @see EPPager::getSortableFields() |
76 | 83 | */ |
77 | 84 | protected function getSortableFields() { |
78 | | - return array(); |
| 85 | + return array( |
| 86 | + 'name', |
| 87 | + 'city', |
| 88 | + 'country', |
| 89 | + ); |
79 | 90 | } |
| 91 | + |
| 92 | + /** |
| 93 | + * (non-PHPdoc) |
| 94 | + * @see EPPager::getFilterOptions() |
| 95 | + */ |
| 96 | + protected function getFilterOptions() { |
| 97 | + return array( |
| 98 | + 'country' => array( |
| 99 | + 'type' => 'select', |
| 100 | + 'options' => efEpGetCountryOptions(), |
| 101 | + 'value' => '' |
| 102 | + ), |
| 103 | + ); |
| 104 | + } |
80 | 105 | |
81 | 106 | } |
Index: trunk/extensions/EducationProgram/includes/EPOrg.php |
— | — | @@ -51,5 +51,13 @@ |
52 | 52 | 'country' => 'str', |
53 | 53 | ); |
54 | 54 | } |
| 55 | + |
| 56 | + public static function getDefaults() { |
| 57 | + return array( |
| 58 | + 'name' => '', |
| 59 | + 'city' => '', |
| 60 | + 'country' => '', |
| 61 | + ); |
| 62 | + } |
55 | 63 | |
56 | 64 | } |
Index: trunk/extensions/EducationProgram/includes/EPPager.php |
— | — | @@ -36,16 +36,30 @@ |
37 | 37 | protected $currentObject; |
38 | 38 | |
39 | 39 | /** |
| 40 | + * Context in which this pager is being shown. |
| 41 | + * @since 0.1 |
| 42 | + * @var IContextSource |
| 43 | + */ |
| 44 | + protected $context; |
| 45 | + |
| 46 | + /** |
40 | 47 | * Constructor. |
41 | 48 | * |
| 49 | + * @param IContextSource $context |
42 | 50 | * @param array $conds |
| 51 | + * @param string $className |
43 | 52 | */ |
44 | | - public function __construct( array $conds, $className ) { |
| 53 | + public function __construct( IContextSource $context, array $conds, $className ) { |
45 | 54 | $this->conds = $conds; |
46 | 55 | $this->className = $className; |
| 56 | + $this->context = $context; |
47 | 57 | |
48 | | - // when MW 1.19 becomes min, we want to pass an IContextSource $context here. |
49 | | - parent::__construct(); |
| 58 | + if ( version_compare( $GLOBALS['wgVersion'], '1.18c', '>' ) ) { |
| 59 | + parent::__construct( $context ); |
| 60 | + } |
| 61 | + else { |
| 62 | + parent::__construct(); |
| 63 | + } |
50 | 64 | } |
51 | 65 | |
52 | 66 | /** |
— | — | @@ -57,7 +71,7 @@ |
58 | 72 | * @return OutputPage |
59 | 73 | */ |
60 | 74 | public function getOutput() { |
61 | | - return version_compare( $GLOBALS['wgVersion'], '1.18', '>' ) ? parent::getOutput() : $GLOBALS['wgOut']; |
| 75 | + return $this->context->getOutput(); |
62 | 76 | } |
63 | 77 | |
64 | 78 | /** |
— | — | @@ -69,7 +83,7 @@ |
70 | 84 | * @return Language |
71 | 85 | */ |
72 | 86 | public function getLanguage() { |
73 | | - return version_compare( $GLOBALS['wgVersion'], '1.18', '>' ) ? parent::getLanguage() : $GLOBALS['wgLang']; |
| 87 | + return $this->context->getLanguage(); |
74 | 88 | } |
75 | 89 | |
76 | 90 | /** |
— | — | @@ -81,7 +95,7 @@ |
82 | 96 | * @return User |
83 | 97 | */ |
84 | 98 | public function getUser() { |
85 | | - return version_compare( $GLOBALS['wgUser'], '1.18', '>' ) ? parent::getUser() : $GLOBALS['wgUser']; |
| 99 | + return $this->context->getUser(); |
86 | 100 | } |
87 | 101 | |
88 | 102 | /** |
— | — | @@ -100,19 +114,42 @@ |
101 | 115 | } |
102 | 116 | |
103 | 117 | function getQueryInfo() { |
104 | | - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
| 118 | + $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
105 | 119 | return array( |
106 | 120 | 'tables' => array( $c::getDBTable() ), |
107 | 121 | 'fields' => $c::getPrefixedFields( $c::getFieldNames() ), |
108 | | - 'conds' => $c::getPrefixedValues( $this->conds ), |
| 122 | + 'conds' => $c::getPrefixedValues( $this->getConditions() ), |
109 | 123 | ); |
110 | 124 | } |
111 | 125 | |
| 126 | + /** |
| 127 | + * |
| 128 | + * |
| 129 | + * @since 0.1 |
| 130 | + * |
| 131 | + * @return array |
| 132 | + */ |
| 133 | + protected function getConditions() { |
| 134 | + $req = $this->getRequest(); |
| 135 | + $conds = array(); |
| 136 | + |
| 137 | + $filterOptions = $this->getFilterOptions(); |
| 138 | + $this->addFilterValues( $filterOptions ); |
| 139 | + |
| 140 | + foreach ( $filterOptions as $optionName => $optionData ) { |
| 141 | + if ( array_key_exists( 'value', $optionData ) && $optionData['value'] !== '' ) { |
| 142 | + $conds[$optionName] = $optionData['value']; |
| 143 | + } |
| 144 | + } |
| 145 | + |
| 146 | + return array_merge( $conds, $this->conds ); |
| 147 | + } |
| 148 | + |
112 | 149 | function isFieldSortable( $name ) { |
113 | 150 | $c = $this->className; // Yeah, this is needed in PHP 5.3 >_> |
114 | 151 | return in_array( |
115 | 152 | $name, |
116 | | - $c::getPrefixedFields( 'id' ) |
| 153 | + $c::getPrefixedFields( $this->getSortableFields() ) |
117 | 154 | ); |
118 | 155 | } |
119 | 156 | |
— | — | @@ -136,7 +173,7 @@ |
137 | 174 | ); |
138 | 175 | } |
139 | 176 | |
140 | | - return array_map( 'wfMsg', $headers ); |
| 177 | + return $headers; |
141 | 178 | } |
142 | 179 | |
143 | 180 | /** |
— | — | @@ -168,7 +205,7 @@ |
169 | 206 | * |
170 | 207 | * @return string |
171 | 208 | */ |
172 | | - public function getFilterControl( $hideWhenNoResults ) { |
| 209 | + public function getFilterControl( $hideWhenNoResults = true ) { |
173 | 210 | $filterOptions = $this->getFilterOptions(); |
174 | 211 | |
175 | 212 | if ( count( $filterOptions ) < 1 ) { |
— | — | @@ -201,7 +238,7 @@ |
202 | 239 | $controls[] = $control; |
203 | 240 | } |
204 | 241 | |
205 | | - $title = $this->getTitle( $this->subPage )->getFullText(); |
| 242 | + $title = $this->getTitle()->getFullText(); |
206 | 243 | |
207 | 244 | return |
208 | 245 | '<fieldset>' . |
Index: trunk/extensions/EducationProgram/includes/EPCoursePager.php |
— | — | @@ -16,13 +16,14 @@ |
17 | 17 | /** |
18 | 18 | * Constructor. |
19 | 19 | * |
| 20 | + * @param IContextSource $context |
20 | 21 | * @param array $conds |
21 | 22 | */ |
22 | | - public function __construct( array $conds = array() ) { |
| 23 | + public function __construct( IContextSource $context, array $conds = array() ) { |
23 | 24 | $this->mDefaultDirection = true; |
24 | 25 | |
25 | 26 | // when MW 1.19 becomes min, we want to pass an IContextSource $context here. |
26 | | - parent::__construct( $conds, 'EPCourse' ); |
| 27 | + parent::__construct( $context, $conds, 'EPCourse' ); |
27 | 28 | } |
28 | 29 | |
29 | 30 | /** |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -64,11 +64,19 @@ |
65 | 65 | 'ep-institutions-newname' => 'Institution name:', |
66 | 66 | 'ep-institutions-add' => 'Add institution', |
67 | 67 | |
| 68 | + // Org pager |
| 69 | + 'educationprogram-pager-eporg-name' => 'Name', |
| 70 | + 'educationprogram-pager-eporg-city' => 'City', |
| 71 | + 'educationprogram-pager-eporg-country' => 'Country', |
| 72 | + |
68 | 73 | // Special:EditInstitution |
69 | 74 | 'editinstitution-text' => 'Enter the institution details below and click submit to save your changes.', |
70 | 75 | 'educationprogram-org-edit-name' => 'Institution name', |
71 | 76 | 'editinstitution-add-legend' => 'Add institution', |
72 | 77 | 'editinstitution-edit-legend' => 'Edit institution', |
| 78 | + 'educationprogram-org-edit-city' => 'City', |
| 79 | + 'educationprogram-org-edit-country' => 'Country', |
| 80 | + 'educationprogram-org-submit' => 'Submit', |
73 | 81 | |
74 | 82 | ); |
75 | 83 | |
Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -147,3 +147,272 @@ |
148 | 148 | |
149 | 149 | # The default value for the user preferences. |
150 | 150 | //$wgDefaultUserOptions[''] = false; |
| 151 | + |
| 152 | +/** |
| 153 | + * Returns a list of ISO 3166-1-alpha-2 country codes (keys) and their corresponding country (values). |
| 154 | + * TODO: move this to sane location, this is temporary, since the final solution has not been decided upon. |
| 155 | + * |
| 156 | + * @since 0.1 |
| 157 | + * |
| 158 | + * @return array |
| 159 | + */ |
| 160 | +function efEpGetCountries() { |
| 161 | + return array( |
| 162 | + 'AF' => 'Afghanistan', |
| 163 | + 'AL' => 'Albania', |
| 164 | + 'DZ' => 'Algeria', |
| 165 | + 'AS' => 'American Samoa', |
| 166 | + 'AD' => 'Andorra', |
| 167 | + 'AO' => 'Angola', |
| 168 | + 'AI' => 'Anguilla', |
| 169 | + 'AQ' => 'Antarctica', |
| 170 | + 'AG' => 'Antigua and Barbuda', |
| 171 | + 'AR' => 'Argentina', |
| 172 | + 'AM' => 'Armenia', |
| 173 | + 'AW' => 'Aruba', |
| 174 | + 'AU' => 'Australia', |
| 175 | + 'AT' => 'Austria', |
| 176 | + 'AZ' => 'Azerbaijan', |
| 177 | + 'BS' => 'Bahamas', |
| 178 | + 'BH' => 'Bahrain', |
| 179 | + 'BD' => 'Bangladesh', |
| 180 | + 'BB' => 'Barbados', |
| 181 | + 'BY' => 'Belarus', |
| 182 | + 'BE' => 'Belgium', |
| 183 | + 'BZ' => 'Belize', |
| 184 | + 'BJ' => 'Benin', |
| 185 | + 'BM' => 'Bermuda', |
| 186 | + 'BT' => 'Bhutan', |
| 187 | + 'BO' => 'Bolivia', |
| 188 | + 'BA' => 'Bosnia and Herzegovina', |
| 189 | + 'BW' => 'Botswana', |
| 190 | + 'BV' => 'Bouvet Island', |
| 191 | + 'BR' => 'Brazil', |
| 192 | + 'IO' => 'British Indian Ocean Territory', |
| 193 | + 'BN' => 'Brunei Darussalam', |
| 194 | + 'BG' => 'Bulgaria', |
| 195 | + 'BF' => 'Burkina Faso', |
| 196 | + 'BI' => 'Burundi', |
| 197 | + 'KH' => 'Cambodia', |
| 198 | + 'CM' => 'Cameroon', |
| 199 | + 'CA' => 'Canada', |
| 200 | + 'CV' => 'Cape Verde', |
| 201 | + 'KY' => 'Cayman Islands', |
| 202 | + 'CF' => 'Central African Republic', |
| 203 | + 'TD' => 'Chad', |
| 204 | + 'CL' => 'Chile', |
| 205 | + 'CN' => 'China', |
| 206 | + 'CX' => 'Christmas Island', |
| 207 | + 'CC' => 'Cocos (Keeling) Islands', |
| 208 | + 'CO' => 'Colombia', |
| 209 | + 'KM' => 'Comoros', |
| 210 | + 'CG' => 'Congo', |
| 211 | + 'CD' => 'Congo, the Democratic Republic of the', |
| 212 | + 'CK' => 'Cook Islands', |
| 213 | + 'CR' => 'Costa Rica', |
| 214 | + 'CI' => "Cote D'Ivoire", |
| 215 | + 'HR' => 'Croatia', |
| 216 | + 'CU' => 'Cuba', |
| 217 | + 'CY' => 'Cyprus', |
| 218 | + 'CZ' => 'Czech Republic', |
| 219 | + 'DK' => 'Denmark', |
| 220 | + 'DJ' => 'Djibouti', |
| 221 | + 'DM' => 'Dominica', |
| 222 | + 'DO' => 'Dominican Republic', |
| 223 | + 'EC' => 'Ecuador', |
| 224 | + 'EG' => 'Egypt', |
| 225 | + 'SV' => 'El Salvador', |
| 226 | + 'GQ' => 'Equatorial Guinea', |
| 227 | + 'ER' => 'Eritrea', |
| 228 | + 'EE' => 'Estonia', |
| 229 | + 'ET' => 'Ethiopia', |
| 230 | + 'FK' => 'Falkland Islands (Malvinas)', |
| 231 | + 'FO' => 'Faroe Islands', |
| 232 | + 'FJ' => 'Fiji', |
| 233 | + 'FI' => 'Finland', |
| 234 | + 'FR' => 'France', |
| 235 | + 'GF' => 'French Guiana', |
| 236 | + 'PF' => 'French Polynesia', |
| 237 | + 'TF' => 'French Southern Territories', |
| 238 | + 'GA' => 'Gabon', |
| 239 | + 'GM' => 'Gambia', |
| 240 | + 'GE' => 'Georgia', |
| 241 | + 'DE' => 'Germany', |
| 242 | + 'GH' => 'Ghana', |
| 243 | + 'GI' => 'Gibraltar', |
| 244 | + 'GR' => 'Greece', |
| 245 | + 'GL' => 'Greenland', |
| 246 | + 'GD' => 'Grenada', |
| 247 | + 'GP' => 'Guadeloupe', |
| 248 | + 'GU' => 'Guam', |
| 249 | + 'GT' => 'Guatemala', |
| 250 | + 'GN' => 'Guinea', |
| 251 | + 'GW' => 'Guinea-Bissau', |
| 252 | + 'GY' => 'Guyana', |
| 253 | + 'HT' => 'Haiti', |
| 254 | + 'HM' => 'Heard Island and Mcdonald Islands', |
| 255 | + 'VA' => 'Holy See (Vatican City State)', |
| 256 | + 'HN' => 'Honduras', |
| 257 | + 'HK' => 'Hong Kong', |
| 258 | + 'HU' => 'Hungary', |
| 259 | + 'IS' => 'Iceland', |
| 260 | + 'IN' => 'India', |
| 261 | + 'ID' => 'Indonesia', |
| 262 | + 'IR' => 'Iran, Islamic Republic of', |
| 263 | + 'IQ' => 'Iraq', |
| 264 | + 'IE' => 'Ireland', |
| 265 | + 'IL' => 'Israel', |
| 266 | + 'IT' => 'Italy', |
| 267 | + 'JM' => 'Jamaica', |
| 268 | + 'JP' => 'Japan', |
| 269 | + 'JO' => 'Jordan', |
| 270 | + 'KZ' => 'Kazakhstan', |
| 271 | + 'KE' => 'Kenya', |
| 272 | + 'KI' => 'Kiribati', |
| 273 | + 'KP' => "Korea, Democratic People's Republic of", |
| 274 | + 'KR' => 'Korea, Republic of', |
| 275 | + 'KW' => 'Kuwait', |
| 276 | + 'KG' => 'Kyrgyzstan', |
| 277 | + 'LA' => "Lao People's Democratic Republic", |
| 278 | + 'LV' => 'Latvia', |
| 279 | + 'LB' => 'Lebanon', |
| 280 | + 'LS' => 'Lesotho', |
| 281 | + 'LR' => 'Liberia', |
| 282 | + 'LY' => 'Libyan Arab Jamahiriya', |
| 283 | + 'LI' => 'Liechtenstein', |
| 284 | + 'LT' => 'Lithuania', |
| 285 | + 'LU' => 'Luxembourg', |
| 286 | + 'MO' => 'Macao', |
| 287 | + 'MK' => 'Macedonia, the Former Yugoslav Republic of', |
| 288 | + 'MG' => 'Madagascar', |
| 289 | + 'MW' => 'Malawi', |
| 290 | + 'MY' => 'Malaysia', |
| 291 | + 'MV' => 'Maldives', |
| 292 | + 'ML' => 'Mali', |
| 293 | + 'MT' => 'Malta', |
| 294 | + 'MH' => 'Marshall Islands', |
| 295 | + 'MQ' => 'Martinique', |
| 296 | + 'MR' => 'Mauritania', |
| 297 | + 'MU' => 'Mauritius', |
| 298 | + 'YT' => 'Mayotte', |
| 299 | + 'MX' => 'Mexico', |
| 300 | + 'FM' => 'Micronesia, Federated States of', |
| 301 | + 'MD' => 'Moldova, Republic of', |
| 302 | + 'MC' => 'Monaco', |
| 303 | + 'MN' => 'Mongolia', |
| 304 | + 'MS' => 'Montserrat', |
| 305 | + 'MA' => 'Morocco', |
| 306 | + 'MZ' => 'Mozambique', |
| 307 | + 'MM' => 'Myanmar', |
| 308 | + 'NA' => 'Namibia', |
| 309 | + 'NR' => 'Nauru', |
| 310 | + 'NP' => 'Nepal', |
| 311 | + 'NL' => 'Netherlands', |
| 312 | + 'AN' => 'Netherlands Antilles', |
| 313 | + 'NC' => 'New Caledonia', |
| 314 | + 'NZ' => 'New Zealand', |
| 315 | + 'NI' => 'Nicaragua', |
| 316 | + 'NE' => 'Niger', |
| 317 | + 'NG' => 'Nigeria', |
| 318 | + 'NU' => 'Niue', |
| 319 | + 'NF' => 'Norfolk Island', |
| 320 | + 'MP' => 'Northern Mariana Islands', |
| 321 | + 'NO' => 'Norway', |
| 322 | + 'OM' => 'Oman', |
| 323 | + 'PK' => 'Pakistan', |
| 324 | + 'PW' => 'Palau', |
| 325 | + 'PS' => 'Palestinian Territory, Occupied', |
| 326 | + 'PA' => 'Panama', |
| 327 | + 'PG' => 'Papua New Guinea', |
| 328 | + 'PY' => 'Paraguay', |
| 329 | + 'PE' => 'Peru', |
| 330 | + 'PH' => 'Philippines', |
| 331 | + 'PN' => 'Pitcairn', |
| 332 | + 'PL' => 'Poland', |
| 333 | + 'PT' => 'Portugal', |
| 334 | + 'PR' => 'Puerto Rico', |
| 335 | + 'QA' => 'Qatar', |
| 336 | + 'RE' => 'Reunion', |
| 337 | + 'RO' => 'Romania', |
| 338 | + 'RU' => 'Russian Federation', |
| 339 | + 'RW' => 'Rwanda', |
| 340 | + 'SH' => 'Saint Helena', |
| 341 | + 'KN' => 'Saint Kitts and Nevis', |
| 342 | + 'LC' => 'Saint Lucia', |
| 343 | + 'PM' => 'Saint Pierre and Miquelon', |
| 344 | + 'VC' => 'Saint Vincent and the Grenadines', |
| 345 | + 'WS' => 'Samoa', |
| 346 | + 'SM' => 'San Marino', |
| 347 | + 'ST' => 'Sao Tome and Principe', |
| 348 | + 'SA' => 'Saudi Arabia', |
| 349 | + 'SN' => 'Senegal', |
| 350 | + 'CS' => 'Serbia and Montenegro', |
| 351 | + 'SC' => 'Seychelles', |
| 352 | + 'SL' => 'Sierra Leone', |
| 353 | + 'SG' => 'Singapore', |
| 354 | + 'SK' => 'Slovakia', |
| 355 | + 'SI' => 'Slovenia', |
| 356 | + 'SB' => 'Solomon Islands', |
| 357 | + 'SO' => 'Somalia', |
| 358 | + 'ZA' => 'South Africa', |
| 359 | + //'GS' => 'South Georgia and the South Sandwich Islands', |
| 360 | + 'ES' => 'Spain', |
| 361 | + 'LK' => 'Sri Lanka', |
| 362 | + 'SD' => 'Sudan', |
| 363 | + 'SR' => 'Suriname', |
| 364 | + 'SJ' => 'Svalbard and Jan Mayen', |
| 365 | + 'SZ' => 'Swaziland', |
| 366 | + 'SE' => 'Sweden', |
| 367 | + 'CH' => 'Switzerland', |
| 368 | + 'SY' => 'Syrian Arab Republic', |
| 369 | + 'TW' => 'Taiwan, Province of China', |
| 370 | + 'TJ' => 'Tajikistan', |
| 371 | + 'TZ' => 'Tanzania, United Republic of', |
| 372 | + 'TH' => 'Thailand', |
| 373 | + 'TL' => 'Timor-Leste', |
| 374 | + 'TG' => 'Togo', |
| 375 | + 'TK' => 'Tokelau', |
| 376 | + 'TO' => 'Tonga', |
| 377 | + 'TT' => 'Trinidad and Tobago', |
| 378 | + 'TN' => 'Tunisia', |
| 379 | + 'TR' => 'Turkey', |
| 380 | + 'TM' => 'Turkmenistan', |
| 381 | + 'TC' => 'Turks and Caicos Islands', |
| 382 | + 'TV' => 'Tuvalu', |
| 383 | + 'UG' => 'Uganda', |
| 384 | + 'UA' => 'Ukraine', |
| 385 | + 'AE' => 'United Arab Emirates', |
| 386 | + 'GB' => 'United Kingdom', |
| 387 | + 'US' => 'United States', |
| 388 | + 'UM' => 'United States Minor Outlying Islands', |
| 389 | + 'UY' => 'Uruguay', |
| 390 | + 'UZ' => 'Uzbekistan', |
| 391 | + 'VU' => 'Vanuatu', |
| 392 | + 'VE' => 'Venezuela', |
| 393 | + 'VN' => 'Viet Nam', |
| 394 | + 'VG' => 'Virgin Islands, British', |
| 395 | + 'VI' => 'Virgin Islands, U.s.', |
| 396 | + 'WF' => 'Wallis and Futuna', |
| 397 | + 'EH' => 'Western Sahara', |
| 398 | + 'YE' => 'Yemen', |
| 399 | + 'ZM' => 'Zambia', |
| 400 | + 'ZW' => 'Zimbabwe' |
| 401 | + ); |
| 402 | +} |
| 403 | + |
| 404 | +function efEpGetCountryOptions() { |
| 405 | + $countries = efEpGetCountries(); |
| 406 | + return array_merge( |
| 407 | + array( '' => '' ), |
| 408 | + array_combine( |
| 409 | + array_map( |
| 410 | + function( $value, $key ) { |
| 411 | + return $key . ' - ' . $value; |
| 412 | + }, |
| 413 | + array_values( $countries ), |
| 414 | + array_keys( $countries ) |
| 415 | + ), |
| 416 | + array_keys( $countries ) |
| 417 | + ) |
| 418 | + ); |
| 419 | +} |
\ No newline at end of file |