1 <?php
2 3 4 5 6 7
8
9 defined('FOF_INCLUDED') or die;
10
11 12 13 14 15 16
17 class extends FOFFormHeaderField
18 {
19 20 21 22 23
24 protected function getFilter()
25 {
26
27 $format = $this->element['format'] ? (string) $this->element['format'] : '%Y-%m-%d';
28 $attributes = array();
29
30 if ($this->element['size'])
31 {
32 $attributes['size'] = (int) $this->element['size'];
33 }
34
35 if ($this->element['maxlength'])
36 {
37 $attributes['maxlength'] = (int) $this->element['maxlength'];
38 }
39
40 if ($this->element['filterclass'])
41 {
42 $attributes['class'] = (string) $this->element['filterclass'];
43 }
44
45 if ((string) $this->element['readonly'] == 'true')
46 {
47 $attributes['readonly'] = 'readonly';
48 }
49
50 if ((string) $this->element['disabled'] == 'true')
51 {
52 $attributes['disabled'] = 'disabled';
53 }
54
55 if ($this->element['onchange'])
56 {
57 $attributes['onchange'] = (string) $this->element['onchange'];
58 }
59 else
60 {
61 $onchange = 'document.adminForm.submit()';
62 }
63
64 if ((string) $this->element['placeholder'])
65 {
66 $attributes['placeholder'] = JText::_((string) $this->element['placeholder']);
67 }
68
69 $name = $this->element['searchfieldname'] ? $this->element['searchfieldname'] : $this->name;
70
71 if ($this->element['searchfieldname'])
72 {
73 $model = $this->form->getModel();
74 $searchvalue = $model->getState((string) $this->element['searchfieldname']);
75 }
76 else
77 {
78 $searchvalue = $this->value;
79 }
80
81
82 $config = FOFPlatform::getInstance()->getConfig();
83 $user = JFactory::getUser();
84
85
86 switch (strtoupper((string) $this->element['filter']))
87 {
88 case 'SERVER_UTC':
89
90 if ((int) $this->value)
91 {
92
93 $date = FOFPlatform::getInstance()->getDate($searchvalue, 'UTC');
94 $date->setTimezone(new DateTimeZone($config->get('offset')));
95
96
97 $searchvalue = $date->format('Y-m-d H:i:s', true, false);
98 }
99 break;
100
101 case 'USER_UTC':
102
103 if ((int) $searchvalue)
104 {
105
106 $date = FOFPlatform::getInstance()->getDate($this->value, 'UTC');
107 $date->setTimezone($user->getTimezone());
108
109
110 $searchvalue = $date->format('Y-m-d H:i:s', true, false);
111 }
112 break;
113 }
114
115 return JHtml::_('calendar', $searchvalue, $name, $name, $format, $attributes);
116 }
117
118 119 120 121 122
123 protected function getButtons()
124 {
125 return '';
126 }
127 }
128