/** * return the field * * @return string: the field * @author Thomas Branius * @access public * @since 16-03-2010 */ function getField() { // view mode enabled ? if ($this->getViewMode()) { // get the view value.. return $this->_getViewValue(); } $html = parent::getField(); // add the javascript needed for the js calendar field $this->_oForm->_setJS("// create popup calendar\n" . "if( document.getElementById('" . $this->_sName . "_span') ) \n" . "{\n" . " var cal_" . $this->_sName . " = new CalendarPopup('" . $this->_sName . "_span');\n" . " cal_" . $this->_sName . ".setMonthNames('" . $this->_oForm->_text(1) . "','" . $this->_oForm->_text(2) . "','" . $this->_oForm->_text(3) . "','" . $this->_oForm->_text(4) . "','" . $this->_oForm->_text(5) . "','" . $this->_oForm->_text(6) . "','" . $this->_oForm->_text(7) . "','" . $this->_oForm->_text(8) . "','" . $this->_oForm->_text(9) . "','" . $this->_oForm->_text(10) . "','" . $this->_oForm->_text(11) . "','" . $this->_oForm->_text(12) . "');\n" . " cal_" . $this->_sName . ".setDayHeaders(" . $this->_oForm->_text(43) . ");\n" . " cal_" . $this->_sName . ".setWeekStartDay(" . FH_JSCALENDARPOPUP_STARTDAY . ");\n" . " cal_" . $this->_sName . ".setTodayText('" . addslashes($this->_oForm->_text(42)) . "');\n" . " cal_" . $this->_sName . ".showYearNavigation();\n" . " cal_" . $this->_sName . ".showYearNavigationInput();\n" . (FH_JSCALENDARPOPUP_USE_DROPDOWN ? " cal_" . $this->_sName . ".showNavigationDropdowns();\n" : "") . "}\n", 0, 0); $html .= "<a href='javascript:;' " . "onclick=\"if( cal_" . $this->_sName . " ) cal_" . $this->_sName . ".select(document.forms['" . $this->_oForm->_name . "'].elements['" . $this->_sName . "'], 'anchor_" . $this->_sName . "', '" . $this->_sJsMask . "'); return false;\" " . " name='anchor_" . $this->_sName . "' id='anchor_" . $this->_sName . "'>" . "<img src='" . FH_FHTML_DIR . "images/calendar.gif' border='0' alt='Select Date' " . FH_XHTML_CLOSE . "></a>\n" . "<span id='" . $this->_sName . "_span' " . " style='position:absolute;visibility:hidden;background-color:white;layer-background-color:white;'></span>\n"; return $html; }
/** * FormHandler::dateTextField() * * Create a dateTextField on the form * Validator added by Johan Wiegel * * @param string $title: The title of the field * @param string $name: The name of the field * @param string $validator: The validator which should be used to validate the value of the field * @param string $mask: How do we have to display the fields? These can be used: d, m and y. (Only for DB-Field with Type 'Date') * @param bool $bParseOtherPresentations: try to parse other presentations of dateformat * @param string $extra: CSS, Javascript or other which are inserted into the HTML tag * @return void * @access public * @author Thomas Branius * @since 16-03-2010 */ function dateTextField($title, $name, $validator = null, $mask = null, $bParseOtherPresentations = false, $extra = null) { require_once FH_INCLUDE_DIR . 'fields/class.TextField.php'; require_once FH_INCLUDE_DIR . 'fields/class.DateTextField.php'; // create a new datetextfield $fld = new DateTextField($this, $name, !empty($mask) ? $mask : null, $bParseOtherPresentations); if (!empty($validator)) { $fld->setValidator($validator); } if (!empty($extra)) { $fld->setExtra($extra); } /// register the field $this->_registerField($name, $fld, $title); // save the field in the datefields array (special treatment! :) $this->_date[] = $name; }