X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fform%2FDateField.class.php;h=f8eef8cb84675206d02640929a93950ef5504c1b;hb=074e8daef75c2b729e75f350b52935a6b7ecfba8;hp=d2331387dc5168f238c0e0cfde30a907b91e721e;hpb=5532fe6cfc2125063ff8040cfa80e20089ac64b0;p=timetracker.git diff --git a/WEB-INF/lib/form/DateField.class.php b/WEB-INF/lib/form/DateField.class.php index d2331387..f8eef8cb 100644 --- a/WEB-INF/lib/form/DateField.class.php +++ b/WEB-INF/lib/form/DateField.class.php @@ -33,25 +33,21 @@ class DateField extends TextField { var $mWeekStartDay = 0; var $mDateFormat = "d/m/Y"; var $lToday = "Today"; - var $mDateObj; - var $cClassName = "DateField"; var $lCalendarButtons = array('today'=>'Today', 'close'=>'Close'); function __construct($name) { - $this->name = $name; - $this->mDateObj = new DateAndTime(); - - if (isset($GLOBALS["I18N"])) { - $this->setLocalization($GLOBALS["I18N"]); - } + $this->class = 'DateField'; + $this->name = $name; + $this->mDateObj = new DateAndTime(); + $this->localize(); } - function setLocalization($i18n) { - global $user; + function localize() { + global $user; + global $i18n; - FormElement::setLocalization($i18n); $this->mDateObj->setFormat($user->date_format); $this->mMonthNames = $i18n->monthNames; @@ -81,9 +77,10 @@ class DateField extends TextField { } } - function toStringControl() { + function getHtml() { + global $user; - if (!$this->isEnable()) { + if (!$this->isEnabled()) { $html = htmlspecialchars($this->getValue()). "name\" value=\"".htmlspecialchars($this->getValue())."\">\n"; } else { @@ -298,9 +295,7 @@ class DateField extends TextField { function getDateString(dateVal) {\n"; - if (isset($GLOBALS['i18n'])) { - $html .= "dateVal.locale = \"".$GLOBALS['i18n']->lang."\";\n"; - } + $html .= "dateVal.locale = \"".$user->lang."\";\n"; $html .= "return dateVal.strftime(dateFormat); }