Commit 9416b26a authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Display country names not numbers in user view (The 2nd part of bug 1333)

parent 6985b48e
...@@ -481,12 +481,10 @@ class ArtefactTypeTown extends ArtefactTypeProfileField {} ...@@ -481,12 +481,10 @@ class ArtefactTypeTown extends ArtefactTypeProfileField {}
class ArtefactTypeCity extends ArtefactTypeProfileField {} class ArtefactTypeCity extends ArtefactTypeProfileField {}
class ArtefactTypeCountry extends ArtefactTypeProfileField { class ArtefactTypeCountry extends ArtefactTypeProfileField {
public function listself($options) { public function listself($options) {
$countries = getoptions_country(); return array('html' => get_string("country.{$this->title}"), 'javascript' => null);
return array('html' => $countries[$this->title], 'javascript' => null);
} }
public function render_full($options) { public function render_full($options) {
$countries = getoptions_country(); return array('html' => get_string("country.{$this->title}"), 'javascript' => null);
return array('html' => $countries[$this->title], 'javascript' => null);
} }
} }
class ArtefactTypeHomenumber extends ArtefactTypeProfileField {} class ArtefactTypeHomenumber extends ArtefactTypeProfileField {}
......
...@@ -106,6 +106,9 @@ function search_user($query_string, $limit, $offset = 0) { ...@@ -106,6 +106,9 @@ function search_user($query_string, $limit, $offset = 0) {
$result[$field] = $value; $result[$field] = $value;
} }
} }
if (isset($result['country'])) {
$result['country'] = get_string('country.' . $result['country']);
}
} }
} }
......
...@@ -794,7 +794,7 @@ function getoptions_country() { ...@@ -794,7 +794,7 @@ function getoptions_country() {
if (!empty($countries)) { if (!empty($countries)) {
return $countries; return $countries;
} }
$countries = array( $codes = array(
'af', 'af',
'ax', 'ax',
'al', 'al',
...@@ -1040,11 +1040,10 @@ function getoptions_country() { ...@@ -1040,11 +1040,10 @@ function getoptions_country() {
'zw', 'zw',
); );
$countries = array_map( foreach ($codes as $c) {
create_function('$a', 'return get_string("country.{$a}");'), $countries[$c] = get_string("country.{$c}");
$countries };
); uasort($countries, 'strcoll');
usort($countries, 'strcoll');
return $countries; return $countries;
} }
......
...@@ -110,6 +110,9 @@ foreach (array_keys($publicfields) as $field) { ...@@ -110,6 +110,9 @@ foreach (array_keys($publicfields) as $field) {
} }
} }
} }
if (isset($userfields['country'])) {
$userfields['country'] = get_string('country.' . $userfields['country']);
}
// Get viewable views // Get viewable views
$views = array(); $views = array();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment