Sfoglia il codice sorgente

Exports: attribute "final class" is either translated or not, depending on the no_localize option (all formats concerned with this option: CSV and spreadsheet -That field is not present in the XML format output)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3727 a333f486-631f-4898-b8df-5754b55c2be0
romainq 9 anni fa
parent
commit
de20508ba9
1 ha cambiato i file con 41 aggiunte e 0 eliminazioni
  1. 41 0
      core/attributedef.class.inc.php

+ 41 - 0
core/attributedef.class.inc.php

@@ -1912,9 +1912,50 @@ class AttributeFinalClass extends AttributeString
 	public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
 	{
 		if (empty($sValue)) return '';
+		if ($bLocalize)
+		{
+			return MetaModel::GetName($sValue);
+		}
+		else
+		{
+			return $sValue;
+		}
+	}
+
+	// Because this is sometimes used to get a localized/string version of an attribute...
+	public function GetEditValue($sValue, $oHostObj = null)
+	{
+		if (empty($sValue)) return '';
 		return MetaModel::GetName($sValue);
 	}
 
+ 	public function GetAsCSV($value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true)
+	{
+		if ($bLocalize && $value != '')
+		{
+			$sRawValue = MetaModel::GetName($value);
+		}
+		else
+		{
+			$sRawValue = $value;
+		}
+		return parent::GetAsCSV($sRawValue, $sSeparator, $sTextQualifier, null, false);
+	}
+
+	public function GetAsXML($value, $oHostObject = null, $bLocalize = true)
+	{
+		if (empty($value)) return '';
+		if ($bLocalize)
+		{
+			$sRawValue = MetaModel::GetName($value);
+		}
+		else
+		{
+			$sRawValue = $value;
+		}
+		return Str::pure2xml($sRawValue);
+	}
+
 	public function GetBasicFilterLooseOperator()
 	{
 		return '=';