10 defined(
'JPATH_PLATFORM') or die;
30 protected $type =
'Calendar';
65 public function __get($name)
75 return parent::__get($name);
88 public function __set($name, $value)
93 $value = (int) $value;
97 $this->$name = (string) $value;
101 parent::__set($name, $value);
119 public function setup(SimpleXMLElement $element, $value, $group = null)
121 $return = parent::setup($element, $value, $group);
125 $this->maxlength = (int) $this->element[
'maxlength'] ? (
int) $this->element[
'maxlength'] : 45;
126 $this->format = (string) $this->element[
'format'] ? (
string) $this->element[
'format'] :
'%Y-%m-%d';
127 $this->filter = (string) $this->element[
'filter'] ? (
string) $this->element[
'filter'] :
'USER_UTC';
140 protected function getInput()
143 $hint = $this->translateHint ?
JText::_($this->hint) : $this->hint;
146 $format = $this->format;
149 $attributes = array();
151 empty($this->size) ? null : $attributes[
'size'] = $this->size;
152 empty($this->maxlength) ? null : $attributes[
'maxlength'] = $this->maxlength;
153 empty($this->
class) ? null : $attributes[
'class'] = $this->class;
154 !$this->readonly ? null : $attributes[
'readonly'] =
'';
155 !$this->disabled ? null : $attributes[
'disabled'] =
'';
156 empty($this->onchange) ? null : $attributes[
'onchange'] = $this->onchange;
157 empty($hint) ? null : $attributes[
'placeholder'] = $hint;
158 $this->autocomplete ? null : $attributes[
'autocomplete'] =
'off';
159 !$this->autofocus ? null : $attributes[
'autofocus'] =
'';
163 $attributes[
'required'] =
'';
164 $attributes[
'aria-required'] =
'true';
168 if (strtoupper($this->value) ==
'NOW')
170 $this->value = strftime($format);
178 switch (strtoupper($this->filter))
182 if ((
int) $this->value)
186 $date->setTimezone(
new DateTimeZone($config->get(
'offset')));
189 $this->value = $date->format(
'Y-m-d H:i:s',
true,
false);
196 if ((
int) $this->value)
201 $date->setTimezone(
new DateTimeZone($user->getParam(
'timezone', $config->get(
'offset'))));
204 $this->value = $date->format(
'Y-m-d H:i:s',
true,
false);
211 JHtml::_(
'jquery.framework');
212 JHtml::_(
'script',
'system/html5fallback.js',
false,
true);
214 return JHtml::_(
'calendar', $this->value, $this->name, $this->
id, $format, $attributes);