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


PHP DateField::create方法代码示例

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


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

示例1: getCMSFields

 public function getCMSFields()
 {
     $fields = FieldList::create(TextField::create('Author'), TextareaField::create('Teaser'), TextareaField::create('Description'), DateField::create('Date', 'Date of article')->setConfig('showcalendar', true)->setConfig('dateformat', 'd MMMM yyyy'), $photo = UploadField::create('Photo'), $brochure = UploadField::create('Brochure', 'Travel brochure, optional (PDF only)'));
     $photo->setFolderName('article-photos')->getValidator()->setAllowedExtensions(array('gif', 'png', 'jpg', 'jpeg'));
     $brochure->setFolderName('article-brochures')->getValidator()->setAllowedExtensions(array('pdf'));
     return $fields;
 }
开发者ID:roopamjain01,项目名称:article_website_ss_cms,代码行数:7,代码来源:Article.php

示例2: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeFieldsFromTab('Root.Main', array('Title', 'Content', 'MenuTitle'));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Title', 'Title'), TextField::create('Title_cn', 'Title_cn'), HtmlEditorField::create('Content', 'Content'), HtmlEditorField::create('Content_cn', 'Content_cn'), DateField::create('Date', 'Date')->setConfig('showcalendar', true)), 'URLSegment');
     return $fields;
 }
开发者ID:shawn3a,项目名称:ss_powermoney,代码行数:7,代码来源:ArticlePage.php

示例3: getDefaultSearchContext

 public function getDefaultSearchContext()
 {
     $context = parent::getDefaultSearchContext();
     $fields = $context->getFields();
     $fields->push(CheckboxField::create("HasBeenUsed"));
     //add date range filtering
     $fields->push(ToggleCompositeField::create("StartDate", "Start Date", array(DateField::create("q[StartDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[StartDateTo]", "To")->setConfig('showcalendar', true))));
     $fields->push(ToggleCompositeField::create("EndDate", "End Date", array(DateField::create("q[EndDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[EndDateTo]", "To")->setConfig('showcalendar', true))));
     //must be enabled in config, because some sites may have many products = slow load time, or memory maxes out
     //future solution is using an ajaxified field
     if (self::config()->filter_by_product) {
         $fields->push(ListboxField::create("Products", "Products", Product::get()->map()->toArray())->setMultiple(true));
     }
     if (self::config()->filter_by_category) {
         $fields->push(ListboxField::create("Categories", "Categories", ProductCategory::get()->map()->toArray())->setMultiple(true));
     }
     if ($field = $fields->fieldByName("Code")) {
         $field->setDescription("This can be a partial match.");
     }
     //get the array, to maniplulate name, and fullname seperately
     $filters = $context->getFilters();
     $filters['StartDateFrom'] = GreaterThanOrEqualFilter::create('StartDate');
     $filters['StartDateTo'] = LessThanOrEqualFilter::create('StartDate');
     $filters['EndDateFrom'] = GreaterThanOrEqualFilter::create('EndDate');
     $filters['EndDateTo'] = LessThanOrEqualFilter::create('EndDate');
     $context->setFilters($filters);
     return $context;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:28,代码来源:Discount.php

示例4: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('ConfiguredScheduleID');
     $interval = $fields->dataFieldByName('Interval')->setDescription('Number of seconds between each run. e.g 3600 is 1 hour');
     $fields->replaceField('Interval', $interval);
     $dt = new DateTime();
     $fields->replaceField('StartDate', DateField::create('StartDate')->setConfig('dateformat', 'dd/MM/yyyy')->setConfig('showcalendar', true)->setDescription('DD/MM/YYYY e.g. ' . $dt->format('d/m/y')));
     $fields->replaceField('EndDate', DateField::create('EndDate')->setConfig('dateformat', 'dd/MM/yyyy')->setConfig('showcalendar', true)->setDescription('DD/MM/YYYY e.g. ' . $dt->format('d/m/y')));
     if ($this->ID == null) {
         foreach ($fields->dataFields() as $field) {
             //delete all included fields
             $fields->removeByName($field->Name);
         }
         $rangeTypes = ClassInfo::subclassesFor('ScheduleRange');
         $fields->addFieldToTab('Root.Main', TextField::create('Title', 'Title'));
         $fields->addFieldToTab('Root.Main', DropdownField::create('ClassName', 'Range Type', $rangeTypes));
     } else {
         $fields->addFieldToTab('Root.Main', ReadonlyField::create('ClassName', 'Type'));
     }
     if ($this->ClassName == __CLASS__) {
         $fields->removeByName('ApplicableDays');
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-schedulizer,代码行数:25,代码来源:ScheduleRange.php

示例5: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->insertBefore(new Tab('MembershipDetails', 'Membership Details'), 'Main');
     //move first and ;astname
     $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('FirstName'));
     $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Surname'));
     $fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Email'));
     $fields->addFieldToTab('Root.MembershipDetails', $region = DropdownField::create('RegionID', 'Region', Region::get()->map('ID', 'Title')));
     $region->setEmptyString(' ');
     $fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('MembershipStatus', 'Membership Status', $this->owner->dbObject('MembershipStatus')->enumValues()));
     $fields->addFieldToTab('Root.MembershipDetails', $expiry = DateField::create('ExpiryDate'));
     $fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('Discount', 'Discount', $this->owner->dbObject('Discount')->enumValues()));
     $fields->addFieldToTab('Root.MembershipDetails', $discountExpiry = DateField::create('DiscountExpiryDate'));
     $fields->addFieldToTab('Root.MembershipDetails', $joined = DateField::create('JoinedDate'));
     $fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('NotesForMember'));
     if ($this->owner->MembershipStatus !== "Not applied") {
         $fields->addFieldToTab('Root.MembershipDetails', TextField::create('MemberNumber'));
     }
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('HomePhone'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('WorkPhone'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('MobilePhone'));
     $fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('Address'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('Occupation'));
     $fields->addFieldToTab('Root.MembershipDetails', TextField::create('BirthDate'));
     $expiry->setConfig('showcalendar', true);
     $expiry->setConfig('showdropdown', true);
     $expiry->setConfig('dateformat', 'dd-MM-YYYY');
     $discountExpiry->setConfig('showcalendar', true);
     $discountExpiry->setConfig('showdropdown', true);
     $discountExpiry->setConfig('dateformat', 'dd-MM-YYYY');
     $joined->setConfig('showcalendar', true);
     $joined->setConfig('showdropdown', true);
     $joined->setConfig('dateformat', 'dd-MM-YYYY');
 }
