function CCFormatValue($Value, $Format, $DataType, $isDBFormat = false) { switch ($DataType) { case ccsDate: $Value = CCFormatDate($Value, $Format); break; case ccsBoolean: $Value = CCFormatBoolean($Value, $Format); break; case ccsInteger: case ccsFloat: case ccsSingle: $Value = CCFormatNumber($Value, $Format, $DataType, $isDBFormat); break; case ccsText: case ccsMemo: $Value = strval($Value); break; } return $Value; }
function GetFormatedValue() { $strResult = ""; switch ($this->DataType) { case ccsDate: $strResult = CCFormatDate($this->Value, $this->DBFormat); break; case ccsBoolean: $strResult = CCFormatBoolean($this->Value, $this->DBFormat); break; case ccsInteger: case ccsFloat: $strResult = CCFormatNumber($this->Value, $this->DBFormat); break; case ccsText: case ccsMemo: $strResult = strval($this->Value); break; } return $strResult; }
function SQLValue($Value, $ValueType) { if ($ValueType == ccsDate && is_array($Value)) { $Value = CCFormatDate($Value, $this->DateFormat); } if (is_array($Value)) { $Value = count($Value) ? $Value[0] : ""; } if (!strlen($Value)) { return ""; } else { if ($ValueType == ccsInteger || $ValueType == ccsFloat) { return doubleval(str_replace(",", ".", $Value)); } else { if ($ValueType == ccsBoolean) { if (is_bool($Value)) { $Value = CCFormatBoolean($Value, $this->BooleanFormat); } else { if (is_numeric($Value)) { $Value = intval($Value); } else { if (strtoupper($Value) == "TRUE" || strtoupper($Value) == "FALSE") { $Value = strtoupper($Value); } else { $Value = $this->esc($Value); } } } return $Value; } else { return $this->esc($Value); } } } }