Skip to content

Commit 3fd11fe

Browse files
committed
Only iso code of country is shown in profile #314
1 parent 064113b commit 3fd11fe

File tree

1 file changed

+39
-35
lines changed

1 file changed

+39
-35
lines changed

adm_program/system/classes/profilefields.php

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -323,47 +323,51 @@ public function getValue($fieldNameIntern, $format = '')
323323

324324
if($format !== 'database')
325325
{
326-
switch ($this->mProfileFields[$fieldNameIntern]->getValue('usf_type'))
326+
if($fieldNameIntern == 'COUNTRY')
327327
{
328-
case 'DATE':
329-
if ($value !== '')
330-
{
331-
// if no format or html is set then show date format from Admidio settings
332-
if($format === '' || $format === 'html')
328+
if ($value !== '')
329+
{
330+
// read the language name of the country
331+
$value = $gL10n->getCountryByCode($value);
332+
}
333+
}
334+
else
335+
{
336+
switch ($this->mProfileFields[$fieldNameIntern]->getValue('usf_type'))
337+
{
338+
case 'DATE':
339+
if ($value !== '')
333340
{
334-
$dateFormat = $gPreferences['system_date'];
341+
// if no format or html is set then show date format from Admidio settings
342+
if($format === '' || $format === 'html')
343+
{
344+
$dateFormat = $gPreferences['system_date'];
345+
}
346+
else
347+
{
348+
$dateFormat = $format;
349+
}
350+
351+
// if date field then the current date format must be used
352+
$date = new DateTimeExtended($value, 'Y-m-d');
353+
if(!$date->isValid())
354+
{
355+
return $value;
356+
}
357+
$value = $date->format($dateFormat);
335358
}
336-
else
359+
break;
360+
case 'DROPDOWN':
361+
case 'RADIO_BUTTON':
362+
// the value in db is only the position, now search for the text
363+
if($value > 0 && $format !== 'html')
337364
{
338-
$dateFormat = $format;
339-
}
365+
$arrListValues = $this->mProfileFields[$fieldNameIntern]->getValue('usf_value_list');
366+
$value = $arrListValues[$value];
340367

341-
// if date field then the current date format must be used
342-
$date = new DateTimeExtended($value, 'Y-m-d');
343-
if(!$date->isValid())
344-
{
345-
return $value;
346368
}
347-
$value = $date->format($dateFormat);
348-
}
349-
break;
350-
case 'DROPDOWN':
351-
case 'RADIO_BUTTON':
352-
// the value in db is only the position, now search for the text
353-
if($value > 0 && $format !== 'html')
354-
{
355-
$arrListValues = $this->mProfileFields[$fieldNameIntern]->getValue('usf_value_list');
356-
$value = $arrListValues[$value];
357-
358-
}
359-
break;
360-
case 'COUNTRY':
361-
if ($value !== '')
362-
{
363-
// read the language name of the country
364-
$value = $gL10n->getCountryByCode($value);
365-
}
366-
break;
369+
break;
370+
}
367371
}
368372
}
369373
}

0 commit comments

Comments
 (0)