/** * @param $format boolean * @return Element */ protected function buildDateTime($format = true) { $input = new Input($this->getFieldName(), $format ? Loc::dateToLocale($this->value) : $this->value); $input->setAttribute('autocomplete', 'off'); if ($this->readonly) { $input->setAttribute('readonly'); } $input->addClass('datetime'); return $input; }
/** * Returns a value with application of current locales * * @param $template Template * @return object */ public function getLoc(Template $template) { foreach ($template->objects as $object) { if (is_object($object)) { if ($object instanceof Date_Time) { return Loc::dateToLocale($object); } else { $property_name = reset($template->var_names); if (method_exists(get_class($object), $property_name)) { $method = new Reflection_Method(get_class($object), $property_name); return Loc::methodToLocale($method, reset($template->objects)); } else { $property = new Reflection_Property(get_class($object), $property_name); return Loc::propertyToLocale($property, reset($template->objects)); } } break; } } return reset($object); }