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


PHP DateTimeField::create方法代码示例

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


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

示例1: getFrontEndFields

 /**
  * Frontend fields
  * Simple list of the basic fields - how they're intended to be edited
  */
 function getFrontEndFields($params = null)
 {
     //parent::getFrontEndFields($params);
     $timeFrameHeaderText = 'Time Frame';
     if (!CalendarConfig::subpackage_setting('events', 'force_end')) {
         $timeFrameHeaderText = 'End Date / Time (optional)';
     }
     $fields = FieldList::create(TextField::create('Title')->setAttribute('placeholder', 'Enter a title'), CheckboxField::create('AllDay', 'All-day'), $startDateTime = DatetimeField::create('StartDateTime', 'Start'), CheckboxField::create('NoEnd', 'Open End'), HeaderField::create('TimeFrameHeader', $timeFrameHeaderText, 5), SelectionGroup::create('TimeFrameType', array("Duration//Duration" => TimeField::create('Duration', '')->setRightTitle('up to 24h')->setAttribute('placeholder', 'Enter duration'), "DateTime//Date/Time" => $endDateTime = DateTimeField::create('EndDateTime', ''))), LiteralField::create('Clear', '<div class="clear"></div>'));
     //Date field settings
     $timeExpl = 'Time, e.g. 11:15am or 15:30';
     //$startDateTime->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm');
     //$endDateTime->setConfig('datavalueformat', 'YYYY-MM-dd HH:mm');
     $startDateTime->getDateField()->setConfig('showcalendar', 1)->setAttribute('placeholder', 'Enter date')->setAttribute('readonly', 'true');
     //we only want input through the datepicker
     $startDateTime->getTimeField()->setConfig('timeformat', 'HH:mm')->setAttribute('placeholder', 'Enter time');
     $endDateTime->getDateField()->setConfig('showcalendar', 1)->setAttribute('placeholder', 'Enter date')->setAttribute('readonly', 'true');
     //we only want input through the datepicker
     $endDateTime->getTimeField()->setConfig('timeformat', 'HH:mm')->setAttribute('placeholder', 'Enter time');
     //removing AllDay checkbox if allday events are disabled
     if (!CalendarConfig::subpackage_setting('events', 'enable_allday_events')) {
         $fields->removeByName('AllDay');
     }
     //removing NoEnd checkbox if end dates are enforced
     if (CalendarConfig::subpackage_setting('events', 'force_end')) {
         $fields->removeByName('NoEnd');
     } else {
         //we don't want the NoEnd checkbox when creating new events
         if (!$this->ID) {
             //$fields->removeByName('NoEnd');
         }
     }
     $this->extend('updateFrontEndFields', $fields);
     return $fields;
 }
开发者ID:adrexia,项目名称:silverstripe-calendar,代码行数:38,代码来源:Event.php


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