phpPeanuts  2.2.0
phpPeanuts framework
 All Data Structures Namespaces Files Functions Variables
Public Member Functions | Static Public Member Functions | Data Fields
PntStringConverter Class Reference

Inherits PntObject.

Inherited by StringConverter.

Public Member Functions

 __construct ()
 
 getDateTimezone ()
 
 getErrorInvalidNumber ()
 
 initFromProp ($prop)
 
 getLabelCharset ()
 
 getLanguageId ()
 
 setHtml_version_ent ($value)
 
 toHtml ($string, $breaksForLineFeeds=false, $preformatAndTab=0)
 
 toJsLiteral ($string, $quote="'")
 
 urlEncode ($string)
 
 toLabel ($value, $type)
 
 arrayToLabel ($array, $type)
 
 labelFromBoolean ($value)
 
 labelFromNumber ($value)
 
 labelFromDate ($value)
 
 labelFromTime ($value)
 
 labelFromTimestamp ($value)
 
 labelFromString ($value)
 
 labelFromObject ($value)
 
 fromRequestData ($requestString)
 
 fromLabel ($string)
 
 convert ($string)
 
 convertToBoolean ($string)
 
 convertToNumber ($string)
 
 convertToDate ($string)
 
 convertToTime ($string)
 
 convertToTimestamp ($string)
 
 convertToString ($string)
 
 convertToObject ($string)
 
 usKbConvert4Uropean ($string)
 
- Public Member Functions inherited from PntObject
 __construct ()
 
 copy ()
 
 getClass ()
 
 getClassDescriptor ()
 
 initPropertyDescriptors ()
 
 getOid ()
 
 addFieldProp ($name, $type, $readOnly=false, $minValue=null, $maxValue=null, $minLength=0, $maxLength=null, $classDir=null, $persistent=true)
 
 addDerivedProp ($name, $type, $readOnly=true, $minValue=null, $maxValue=null, $minLength=0, $maxLength=null, $classDir=null)
 
 addMultiValueProp ($name, $type, $readOnly=true, $minValue=null, $maxValue=null, $minLength=0, $maxLength=null, $classDir=null)
 
 getPropertyDescriptor ($propertyName)
 
 get ($propertyName, $filter=true)
 
 set ($propertyName, $value)
 
 getOptions ($name, $filter=true)
 
 getValueValidator ($prop)
 
 validateGetErrorString ($prop, $value, $validateReadOnly=true)
 
 basicGetLabel ()
 
 getLabel ()
 
 __toString ()
 
 release ()
 
 getEditInfo ()
 
 toString ()
 
 _getValueValidator ($prop)
 

Static Public Member Functions

static html_version_entOptions ()
 
static getTimeStampSeparators ()
 
static convertDT ($string, $format, $type)
 
static splitDT ($value, $format)
 
static addMonthName (&$dateArray, $monthNames, $format='F')
 
static splitDtNoSeparators ($value, $formatArray)
 
static formatDT ($dtArray, $format)
 
static checkTime ($hours, $minutes, $seconds)
 
static sanitizeString ($txt)
 
static sanitizeHtml ($txt)
 
- Static Public Member Functions inherited from PntObject
static isPersistent ()
 
static getClassDescriptorClass ()
 
static getClassDir ()
 
static getClassLabel ()
 
static getUiColumnPaths ()
 
static getReportColumnPaths ()
 
static getUiFieldPaths ($clsDes)
 
static newNavigation ($key, $itemType)
 

Data Fields

 $labelItemSeparator = ', '
 
 $true ='true'
 
 $false ='false'
 
 $dateTimezone = null
 
 $dateFormat ="Y-m-d"
 
 $timestampFormat ="Y-m-d H:i:s"
 
 $timeFormat ="H:i:s"
 
 $decimal ='.'
 
 $thousends =','
 
 $labelCharset = null
 
 $html_version_ent = 'ENT_HTML401'
 
 $html_version_flag = 0
 
 $languageId = 'en'
 
 $usKbSupport4Uropean = false
 
 $emptyToInfinity =false
 
 $errorInvalidNumber ='invalid number, expected is like: '
 
 $errorInvalidDate ='invalid date, expected is like: '
 
 $errorInvalidTimestamp ='invalid timestamp, expected is like: '
 
 $errorInvalidTime ='invalid time, expected is like: '
 
 $errorInvalidBoolean ='invalid boolean, expected: '
 
 $errorInvalidType ='invalid type: '
 
 $type
 
 $decimalPrecision = 2
 
 $asId = false
 
 $error
 

Constructor & Destructor Documentation

