本文整理汇总了PHP中DateField::getField方法的典型用法代码示例。如果您正苦于以下问题:PHP DateField::getField方法的具体用法?PHP DateField::getField怎么用?PHP DateField::getField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateField
的用法示例。
在下文中一共展示了DateField::getField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getField
/**
* DateField::getField()
*
* return the field
*
* @return string: the field
* @author Teye Heimans
* @access public
*/
function getField()
{
// view mode enabled ?
if ($this->getViewMode()) {
// get the view value..
return $this->_getViewValue();
}
$html = parent::getField();
// when not OK, just return a datefield
if (!$this->_isOk) {
return $html;
}
list($iStart, $iEnd) = $this->_getYearInterval();
/* switch dates when in inverse */
if ($iStart < $iEnd) {
$tmp = $iEnd;
$iEnd = -$iStart;
$iStart = $tmp;
}
// 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" : "") . " cal_" . $this->_sName . ".setReturnFunction('set" . $this->_sName . "Values');\n" . " cal_" . $this->_sName . ".addDisabledDates(null,'Dec 31, " . (date('Y') - $iStart - 1) . "');\n" . " cal_" . $this->_sName . ".addDisabledDates('Jan 1, " . (date('Y') + $iEnd + 1) . "',null);\n" . " function set" . $this->_sName . "Values(y,m,d) {\n" . " document.forms['" . $this->_oForm->_name . "'].elements['" . $this->_sName . "_day'].value = LZ(d);\n" . " document.forms['" . $this->_oForm->_name . "'].elements['" . $this->_sName . "_month'].value = LZ(m);\n" . " document.forms['" . $this->_oForm->_name . "'].elements['" . $this->_sName . "_year'].value = y;\n" . " }\n" . "}\n", 0, 0);
$html .= "<a href='javascript:;' " . "onclick=\"if( cal_" . $this->_sName . " ) cal_" . $this->_sName . ".showCalendar('anchor_" . $this->_sName . "', getDateString('" . $this->_oForm->_name . "','" . $this->_sName . "_year', '" . $this->_sName . "_month', '" . $this->_sName . "_day')); 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;
}