'Today', 'close'=>'Close');
function __construct($name) {
$this->class = 'DateField';
$this->name = $name;
$this->mDateObj = new DateAndTime();
if (isset($GLOBALS["I18N"])) {
$this->localize($GLOBALS["I18N"]);
}
}
function localize($i18n) {
global $user;
$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->value = $this->mDateObj->toString($this->mDateFormat); //?
}
}
// get value for storing in session or database
function getValueSafe() {
if (strlen($this->value)>0) {
$this->mDateObj->parseVal($this->value, $this->mDateFormat); //?
return $this->mDateObj->toString(DB_DATEFORMAT);
} else {
return null;
}
}
function getHtml() {
if (!$this->isEnabled()) {
$html = htmlspecialchars($this->getValue()).
"name\" value=\"".htmlspecialchars($this->getValue())."\">\n";
} else {
if ($this->id=="") $this->id = $this->name;
$html = "";
// http://www.nsftools.com/tips/JavaScriptTips.htm#datepicker
$html .= "\n";
$html .= "\n";
$html .= "\n\tname\" id=\"$this->id\"";
if ($this->size!="")
$html .= " size=\"$this->size\"";
if ($this->style!="")
$html .= " style=\"$this->style\"";
$html .= " maxlength=\"50\"";
if ($this->on_change!="")
$html .= " onchange=\"$this->on_change\"";
if ($this->on_click!="")
$html .= " onclick=\"$this->on_click\"";
$html .= " value=\"".htmlspecialchars($this->getValue())."\"";
$html .= ">";
if (APP_NAME)
$app_root = '/'.APP_NAME;
$html .= " name."');\">\n";
}
return $html;
}
}