当前位置: 首页>>代码示例>>PHP>>正文


PHP DateField::getField方法代码示例

本文整理汇总了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;
 }
开发者ID:jwiegel,项目名称:FormHandler,代码行数:33,代码来源:class.jsDateField.php


注:本文中的DateField::getField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。