0; } public function GetEditValue($sValue, $oHostObj = null) { return ''; } // Facilitate things: allow the user to Set the value from a string public function MakeRealValue($proposedValue, $oHostObj) { if (is_null($proposedValue)) { return []; } else { if (!is_array($proposedValue)) { return [0 => [0 => $proposedValue]]; } } return $proposedValue; } public function FromSQLToValue($aCols, $sPrefix = '') { try { $value = @unserialize($aCols[$sPrefix.'']); if ($value === false) { $value = @json_decode($aCols[$sPrefix.''], true); if (is_null($value)) { $value = false; } } if ($value === false) { $value = $this->MakeRealValue($aCols[$sPrefix.''], null); } } catch (Exception $e) { $value = $this->MakeRealValue($aCols[$sPrefix.''], null); } return $value; } public function GetSQLValues($value) { $aValues = []; try { $sSerializedValue = serialize($value); } catch (Exception $e) { $sSerializedValue = json_encode($value); } $aValues[$this->Get("sql")] = $sSerializedValue; return $aValues; } public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { if (!is_array($value)) { throw new CoreException('Expecting an array', ['found' => get_class($value)]); } if (count($value) == 0) { return ""; } $sRes = ""; $sRes .= ""; foreach ($value as $iRow => $aRawData) { $sRes .= ""; foreach ($aRawData as $iCol => $cell) { // Note: avoid the warning in case the cell is made of an array $sCell = @Str::pure2html((string)$cell); $sCell = str_replace("\n", "
\n", $sCell); $sRes .= ""; } $sRes .= ""; } $sRes .= ""; $sRes .= "
$sCell
"; return $sRes; } public function GetAsCSV( $sValue, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, $bConvertToPlainText = false ) { // Not implemented return ''; } public function GetAsXML($value, $oHostObject = null, $bLocalize = true) { if (!is_array($value) || 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; } }