PHP 클래스 Prado\I18N\TNumberFormat

Numbers can be formatted as currency, percentage, decimal or scientific numbers by specifying the Type attribute. The known types are "currency", "percentage", "decimal" and "scientific". If someone from US want to see sales figures from a store in Germany (say using the EURO currency), formatted using the german currency, you would need to use the attribute Culture="de_DE" to get the currency right, e.g. 100,00. The decimal and grouping separator is then also from the de_DE locale. This may lead to some confusion because people from US know the "," as thousand separator. Therefore a "Currency" attribute is available, so that the output from the following example results in 100.00. Namespace: System.I18N Properties - Value, number,
Gets or sets the number to format. The tag content is used as Value if the Value property is not specified. - Type, string,
Gets or sets the formatting type. The valid types are 'decimal', 'currency', 'percentage' and 'scientific'. - Currency, string,
Gets or sets the currency symbol for the currency format. The default is 'USD' if the Currency property is not specified. - Pattern, string,
Gets or sets the custom number formatting pattern. - DefaultText, string,
Gets or sets the default text. If Value is not set, DefaultText will be shown instead of the default currency Value/Pattern.
상속: extends TI18NControl, implements Prado\IDataRenderer
파일 보기 프로젝트 열기: pradosoft/prado

보호된 프로퍼티들

프로퍼티 타입 설명
$formatter Prado\I18N\core\NumberFormat Default NumberFormat, set to the application culture.

공개 메소드들

메소드 설명
getCurrency ( ) : string
getData ( ) : string Get the numberic value for this control.
getDefaultText ( ) : string Get the default text value for this control.
getPattern ( ) : string Get the number formatting pattern.
getType ( ) : string Get the formatting type for this control.
getValue ( ) : string Get the numberic value for this control.
render ( $writer )
setCurrency ( $currency ) Set the 3-letter ISO 4217 code. For example, the code "USD" represents the US Dollar and "EUR" represents the Euro currency.
setData ( $value ) Set the numberic value for this control.
setDefaultText ( $value ) Set the default text value for this control.
setPattern ( $pattern ) Set the number format pattern.
setType ( $type ) Set the formatting type for this control.
setValue ( $value ) Set the numberic value for this control.

보호된 메소드들

메소드 설명
getFormattedValue ( ) : string Formats the localized number, be it currency or decimal, or percentage.

메소드 상세

getCurrency() 공개 메소드

public getCurrency ( ) : string
리턴 string 3 letter currency code. Defaults to 'USD'.

getData() 공개 메소드

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link getValue()}.
또한 보기: getValue
부터: 3.1.2
public getData ( ) : string
리턴 string number

getDefaultText() 공개 메소드

Get the default text value for this control.
public getDefaultText ( ) : string
리턴 string default text value

getFormattedValue() 보호된 메소드

If the culture is not specified, the default application culture will be used.
protected getFormattedValue ( ) : string
리턴 string formatted number

getPattern() 공개 메소드

Get the number formatting pattern.
public getPattern ( ) : string
리턴 string format pattern.

getType() 공개 메소드

Get the formatting type for this control.
public getType ( ) : string
리턴 string formatting type.

getValue() 공개 메소드

Get the numberic value for this control.
public getValue ( ) : string
리턴 string number

render() 공개 메소드

public render ( $writer )

setCurrency() 공개 메소드

Set the 3-letter ISO 4217 code. For example, the code "USD" represents the US Dollar and "EUR" represents the Euro currency.
public setCurrency ( $currency )

setData() 공개 메소드

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link setValue()}.
또한 보기: setValue
부터: 3.1.2
public setData ( $value )

setDefaultText() 공개 메소드

Set the default text value for this control.
public setDefaultText ( $value )

setPattern() 공개 메소드

Set the number format pattern.
public setPattern ( $pattern )

setType() 공개 메소드

Set the formatting type for this control.
public setType ( $type )

setValue() 공개 메소드

Set the numberic value for this control.
public setValue ( $value )

프로퍼티 상세

$formatter 보호되어 있는 정적으로 프로퍼티

Default NumberFormat, set to the application culture.
protected static NumberFormat,Prado\I18N\core $formatter
리턴 Prado\I18N\core\NumberFormat