/** * Returns a string of option tags for pretty much any country in the world. Supply a country name as +selected+ to * have it marked as the selected option tag. You can also supply an array of countries as +priority_countries+, so * that they will be listed above the rest of the (long) list. * * NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. */ function country_options_for_select($selected = null, $priority_countries = array(), $model = 'AkCountries', $options = array()) { $country_options = ''; if ($model == 'AkCountries') { require_once AK_LIB_DIR . DS . 'AkLocalize' . DS . 'AkCountries.php'; $countries_form_method = AkCountries::all(); } else { $countries_form_method = $model->all(); } if (!empty($priority_countries)) { $country_options .= $this->options_for_select($priority_countries, $selected, $options); $country_options .= '<option value="">-------------</option>' . "\n"; } if (!empty($priority_countries) && in_array($selected, $priority_countries)) { $country_options .= $this->options_for_select(array_diff($countries_form_method, $priority_countries), $selected, $options); } else { $country_options .= $this->options_for_select($countries_form_method, $selected, $options); } return $country_options; }