From 6236d96a657a35acca6037103e4bdcf3c75fc3c9 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Wed, 25 Jun 2014 16:51:26 +0000 Subject: [PATCH] #951 Properly display localized values for ENUMs in the data model view. SVN:trunk[3224] --- pages/schema.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pages/schema.php b/pages/schema.php index 004ea444b4..2db7d36c00 100644 --- a/pages/schema.php +++ b/pages/schema.php @@ -404,7 +404,6 @@ function DisplayClassDetails($oPage, $sClass, $sContext) $sType = $oAttDef->GetType().' ('.$oAttDef->GetTypeDesc().')'; $sOrigin = MetaModel::GetAttributeOrigin($sClass, $sAttCode); $sAllowedValues = ""; - $oAllowedValuesDef = $oAttDef->GetValuesDef(); $sMoreInfo = ""; $aCols = array(); @@ -423,7 +422,17 @@ function DisplayClassDetails($oPage, $sClass, $sContext) $sMoreInfo .= implode(', ', $aMoreInfo); } - if (is_object($oAllowedValuesDef)) $sAllowedValues = $oAllowedValuesDef->GetValuesDescription(); + if ($oAttDef instanceof AttributeEnum) + { + // Display localized values for the enum (which depend on the localization provided by the class) + $aLocalizedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, array()); + $aDescription = array(); + foreach($aLocalizedValues as $val => $sDisplay) + { + $aDescription[] = htmlentities("$val => ", ENT_QUOTES, 'UTF-8').$sDisplay; + } + $sAllowedValues = implode(', ', $aDescription); + } else $sAllowedValues = ''; $aDetails[] = array('code' => $oAttDef->GetCode(), 'type' => $sType, 'origin' => $sOrigin, 'label' => $oAttDef->GetLabel(), 'description' => $sValue, 'values' => $sAllowedValues, 'moreinfo' => $sMoreInfo);