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


PHP DateField::Field方法代码示例

本文整理汇总了PHP中DateField::Field方法的典型用法代码示例。如果您正苦于以下问题:PHP DateField::Field方法的具体用法?PHP DateField::Field怎么用?PHP DateField::Field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateField的用法示例。


在下文中一共展示了DateField::Field方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Field

    function Field()
    {
        Requirements::javascript("jsparty/calendar/calendar.js");
        Requirements::javascript("jsparty/calendar/lang/calendar-en.js");
        Requirements::javascript("jsparty/calendar/calendar-setup.js");
        Requirements::css("sapphire/css/CalendarDateField.css");
        Requirements::css("jsparty/calendar/calendar-win2k-1.css");
        Requirements::javascript("sapphire/javascript/CalendarDateField.js");
        $field = DateField::Field();
        $id = $this->id();
        $val = $this->attrValue();
        if (preg_match('/^\\d{2}\\/\\d{2}\\/\\d{4}$/', $val)) {
            $dateArray = explode('/', $val);
            $val = $dateArray[2] . '-' . $dateArray[1] . '-' . $dateArray[0];
        }
        $dateArray = explode('-', $val);
        $day = $dateArray[2];
        $month = $dateArray[1];
        $year = $dateArray[0];
        preg_match('/(.*)[(.+)]$/', $this->name, $fieldNameParts);
        $fieldNamePrefix = $fieldNameParts[1];
        $fieldName = $fieldNameParts[2];
        return <<<HTML
\t\t\t<div class="dmycalendardate">
\t\t\t\t<input type="hidden" id="{$id}" name="{$this->name}" value="{$val}" />
\t\t\t\t<input type="text" id="{$id}-day" class="day numeric" name="{$fieldNamePrefix}[{$fieldName}-Day]" value="{$day}" maxlength="2" />/
\t\t\t\t<input type="text" id="{$id}-month" class="month numeric" name="{$fieldNamePrefix}[{$fieldName}-Month]" value="{$month}" maxlength="2" />/
\t\t\t\t<input type="text" id="{$id}-year" class="year numeric" name="{$fieldNamePrefix}[{$fieldName}-Year]" value="{$year}" maxlength="4" />
\t\t\t\t<div class="calendarpopup" id="{$id}-calendar"></div>
\t\t\t</div>
HTML;
    }
开发者ID:ramziammar,项目名称:websites,代码行数:32,代码来源:DMYCalendarDateField.php

示例2: Field

 public function Field($properties = array())
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js');
     Requirements::javascript(BOOTSTRAPFIELDS__DIR . '/js/BootstrapDateField.js');
     return parent::Field($properties);
 }
开发者ID:helpfulrobot,项目名称:chitosystems-bootstrap-fields,代码行数:7,代码来源:BootstrapDateField.php

