1 | <?php |
||
23 | class Number extends Editable |
||
24 | 1 | { |
|
25 | /** @var array */ |
||
26 | protected $numberFormat = [ |
||
27 | self::NUMBER_FORMAT_DECIMALS => 0, |
||
28 | self::NUMBER_FORMAT_DECIMAL_POINT => '.', |
||
29 | self::NUMBER_FORMAT_THOUSANDS_SEPARATOR => ',' |
||
30 | ]; |
||
31 | |||
32 | /** @const keys of array $numberFormat */ |
||
33 | const NUMBER_FORMAT_DECIMALS = 0; |
||
34 | const NUMBER_FORMAT_DECIMAL_POINT = 1; |
||
35 | const NUMBER_FORMAT_THOUSANDS_SEPARATOR = 2; |
||
36 | |||
37 | /** |
||
38 | * @param \Grido\Grid $grid |
||
39 | * @param string $name |
||
40 | * @param string $label |
||
41 | * @param int $decimals number of decimal points |
||
42 | * @param string $decPoint separator for the decimal point |
||
43 | * @param string $thousandsSep thousands separator |
||
44 | */ |
||
45 | public function __construct($grid, $name, $label, $decimals = NULL, $decPoint = NULL, $thousandsSep = NULL) |
||
51 | |||
52 | /** |
||
53 | * Sets number format. Params are same as internal function number_format(). |
||
54 | * @param int $decimals number of decimal points |
||
55 | * @param string $decPoint separator for the decimal point |
||
56 | * @param string $thousandsSep thousands separator |
||
57 | * @return Number |
||
58 | */ |
||
59 | public function setNumberFormat($decimals = NULL, $decPoint = NULL, $thousandsSep = NULL) |
||
75 | |||
76 | /** |
||
77 | * @return array |
||
78 | */ |
||
79 | public function getNumberFormat() |
||
83 | |||
84 | /** |
||
85 | * @param mixed $value |
||
86 | * @return string |
||
87 | */ |
||
88 | protected function formatValue($value) |
||
100 | } |
||
101 |