开发者ID:adrexia,项目名称:nzlarps,代码行数:34,代码来源:MemberExtension.php

示例6: getCMSFields

 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $dateField = DateField::create('Date')->setConfig('showcalendar', true);
     $fields->addFieldToTab('Root.Main', $dateField, 'Content');
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:richardsjoqvist-silverstripe-news,代码行数:7,代码来源:NewsItem.php

示例7: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->replaceField('Date', DateField::create('Date')->setConfig('showcalendar', true));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:iqnection-pages-appointmentpage,代码行数:7,代码来源:AppointmentPage.php

示例8: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $countdownTypes = array();
     foreach ($this->options as $key => $value) {
         $countdownTypes[$key] = $key;
     }
     $fields->addFieldsToTab('Root.Countdown', array(DateField::create('EndDate', 'EndDate')->setConfig('showcalendar', true), DropdownField::create('CountdownType', 'CountdownType', $countdownTypes)->setEmptyString('Select one'), TextField::create('CountdownElementID'), TextField::create('CountdownElementClass')));
 }
开发者ID:textagroup,项目名称:countdown,代码行数:8,代码来源:CountdownWidgetExtension.php

示例9: parameterFields

 /**
  * @return FieldList
  */
 public function parameterFields()
 {
     $filtersList = new FieldList();
     $filtersList->push(DateField::create("ReviewDateAfter", "Review date after or on")->setConfig("showcalendar", true));
     $filtersList->push(DateField::create("ReviewDateBefore", "Review date before or on", date("d/m/Y", strtotime("midnight")))->setConfig("showcalendar", true));
     $filtersList->push(new CheckboxField("ShowVirtualPages", "Show Virtual Pages"));
     return $filtersList;
 }
开发者ID:kinglozzer,项目名称:silverstripe-contentreview,代码行数:11,代码来源:PagesDueForReviewReport.php

示例10: TypoForm

 function TypoForm()
 {
     $array = array('green', 'yellow', 'blue', 'pink', 'orange');
     $form = new Form($this, 'TestForm', $fields = FieldList::create(HeaderField::create('HeaderField1', 'HeaderField Level 1', 1), LiteralField::create('LiteralField', '<p>All fields up to EmailField are required and should be marked as such</p>'), TextField::create('TextField1', 'Text Field Example 1'), TextField::create('TextField2', 'Text Field Example 2'), TextField::create('TextField3', 'Text Field Example 3'), TextField::create('TextField4', ''), HeaderField::create('HeaderField2b', 'Field with right title', 2), $textAreaField = new TextareaField('TextareaField', 'Textarea Field'), EmailField::create('EmailField', 'Email address'), HeaderField::create('HeaderField2c', 'HeaderField Level 2', 2), DropdownField::create('DropdownField', 'Dropdown Field', array(0 => '-- please select --', 1 => 'test AAAA', 2 => 'test BBBB')), OptionsetField::create('OptionSF', 'Optionset Field', $array), CheckboxSetField::create('CheckboxSF', 'Checkbox Set Field', $array), CountryDropdownField::create('CountryDropdownField', 'Countries'), CurrencyField::create('CurrencyField', 'Bling bling', '$123.45'), HeaderField::create('HeaderField3', 'Other Fields', 3), NumericField::create('NumericField', 'Numeric Field '), DateField::create('DateField', 'Date Field'), DateField::create('DateTimeField', 'Date and Time Field'), CheckboxField::create('CheckboxField', 'Checkbox Field')), $actions = FieldList::create(FormAction::create('submit', 'Submit Button')), $requiredFields = RequiredFields::create('TextField1', 'TextField2', 'TextField3', 'ErrorField1', 'ErrorField2', 'EmailField', 'TextField3', 'RightTitleField', 'CheckboxField', 'CheckboxSetField'));
     $textAreaField->setColumns(45);
     $form->setMessage('warning message', 'warning');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-typography,代码行数:8,代码来源:Typography.php

示例11: __construct

 public function __construct($name, $title = null, $value = "")
 {
     $this->config = $this->config()->default_config;
     $this->dateField = DateField::create($name . '[date]', false)->addExtraClass('fieldgroup-field');
     $this->timeField = TimeField::create($name . '[time]', false)->addExtraClass('fieldgroup-field');
     $this->timezoneField = new HiddenField($this->getName() . '[timezone]');
     parent::__construct($name, $title, $value);
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:8,代码来源:DatetimeField.php

示例12: __construct

 function __construct($name, $title = null, $value = "")
 {
     $this->config = self::$default_config;
     $this->dateField = DateField::create($name . '[date]', false);
     $this->timeField = TimeField::create($name . '[time]', false);
     $this->timezoneField = new HiddenField($this->getName() . '[timezone]');
     parent::__construct($name, $title, $value);
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:8,代码来源:DatetimeField.php

示例13: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Main', array($start = DateField::create('Startdate', 'Startdatum'), $end = DateField::create('Enddate', 'Einddatum')));
     $start->setConfig('showcalendar', true);
     $end->setConfig('showcalendar', true);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:firesphere-poll,代码行数:8,代码来源:Poll.php

示例14: cmsFields

 /**
  * Returns fields for entering date and time. NB injector has overridden the TimeField to be CERATimeField to
  * fix a problem saving DatatimeField with no date.
  *
  * @return array
  */
 public function cmsFields()
 {
     if (static::ShowTimeField) {
         return [DTField::create(static::SingleFieldName)];
     } else {
         return [DField::create(static::SingleFieldName)];
     }
 }
开发者ID:CrackerjackDigital,项目名称:silverstripe-modular,代码行数:14,代码来源:DateField.php

示例15: getConfiguration

 public function getConfiguration()
 {
     $fields = parent::getConfiguration();
     $fields->push(DateField::create('StartDate', 'Start Date')->setConfig('showcalendar', true));
     $fields->push(DateField::create('EndDate', 'End Date')->setConfig('showcalendar', true));
     $fields->push(DropdownField::create('SelectCriteria', 'Select Criteria', singleton('DashboardRevenueUnitsByProductPanel')->dbObject('SelectCriteria')->enumValues())->setEmptyString('(Select criteria)'));
     return $fields;
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:8,代码来源:DashboardRevenueUnitsByProductPanel.php


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