'Today', 'close'=>'Close');
function __construct($name) {
$this->mName = $name;
$this->mDateObj = new DateAndTime();
if (isset($GLOBALS["I18N"])) {
$this->setLocalization($GLOBALS["I18N"]);
}
}
function setLocalization($i18n) {
global $user;
FormElement::setLocalization($i18n);
$this->mDateObj->setFormat($user->date_format);
$this->mMonthNames = $i18n->monthNames;
$this->mWeekDayShortNames = $i18n->weekdayShortNames;
$this->lToday = $i18n->getKey('label.today');
$this->lCalendarButtons['today'] = $i18n->getKey('label.today');
$this->lCalendarButtons['close'] = $i18n->getKey('button.close');
$this->mDateFormat = $user->date_format;
$this->mWeekStartDay = $user->week_start;
}
// set current value taken from session or database
function setValueSafe($value) {
if (isset($value) && (strlen($value) > 0)) {
$this->mDateObj->parseVal($value, DB_DATEFORMAT);
$this->mValue = $this->mDateObj->toString($this->mDateFormat); //?
}
}
// get value for storing in session or database
function getValueSafe() {
if (strlen($this->mValue)>0) {
$this->mDateObj->parseVal($this->mValue, $this->mDateFormat); //?
return $this->mDateObj->toString(DB_DATEFORMAT);
} else {
return null;
}
}
function toStringControl() {
if (!$this->isRenderable()) return "";
if (!$this->isEnable()) {
$html = htmlspecialchars($this->getValue()).
"mName\" value=\"".htmlspecialchars($this->getValue())."\">\n";
} else {
if ($this->mId=="") $this->mId = $this->mName;
$html = "";
// http://www.nsftools.com/tips/JavaScriptTips.htm#datepicker
$html .= "\n";
$html .= "\n";
$html .= "\n\tmName\" id=\"$this->mId\"";
if ($this->mSize!="")
$html .= " size=\"$this->mSize\"";
if ($this->mStyle!="")
$html .= " style=\"$this->mStyle\"";
$html .= " maxlength=\"50\"";
if ($this->mOnChange!="")
$html .= " onchange=\"$this->mOnChange\"";
if ($this->mOnBlur!="")
$html .= " onblur=\"$this->mOnBlur\"";
if ($this->mOnClick!="")
$html .= " onclick=\"$this->mOnClick\"";
if ($this->mOnFocus!="")
$html .= " onfocus=\"$this->mOnFocus\"";
$html .= " value=\"".htmlspecialchars($this->getValue())."\"";
$html .= ">";
if (APP_NAME)
$app_root = '/'.APP_NAME;
$html .= " mName."');\">\n";
}
return $html;
}
}