diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php
index d753eed141..cf67f29cb5 100644
--- a/core/attributedef.class.inc.php
+++ b/core/attributedef.class.inc.php
@@ -3291,16 +3291,26 @@ class AttributeOneWayPassword extends AttributeDefinition
}
// Indexed array having two dimensions
-class AttributeTable extends AttributeText
+class AttributeTable extends AttributeDBField
{
- public function GetEditClass() {return "Text";}
- protected function GetSQLCol() {return "TEXT";}
+ public function GetEditClass() {return "Table";}
+ protected function GetSQLCol() {return "LONGTEXT";}
public function GetMaxSize()
{
return null;
}
+ public function GetNullValue()
+ {
+ return array();
+ }
+
+ public function IsNull($proposedValue)
+ {
+ return (count($proposedValue) == 0);
+ }
+
// Facilitate things: allow the user to Set the value from a string
public function MakeRealValue($proposedValue, $oHostObj)
{
@@ -3363,13 +3373,39 @@ class AttributeTable extends AttributeText
$sRes .= "";
return $sRes;
}
+
+ public function GetAsCSV($sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null)
+ {
+ // Not implemented
+ return '';
+ }
+
+ public function GetAsXML($value, $oHostObject = null)
+ {
+ if (count($value) == 0)
+ {
+ return "";
+ }
+
+ $sRes = "";
+ foreach($value as $iRow => $aRawData)
+ {
+ $sRes .= "";
+ foreach ($aRawData as $iCol => $cell)
+ {
+ $sCell = Str::pure2xml((string)$cell);
+ $sRes .= "| $sCell | ";
+ }
+ $sRes .= "
";
+ }
+ return $sRes;
+ }
}
// The PHP value is a hash array, it is stored as a TEXT column
class AttributePropertySet extends AttributeTable
{
- public function GetEditClass() {return "Text";}
- protected function GetSQLCol() {return "TEXT";}
+ public function GetEditClass() {return "PropertySet";}
// Facilitate things: allow the user to Set the value from a string
public function MakeRealValue($proposedValue, $oHostObj)
@@ -3396,6 +3432,10 @@ class AttributePropertySet extends AttributeTable
$sRes .= "
";
foreach($value as $sProperty => $sValue)
{
+ if ($sProperty == 'auth_pwd')
+ {
+ $sValue = '*****';
+ }
$sRes .= "";
$sCell = str_replace("\n", "
\n", Str::pure2html((string)$sValue));
$sRes .= "$sProperty | $sCell | ";
@@ -3405,6 +3445,53 @@ class AttributePropertySet extends AttributeTable
$sRes .= "";
return $sRes;
}
+
+ public function GetAsCSV($value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null)
+ {
+ if (count($value) == 0)
+ {
+ return "";
+ }
+
+ $aRes = array();
+ foreach($value as $sProperty => $sValue)
+ {
+ if ($sProperty == 'auth_pwd')
+ {
+ $sValue = '*****';
+ }
+ $sFrom = array(',', '=');
+ $sTo = array('\,', '\=');
+ $aRes[] = $sProperty.'='.str_replace($sFrom, $sTo, (string)$sValue);
+ }
+ $sRaw = implode(',', $aRes);
+
+ $sFrom = array("\r\n", $sTextQualifier);
+ $sTo = array("\n", $sTextQualifier.$sTextQualifier);
+ $sEscaped = str_replace($sFrom, $sTo, $sRaw);
+ return $sTextQualifier.$sEscaped.$sTextQualifier;
+ }
+
+ public function GetAsXML($value, $oHostObject = null)
+ {
+ if (count($value) == 0)
+ {
+ return "";
+ }
+
+ $sRes = "";
+ foreach($value as $sProperty => $sValue)
+ {
+ if ($sProperty == 'auth_pwd')
+ {
+ $sValue = '*****';
+ }
+ $sRes .= "";
+ $sRes .= Str::pure2xml((string)$sValue);
+ $sRes .= "";
+ }
+ return $sRes;
+ }
}
/**