__construct ( )

Member Function Documentation

static addMonthName ( $dateArray,
  $monthNames,
  $format = 'F' 
)
static
arrayToLabel (   $array,
  $type 
)
static checkTime (   $hours,
  $minutes,
  $seconds 
)
static
convert (   $string)
static convertDT (   $string,
  $format,
  $type 
)
static

works for date, time and timestamp, only supports numeric date and time elements, so no monthnames, daynames and no AM/PM

Parameters
$stringString containing date and/or time
$formatthe format $string should be in
$typeString either 'date', 'time' or 'timestamp'.
Returns
String containing date and/or time in the internal format corrensponding to $type
convertToBoolean (   $string)
convertToDate (   $string)
convertToNumber (   $string)
convertToObject (   $string)
convertToString (   $string)
convertToTime (   $string)
convertToTimestamp (   $string)
static formatDT (   $dtArray,
  $format 
)
static

Format date, time or timestamp String from Array Limitation: only works for formats that require no conversion of elements, in practice these are only using Y, m, d, H, i and/or s

Parameters
Arrayof String $dtArray with keys from format
String$format
Returns
String
fromLabel (   $string)

converts from user interface string representation to domain model property value.

Returns
mixed value or null if conversion fails $this->error will hold an error message if some error occurs
fromRequestData (   $requestString)

clean up a request string.

Parameters
string$requestStringfrom PntRequestHandler::getRequestParam
getDateTimezone ( )
getErrorInvalidNumber ( )
getLabelCharset ( )
Returns
String the character encoding of labels in the user interface. requestData and html are assumed to be in this charset. You need to override and add character conversion if you set this to be different from ValueValidator::getInternalCharset
getLanguageId ( )
static getTimeStampSeparators ( )
static
static html_version_entOptions ( )
static
initFromProp (   $prop)
labelFromBoolean (   $value)
labelFromDate (   $value)
labelFromNumber (   $value)
labelFromObject (   $value)
labelFromString (   $value)
labelFromTime (   $value)
labelFromTimestamp (   $value)
static sanitizeHtml (   $txt)
static
static sanitizeString (   $txt)
static
setHtml_version_ent (   $value)

Sets html_version_ent and if applicable, html_version_flag

Parameters
String$valueto be set PntError if value not in StringConverter::html_version_entOptions()
static splitDT (   $value,
  $format 
)
static

Split date, time or timeStamp, answer array with keys from format Limitation: only works for formats using Y, m, d, H, i and/or s and separators from getTimeStampSeparators()

Parameters
Stringdate, time or timestamp String
String$format
Returns
Array of String
static splitDtNoSeparators (   $value,
  $formatArray 
)
static
toHtml (   $string,
  $breaksForLineFeeds = false,
  $preformatAndTab = 0 
)

Convert a string to HTML.

Parameters
string$stringThe string to convert
boolean$breaksForLineFeedsWheather to convert line feeds to
$param boolean $preformatAndTab if set > 0 convert multiple spaces to non-breaking spaces and replace tabs by the specified number of non-breaking spaces
Returns
String with HTML
toJsLiteral (   $string,
  $quote = "'" 
)
Returns
String a javascript literal string WARNING: This implementation is NOT OK for UTF-8 and other multi byte charsets! if you use those, you must override this method on StringConverter)
toLabel (   $value,
  $type 
)
urlEncode (   $string)
Returns
String encoded for usage in urls. WARNING: This implementation may NOT be OK for UTF-8 and other multi byte charsets! if you use those, you may need to override this method on StringConverter) check the PHP documentation of urlencode to see what to do for the character set you want to use.
usKbConvert4Uropean (   $string)

Field Documentation

$asId = false
$dateFormat ="Y-m-d"
$dateTimezone = null
$decimal ='.'
$decimalPrecision = 2
$emptyToInfinity =false
$error
$errorInvalidBoolean ='invalid boolean, expected: '
$errorInvalidDate ='invalid date, expected is like: '
$errorInvalidNumber ='invalid number, expected is like: '
$errorInvalidTime ='invalid time, expected is like: '
$errorInvalidTimestamp ='invalid timestamp, expected is like: '
$errorInvalidType ='invalid type: '
$false ='false'
$html_version_ent = 'ENT_HTML401'
$html_version_flag = 0
$labelCharset = null
$labelItemSeparator = ', '
$languageId = 'en'
$thousends =','
$timeFormat ="H:i:s"
$timestampFormat ="Y-m-d H:i:s"
$true ='true'
$type
$usKbSupport4Uropean = false

The documentation for this class was generated from the following file: