本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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');
}
示例6: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$dateField = DateField::create('Date')->setConfig('showcalendar', true);
$fields->addFieldToTab('Root.Main', $dateField, 'Content');
return $fields;
}
示例7: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->replaceField('Date', DateField::create('Date')->setConfig('showcalendar', true));
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例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')));
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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)];
}
}
示例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;
}