1 | <?php |
||
44 | class TNumberFormat extends TI18NControl implements \Prado\IDataRenderer |
||
45 | { |
||
46 | /** |
||
47 | * Cached NumberFormatters set to the application culture. |
||
48 | * @var NumberFormatter |
||
49 | */ |
||
50 | protected static $formatters; |
||
51 | |||
52 | /** |
||
53 | * Get the number formatting pattern. |
||
54 | * @return string format pattern. |
||
55 | */ |
||
56 | public function getPattern() |
||
60 | |||
61 | /** |
||
62 | * Set the number format pattern. |
||
63 | * @param string $pattern format pattern. |
||
64 | */ |
||
65 | public function setPattern($pattern) |
||
69 | |||
70 | /** |
||
71 | * Get the numberic value for this control. |
||
72 | * @return string number |
||
73 | */ |
||
74 | public function getValue() |
||
78 | |||
79 | /** |
||
80 | * Set the numberic value for this control. |
||
81 | * @param string $value the number value |
||
82 | */ |
||
83 | public function setValue($value) |
||
87 | |||
88 | /** |
||
89 | * Get the default text value for this control. |
||
90 | * @return string default text value |
||
91 | */ |
||
92 | public function getDefaultText() |
||
96 | |||
97 | /** |
||
98 | * Set the default text value for this control. |
||
99 | * @param string $value default text value |
||
100 | */ |
||
101 | public function setDefaultText($value) |
||
105 | |||
106 | /** |
||
107 | * Get the numberic value for this control. |
||
108 | * This method is required by {@link \Prado\IDataRenderer}. |
||
109 | * It is the same as {@link getValue()}. |
||
110 | * @return string number |
||
111 | * @see getValue |
||
112 | * @since 3.1.2 |
||
113 | */ |
||
114 | public function getData() |
||
118 | |||
119 | /** |
||
120 | * Set the numberic value for this control. |
||
121 | * This method is required by {@link \Prado\IDataRenderer}. |
||
122 | * It is the same as {@link setValue()}. |
||
123 | * @param string $value the number value |
||
124 | * @see setValue |
||
125 | * @since 3.1.2 |
||
126 | */ |
||
127 | public function setData($value) |
||
131 | |||
132 | /** |
||
133 | * Get the formatting type for this control. |
||
134 | * @return string formatting type. |
||
135 | */ |
||
136 | public function getType() |
||
140 | |||
141 | /** |
||
142 | * Set the formatting type for this control. |
||
143 | * @param string $type formatting type, either "decimal", "currency", "percentage", "scientific", "spellout", "ordinal" or "duration" |
||
144 | * @throws TPropertyTypeInvalidException |
||
145 | */ |
||
146 | public function setType($type) |
||
169 | |||
170 | /** |
||
171 | * @return string 3 letter currency code. Defaults to 'USD'. |
||
172 | */ |
||
173 | public function getCurrency() |
||
177 | |||
178 | /** |
||
179 | * Set the 3-letter ISO 4217 code. For example, the code |
||
180 | * "USD" represents the US Dollar and "EUR" represents the Euro currency. |
||
181 | * @param string $currency currency code. |
||
182 | */ |
||
183 | public function setCurrency($currency) |
||
187 | |||
188 | /** |
||
189 | * Formats the localized number, be it currency or decimal, or percentage. |
||
190 | * If the culture is not specified, the default application |
||
191 | * culture will be used. |
||
192 | * @param string $culture |
||
193 | * @param mixed $type |
||
194 | * @return NumberFormatter |
||
195 | */ |
||
196 | protected function getFormatter($culture, $type) |
||
205 | |||
206 | /** |
||
207 | * Formats the localized number, be it currency or decimal, or percentage. |
||
208 | * If the culture is not specified, the default application |
||
209 | * culture will be used. |
||
210 | * @return string formatted number |
||
211 | */ |
||
212 | protected function getFormattedValue() |
||
241 | |||
242 | public function render($writer) |
||
246 | } |
||
247 |