示例3: Field

 function Field()
 {
     Requirements::javascript($this->BaseHref() . "dataobject_manager/javascript/jquery-ui-1.6.js");
     Requirements::javascript($this->BaseHref() . "dataobject_manager/code/date_picker_field/datepicker_init.js");
     Requirements::css("dataobject_manager/css/ui/ui.all.css");
     $id = $this->id();
     $val = $this->attrValue();
     $field = parent::Field();
     $innerHTML = self::HTMLField($id, $this->name, $val);
     return "\n\t\t\t\t\t<div class='datepicker field'>\n\t\t\t\t\t\t{$innerHTML}\n\t\t\t\t\t</div>\n\t\t";
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:11,代码来源:DatePickerField.php

示例4: Field

 function Field()
 {
     Requirements::javascript(THIRDPARTY_DIR . "/jquery-livequery/jquery.livequery.js");
     Requirements::javascript(THIRDPARTY_DIR . "/jquery-metadata/jquery.metadata.js");
     Requirements::javascript("dataobject_manager/javascript/dom_jquery_ui.js");
     Requirements::javascript("dataobject_manager/code/date_picker_field/datepicker_init.js");
     Requirements::css("dataobject_manager/css/ui/dom_jquery_ui.css");
     $id = $this->id();
     $val = $this->attrValue();
     $field = parent::Field();
     $innerHTML = self::HTMLField($id, $this->name, $val);
     return "\n\t\t\t\t\t<div class=\"datepicker field {dateFormat : '" . self::$dateFormat . "'}\">\n\t\t\t\t\t\t{$innerHTML}\n\t\t\t\t\t</div>\n\t\t";
 }
开发者ID:TindallRiley,项目名称:DataObjectManager,代码行数:13,代码来源:DatePickerField.php

示例5: Field

 function Field($options = array())
 {
     //GENERAL
     Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
     Requirements::javascript("datefield_simplified/javascript/SimpleDateField.js");
     $this->addExtraClass("simpledatefield");
     $this->setAttribute("placeholder", $this->Config()->get("placeholder_value"));
     $html = parent::Field($options);
     $fieldID = $this->id();
     $url = Convert::raw2js(Director::absoluteBaseURL() . Config::inst()->get("SimpleDateField_Controller", "url") . "/ajaxvalidation/");
     $objectID = $fieldID . "_OBJECT";
     Requirements::customScript("\r\n\t\t\tvar {$objectID} = new SimpleDateFieldAjaxValidationAPI('" . $fieldID . "');\r\n\t\t\t{$objectID}.init();\r\n\t\t\t{$objectID}.setVar('url', '{$url}');\r\n\t\t\t", 'func_SimpleDateField' . $fieldID);
     return $html;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-datefield-simplified,代码行数:14,代码来源:SimpleDateField.php

示例6: Field

    function Field()
    {
        Requirements::javascript("jsparty/calendar/calendar.js");
        Requirements::javascript("jsparty/calendar/lang/calendar-en.js");
        Requirements::javascript("jsparty/calendar/calendar-setup.js");
        Requirements::css("sapphire/css/CalendarDateField.css");
        Requirements::css("jsparty/calendar/calendar-win2k-1.css");
        $field = parent::Field();
        $id = $this->id();
        $val = $this->attrValue();
        $futureClass = $this->futureOnly ? ' futureonly' : '';
        $innerHTML = self::HTMLField($id, $this->name, $val);
        return <<<HTML
\t\t\t<div class="calendardate{$futureClass}">
\t\t\t\t{$innerHTML}
\t\t\t</div>
HTML;
    }
开发者ID:ramziammar,项目名称:websites,代码行数:18,代码来源:CalendarDateField.php

示例7: Field

	function Field() {
		Requirements::javascript(THIRDPARTY_DIR . "/calendar/calendar.js");
		Requirements::javascript(THIRDPARTY_DIR . "/calendar/lang/calendar-en.js");
		Requirements::javascript(THIRDPARTY_DIR . "/calendar/calendar-setup.js");
		Requirements::css(SAPPHIRE_DIR . "/css/CalendarDateField.css");
		Requirements::css(THIRDPARTY_DIR . "/calendar/calendar-win2k-1.css");
		Requirements::javascript(SAPPHIRE_DIR . "/javascript/CalendarDateField.js");

		$field = DateField::Field();

		$id = $this->id();
		$val = $this->attrValue();
		
		if( preg_match( '/^\d{2}\/\d{2}\/\d{4}$/', $val ) ) {
			$dateArray = explode( '/', $val );
			
			$val = $dateArray[2] . '-' . $dateArray[1] . '-' . $dateArray[0];
		}

		$day = $month = $year = null;
		if($val) {
			$dateArray = explode( '-', $val );
		
			$day = $dateArray[2];
			$month = $dateArray[1];
			$year = $dateArray[0];
		}
		
		$fieldName = $this->name;
		
		$tabIndex0 = $this->getTabIndexHTML(0);
		$tabIndex1 = $this->getTabIndexHTML(1);
		$tabIndex2 = $this->getTabIndexHTML(2);
		
		return <<<HTML
			<div class="dmycalendardate">
				<input type="hidden" id="$id" name="{$this->name}" value="$val" />
				<input type="text" id="$id-day" class="day numeric" name="{$fieldName}[Day]" value="$day" maxlength="2"$tabIndex0 />/
				<input type="text" id="$id-month" class="month numeric" name="{$fieldName}[Month]" value="$month" maxlength="2"$tabIndex1 />/
				<input type="text" id="$id-year" class="year numeric" name="{$fieldName}[Year]" value="$year" maxlength="4"$tabIndex2 />
				<div class="calendarpopup" id="{$id}-calendar"></div>
			</div>
HTML;
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:44,代码来源:DMYDateField.php

示例8: Field

 public function Field($properties = array())
 {
     $config = array('showcalendar' => $this->getConfig('showcalendar'), 'isoDateformat' => $this->getConfig('dateformat'), 'jquerydateformat' => DateDropdownField_View_JQuery::convert_iso_to_jquery_format($this->getConfig('dateformat')), 'min' => $this->getConfig('min'), 'max' => $this->getConfig('max'), 'yearRange' => $this->getConfig('yearRange'));
     // Add other jQuery UI specific, namespaced options (only serializable, no callbacks etc.)
     // TODO Move to DateField_View_jQuery once we have a properly extensible HTML5 attribute system for FormField
     $jqueryUIConfig = array();
     foreach ($this->getConfig() as $k => $v) {
         if (preg_match('/^jQueryUI\\.(.*)/', $k, $matches)) {
             $jqueryUIConfig[$matches[1]] = $v;
         }
     }
     if ($jqueryUIConfig) {
         $config['jqueryuiconfig'] = Convert::array2json(array_filter($jqueryUIConfig));
     }
     $config = array_filter($config);
     foreach ($config as $k => $v) {
         $this->setAttribute('data-' . $k, $v);
     }
     // Three separate fields for day, month and year
     if ($this->getConfig('dmyfields')) {
         // values
         $valArr = $this->valueObj ? $this->valueObj->toArray() : null;
         // fields
         $fieldNames = Zend_Locale::getTranslationList('Field', $this->locale);
         $fieldDay = NumericField::create($this->name . '[day]', false, $valArr ? $valArr['day'] : null)->addExtraClass('day')->setAttribute('placeholder', $this->getConfig('dmyplaceholders') ? $fieldNames['day'] : null)->setMaxLength(2);
         $fieldMonth = NumericField::create($this->name . '[month]', false, $valArr ? $valArr['month'] : null)->addExtraClass('month')->setAttribute('placeholder', $this->getConfig('dmyplaceholders') ? $fieldNames['month'] : null)->setMaxLength(2);
         $fieldYear = NumericField::create($this->name . '[year]', false, $valArr ? $valArr['year'] : null)->addExtraClass('year')->setAttribute('placeholder', $this->getConfig('dmyplaceholders') ? $fieldNames['year'] : null)->setMaxLength(4);
         // order fields depending on format
         $sep = $this->getConfig('dmyseparator');
         $format = $this->getConfig('dateformat');
         $fields = array();
         $fields[stripos($format, 'd')] = $fieldDay->Field();
         $fields[stripos($format, 'm')] = $fieldMonth->Field();
         $fields[stripos($format, 'y')] = $fieldYear->Field();
         ksort($fields);
         $html = implode($sep, $fields);
         // dmyfields doesn't work with showcalendar
         $this->setConfig('showcalendar', false);
     } else {
         $html = parent::Field();
     }
     return $html;
 }
开发者ID:arillo,项目名称:silverstripe-cleanutilities,代码行数:43,代码来源:DateDropdownField.php

示例9: SiteTreeFilterDateField

 public function SiteTreeFilterDateField()
 {
     $dateField = new DateField('SiteTreeFilterDate');
     // TODO Enabling this means we load jQuery UI by default in the CMS,
     // which is a pretty big performance hit in 2.4 (where the library isn't used for other parts
     // of the interface).
     // $dateField->setConfig('showcalendar', true);
     return $dateField->Field();
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:9,代码来源:CMSMain.php

示例10: Field

 public function Field($properties = array())
 {
     $config = array('separator' => $this->getConfig('separator') ? $this->getConfig('separator') : ', ', 'showcalendar' => $this->getConfig('showcalendar'), 'isoDateformat' => $this->getConfig('dateformat'), 'jquerydateformat' => DateField_View_JQuery::convert_iso_to_jquery_format($this->getConfig('dateformat')), 'min' => $this->getConfig('min'), 'max' => $this->getConfig('max'));
     // Add other jQuery UI specific, namespaced options (only serializable, no callbacks etc.)
     // TODO Move to DateField_View_jQuery once we have a properly extensible HTML5 attribute system for FormField
     $jqueryUIConfig = array();
     foreach ($this->getConfig() as $k => $v) {
         if (preg_match('/^jQueryUI\\.(.*)/', $k, $matches)) {
             $jqueryUIConfig[$matches[1]] = $v;
         }
     }
     if ($jqueryUIConfig) {
         $config['jqueryuiconfig'] = Convert::array2json(array_filter($jqueryUIConfig));
     }
     $config = array_filter($config);
     foreach ($config as $k => $v) {
         $this->setAttribute('data-' . $k, $v);
     }
     // Three separate fields for day, month and year (not available for multidates)
     if ($this->getConfig('dmyfields')) {
         user_error("MultiDateField doen't work with separate fields for day/month/year");
     }
     // Default text input field
     $html = parent::Field();
     return $html;
 }
开发者ID:helpfulrobot,项目名称:micschk-silverstripe-multidatepicker,代码行数:26,代码来源:MultiDateField.php


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