1 | <?php |
||
23 | class Date extends Editable |
||
24 | 1 | { |
|
25 | const FORMAT_TEXT = 'd M Y'; |
||
26 | const FORMAT_DATE = 'd.m.Y'; |
||
27 | const FORMAT_DATETIME = 'd.m.Y H:i:s'; |
||
28 | |||
29 | /** @var string */ |
||
30 | protected $dateFormat = self::FORMAT_DATE; |
||
31 | |||
32 | /** |
||
33 | * @param \Grido\Grid $grid |
||
34 | * @param string $name |
||
35 | * @param string $label |
||
36 | * @param string $dateFormat |
||
37 | */ |
||
38 | public function __construct($grid, $name, $label, $dateFormat = NULL) |
||
39 | { |
||
40 | 1 | parent::__construct($grid, $name, $label); |
|
41 | |||
42 | 1 | if ($dateFormat !== NULL) { |
|
43 | 1 | $this->dateFormat = $dateFormat; |
|
44 | 1 | } |
|
45 | 1 | } |
|
46 | |||
47 | /** |
||
48 | * @param string $format |
||
49 | * @return Date |
||
50 | */ |
||
51 | public function setDateFormat($format) |
||
52 | { |
||
53 | 1 | $this->dateFormat = $format; |
|
54 | 1 | return $this; |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getDateFormat() |
||
64 | |||
65 | /** |
||
66 | * @param mixed $value |
||
67 | * @return mixed |
||
68 | */ |
||
69 | protected function formatValue($value) |
||
85 | |||
86 | /** |
||
87 | * @param mixed $row |
||
88 | * @return string |
||
89 | * @internal |
||
90 | */ |
||
91 | public function renderExport($row) |
||
100 | } |
||
101 |