當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。