本文整理汇总了PHP中DateField类的典型用法代码示例。如果您正苦于以下问题:PHP DateField类的具体用法?PHP DateField怎么用?PHP DateField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DateField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Text', array(new ReadonlyField('Readonly', 'ReadonlyField'), new TextareaField('Textarea', 'TextareaField - 8 rows', 8), new TextField('Text', 'TextField'), new HtmlEditorField('HTMLField', 'HtmlEditorField'), new EmailField('Email', 'EmailField'), new PasswordField('Password', 'PasswordField'), new AjaxUniqueTextField('AjaxUniqueText', 'AjaxUniqueTextField', 'AjaxUniqueText', 'BasicFieldsTestPage')));
$fields->addFieldsToTab('Root.Numeric', array(new NumericField('Number', 'NumericField'), new CurrencyField('Price', 'CurrencyField'), new PhoneNumberField('PhoneNumber', 'PhoneNumberField'), new CreditCardField('CreditCard', 'CreditCardField')));
$fields->addFieldsToTab('Root.Option', array(new CheckboxField('Checkbox', 'CheckboxField'), new CheckboxSetField('CheckboxSet', 'CheckboxSetField', TestCategory::map()), new DropdownField('DropdownID', 'DropdownField', TestCategory::map()), new GroupedDropdownField('GroupedDropdownID', 'GroupedDropdown', array('Test Categorys' => TestCategory::map())), new ListboxField('ListboxFieldID', 'ListboxField', TestCategory::map(), array(), 3), new OptionsetField('OptionSetID', 'OptionSetField', TestCategory::map())));
// All these date/time fields generally have issues saving directly in the CMS
$fields->addFieldsToTab('Root.DateTime', array($calendarDateField = new DateField('CalendarDate', 'DateField with calendar'), new DateField('Date', 'DateField'), $dmyDateField = new DateField('DMYDate', 'DateField with separate fields'), new TimeField('Time', 'TimeField'), $timeFieldDropdown = new TimeField('TimeDropdown', 'TimeField with dropdown'), new DatetimeField('DateTime', 'DateTime'), $dateTimeShowCalendar = new DatetimeField('DateTimeWithCalendar', 'DateTime with calendar')));
$calendarDateField->setConfig('showcalendar', true);
$dmyDateField->setConfig('dmyfields', true);
$timeFieldDropdown->setConfig('showdropdown', true);
$dateTimeShowCalendar->getDateField()->setConfig('showcalendar', true);
$dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true);
$fields->addFieldsToTab('Root.File', array(UploadField::create('File', 'FileUploadField'), UploadField::create('Image', 'ImageUploadField'), UploadField::create('HasManyFiles', 'HasManyFilesUploadField'), UploadField::create('ManyManyFiles', 'ManyManyFilesUploadField')));
$tabs = array('Root.Text', 'Root.Numeric', 'Root.Option', 'Root.DateTime', 'Root.File');
foreach ($tabs as $tab) {
$tabObj = $fields->fieldByName($tab);
foreach ($tabObj->FieldList() as $field) {
$disabledField = $field->performDisabledTransformation();
$disabledField->setTitle($disabledField->Title() . ' (disabled)');
$disabledField->setName($disabledField->getName() . '_disabled');
$tabObj->insertAfter($disabledField, $field->getName());
$readonlyField = $field->performReadonlyTransformation();
$readonlyField->setTitle($readonlyField->Title() . ' (readonly)');
$readonlyField->setName($readonlyField->getName() . '_readonly');
$tabObj->insertAfter($readonlyField, $field->getName());
}
}
$fields->addFieldToTab('Root.Text', new TextField('Text_NoLabel', false, 'TextField without label'), 'Text_disabled');
return $fields;
}
示例2: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->replaceField("From", $from = new DateField("From", "Valid From - add any date and time"));
$fields->replaceField("Until", $until = new DateField("Until", "Valid Until - add any date and time"));
$fields->replaceField("NewPrice", new CurrencyField("NewPrice", "PRICE (OPTION 1 / 3) - only enter if there is a set new price independent of the 'standard' price."));
$fields->replaceField("Percentage", new NumericField("Percentage", "PERCENTAGE (OPTIONAL 2/ 3) discount from 0 (0% discount) to 100 (100% discount)."));
$fields->replaceField("Reduction", new CurrencyField("Reduction", "REDUCTION (OPTION 3 /3 ) - e.g. if you enter 2.00 then the new price will be the standard product price minus 2."));
if (!$this->ID) {
$fields->addFieldToTab("Root.Main", new LiteralField("SaveFirst", "<p>Please save first - and then select security groups / countries</p>"));
$fields->removeByName("NoLongerValid");
}
if ($groups = Group::get()->count()) {
$groups = Group::get();
$fields->replaceField("Groups", new CheckboxSetField("Groups", "Who", $groups->map()->toArray()));
} else {
$fields->removeByName("Groups");
}
if ($ecommerceCountries = EcommerceCountry::get()) {
$fields->replaceField("EcommerceCountries", new CheckboxSetField("EcommerceCountries", "Where", $ecommerceCountries->map()->toArray()));
} else {
$fields->removeByName("EcommerceCountries");
}
if (DiscountCouponOption::get()->count()) {
$fields->replaceField("DiscountCouponOptions", new CheckboxSetField("DiscountCouponOptions", "Discount Coupons", DiscountCouponOption::get()->map()->toArray()));
} else {
$fields->removeByName("DiscountCouponOptions");
}
$from->setConfig('showcalendar', true);
$until->setConfig('showcalendar', true);
return $fields;
}
示例3: getFormField
/**
* Return the form field
*
*/
public function getFormField()
{
$defaultValue = $this->getSetting('DefaultToToday') ? date('Y-m-d') : $this->Default;
$field = new DateField($this->Name, $this->Title, $defaultValue);
$field->setConfig('showcalendar', true);
return $field;
}
示例4: DoBeforeCreate
protected function DoBeforeCreate()
{
$this->dataset = new TableDataset(new OracleConnectionFactory(), GetConnectionOptions(), '"GE"."webreports"');
$field = new IntegerField('rpt_id');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new StringField('rpt_name');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new StringField('rpt_title');
$this->dataset->AddField($field, false);
$field = new DateField('rpt_cdate');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new DateField('rpt_mdate');
$this->dataset->AddField($field, false);
$field = new BlobField('rpt_content');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new StringField('rpt_owner');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new StringField('rpt_status');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new StringField('rpt_type');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
}
示例5: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
// Summit Video Stream
$VideoLiveField = new OptionSetField('VideoCurrentlyPlaying', 'Is the video live streaming at the moment?', array('Yes' => 'Video is being streamed.', 'No' => 'No video playing.'));
$fields->addFieldToTab("Root.Main", new TextField('LiveStreamURL', 'URL of Live Stream Feed'));
$SummitModeField = new OptionSetField('SummitMode', 'Homepage mode:', array(0 => 'Normal Mode', 1 => 'Summit Mode'));
$fields->addFieldToTab("Root.Main", new TextField('NextPresentationStartTime', 'Next Presentation Start Time'));
$fields->addFieldToTab("Root.Main", new TextField('NextPresentationStartDate', 'Next Presentation Start Date'));
$fields->addFieldToTab("Root.Main", $VideoLiveField, 'Content');
$fields->addFieldToTab("Root.Main", $SummitModeField, 'Content');
// Countdown Date
$EventStartDate = new DateField('EventDate', 'First Day of Event (for counting down)');
$EventStartDate->setConfig('showcalendar', true);
$EventStartDate->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $EventStartDate, 'Content');
// remove unneeded fields
$fields->removeFieldFromTab("Root.Main", "Content");
$promo_hero_image = new CustomUploadField('PromoImage', 'Promo Hero Image');
$promo_hero_image->setFolderName('homepage');
$promo_hero_image->setAllowedFileCategories('image');
$fields->addFieldToTab("Root.IntroHeader", $promo_hero_image);
$fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoIntroMessage', 'Promo Intro Message'));
$fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoButtonText', 'Promo Button Text'));
$fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoButtonUrl', 'Promo Button Url'));
$fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoDatesText', 'Promo Dates Text'));
$fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoHeroCredit', 'Hero Credit'));
$fields->addFieldToTab("Root.IntroHeader", new TextareaField('PromoHeroCreditUrl', 'Hero Credit Url'));
return $fields;
}
示例6: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$HSEAScore = GroupedList::create(Score::get()->sort('ClassName'));
$fields->addFieldToTab("Root.Main", new OptionSetField('Status', 'Status', singleton('Project')->dbObject('Status')->enumValues()));
$fields->addFieldToTab("Root.Main", new CheckboxsetField('Scores', 'Check List', $HSEAScore));
$impact = GroupedList::create(Impact::get()->sort('Title'));
$fields->addFieldToTab("Root.Main", new CheckboxsetField('Impacts', 'Impact', $impact));
//$FinScore= DataObject::get('Score' ,"ClassName = 'Financial'");
// $fields->addFieldToTab("Root.Main", new CheckboxsetField('Scores', 'Financial', $FinScore));
// $ServScore= DataObject::get('Score', "ClassName = 'Service'");
// $fields->addFieldToTab("Root.Main", new CheckboxsetField('Scores', 'Service', $ServScore));
/*$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(),
new GridFieldAddNewButton('toolbar-header-right'),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(15),
new GridFieldEditButton(),
new GridFieldDeleteAction(),
new GridFieldDetailForm()
);
$gridfield = new GridField("Tasks", "Tasks", $this->Tasks(), $gridFieldConfig);
$fields->addFieldToTab('Root.Tasks', $gridfield);*/
$fields->addFieldToTab("Root.Main", $dateField = new DateField("DueDate", "Date Due"));
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'dd/MM/YYYY');
return $fields;
}
示例7: DoBeforeCreate
protected function DoBeforeCreate()
{
$this->dataset = new TableDataset(new MyConnectionFactory(), GetConnectionOptions(), '`timesheet`');
$field = new IntegerField('timesheet_id', null, null, true);
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new StringField('name');
$this->dataset->AddField($field, false);
$field = new IntegerField('task_id');
$this->dataset->AddField($field, false);
$field = new StringField('hours');
$this->dataset->AddField($field, false);
$field = new StringField('notes');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new StringField('time_type');
$this->dataset->AddField($field, false);
$field = new DateField('date');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new IntegerField('staff_id');
if (!$this->GetSecurityInfo()->AdminGrant()) {
$field->SetReadOnly(true, GetApplication()->GetCurrentUserId());
}
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$this->dataset->AddLookupField('task_id', 'task', new IntegerField('task_id', null, null, true), new StringField('task_name', 'task_id_task_name', 'task_id_task_name_task'), 'task_id_task_name_task');
}
示例8: DoBeforeCreate
protected function DoBeforeCreate()
{
$this->dataset = new TableDataset(new OracleConnectionFactory(), GetConnectionOptions(), '"GE"."EVENTO"');
$field = new IntegerField('EVENTO_ID');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new StringField('NOMBRE');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new DateField('FECHA_HORA');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new StringField('LUGAR');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new StringField('DESCRIPCION');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, false);
$field = new DateField('FEC_CREACION');
$this->dataset->AddField($field, false);
$field = new StringField('USUARIO_CREACION');
$this->dataset->AddField($field, false);
$field = new DateField('FEC_ULTIMA_MOD');
$this->dataset->AddField($field, false);
$field = new StringField('USUARIO_ULTIMA_MOD');
$this->dataset->AddField($field, false);
$field = new IntegerField('CIUDAD');
$this->dataset->AddField($field, false);
$this->dataset->AddLookupField('CIUDAD', 'GE.CIUDAD', new IntegerField('CIUDAD_ID'), new StringField('NOMBRE', 'LA1', 'LT1'), 'LT1');
}
示例9: getCMSFields
public function getCMSFields()
{
$fields = new FieldList();
$fields->push(new TabSet('Root', new Tab('Main', _t('SiteTree.TABMAIN', 'Main'), new TextField('Title', _t('UniadsObject.db_Title', 'Title')))));
if ($this->ID) {
$previewLink = Director::absoluteBaseURL() . 'admin/' . UniadsAdmin::config()->url_segment . '/UniadsObject/preview/' . $this->ID;
$fields->addFieldToTab('Root.Main', new ReadonlyField('Impressions', _t('UniadsObject.db_Impressions', 'Impressions')), 'Title');
$fields->addFieldToTab('Root.Main', new ReadonlyField('Clicks', _t('UniadsObject.db_Clicks', 'Clicks')), 'Title');
$fields->addFieldsToTab('Root.Main', array(DropdownField::create('CampaignID', _t('UniadsObject.has_one_Campaign', 'Campaign'), DataList::create('UniadsCampaign')->map())->setEmptyString(_t('UniadsObject.Campaign_none', 'none')), DropdownField::create('ZoneID', _t('UniadsObject.has_one_Zone', 'Zone'), DataList::create('UniadsZone')->map())->setEmptyString(_t('UniadsObject.Zone_select', 'select one')), new NumericField('Weight', _t('UniadsObject.db_Weight', 'Weight (controls how often it will be shown relative to others)')), new TextField('TargetURL', _t('UniadsObject.db_TargetURL', 'Target URL')), new Treedropdownfield('InternalPageID', _t('UniadsObject.has_one_InternalPage', 'Internal Page Link'), 'Page'), new CheckboxField('NewWindow', _t('UniadsObject.db_NewWindow', 'Open in a new Window')), $file = new UploadField('File', _t('UniadsObject.has_one_File', 'Advertisement File')), $AdContent = new TextareaField('AdContent', _t('UniadsObject.db_AdContent', 'Advertisement Content')), $Starts = new DateField('Starts', _t('UniadsObject.db_Starts', 'Starts')), $Expires = new DateField('Expires', _t('UniadsObject.db_Expires', 'Expires')), new NumericField('ImpressionLimit', _t('UniadsObject.db_ImpressionLimit', 'Impression Limit')), new CheckboxField('Active', _t('UniadsObject.db_Active', 'Active')), new LiteralField('Preview', '<a href="' . $previewLink . '" target="_blank">' . _t('UniadsObject.Preview', 'Preview this advertisement') . "</a>")));
$app_categories = File::config()->app_categories;
$file->setFolderName($this->config()->files_dir);
$file->getValidator()->setAllowedMaxFileSize(array('*' => $this->config()->max_file_size));
$file->getValidator()->setAllowedExtensions(array_merge($app_categories['image'], $app_categories['flash']));
$AdContent->setRows(10);
$AdContent->setColumns(20);
$Starts->setConfig('showcalendar', true);
$Starts->setConfig('dateformat', i18n::get_date_format());
$Starts->setConfig('datavalueformat', 'yyyy-MM-dd');
$Expires->setConfig('showcalendar', true);
$Expires->setConfig('dateformat', i18n::get_date_format());
$Expires->setConfig('datavalueformat', 'yyyy-MM-dd');
$Expires->setConfig('min', date('Y-m-d', strtotime($this->Starts ? $this->Starts : '+1 days')));
}
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例10: getCMSFields
public function getCMSFields()
{
//Fetch curret fields and store in Fields
$fields = parent::getCMSFields();
//Remove Fields
$fields->removeFieldFromTab("Root.Main", array("SortOrder", "CalendarID", "Title", "Content", "StartDate", "StartTime", "EndDate", "EndTime", "Location"));
//Event Title
$Title = new TextField("Title", "Event Title");
$Title->setRightTitle("Enter the event title. i.e. sports day.");
//Start Date & Time
$StartDate = new DateField("StartDate", "Start Date");
$StartDate->setConfig('showcalendar', 1);
$StartDate->setConfig('dateformat', 'dd/MM/YYYY');
$StartTime = new TimeField("StartTime", "Start Time (Optional)");
$StartTime->setConfig('use_strtotime', 1);
//End Date & Time
$EndDate = new DateField("EndDate", "End Date (Optional)");
$EndDate->setConfig('showcalendar', 1);
$EndDate->setConfig('dateformat', 'dd/MM/YYYY');
$EndTime = new TimeField("EndTime", "End Time (Optional)");
$StartTime->setConfig('use_strtotime', 1);
//Location
$Location = new AddressTextField("Location", "Event Location", "AIzaSyA-folYpPWGiFcpBZURJpf610nO6FJtqqQ");
$Location->SetRightTitle("Optional. Begin typing and you will see address suggestions (Beta). Powered by Google.");
$Location->addExtraClass("text");
//Event Description
$Description = new HTMLEditorField("Content", "Event Description");
//Group Start and End Date & Time Fields
$Times = FieldGroup::create($StartDate, $StartTime, $EndDate, $EndTime)->setTitle('Timings');
//Add Fields to the CMS
$fields->addFieldsToTab("Root.Main", array($Title, $Times, $Location, $Description));
//Return Fields to the CMS
return $fields;
}
示例11: getCMSFields
function getCMSFields()
{
// don't overwrite the main fields
$fields = parent::getCMSFields();
// Nominations Open
$NominationsOpenField = new DateField('NominationsOpen', 'Date the nominations open (12:00AM this day)');
$NominationsOpenField->setConfig('showcalendar', true);
$NominationsOpenField->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $NominationsOpenField, 'Content');
$NominationsOpenHeader = new HeaderField('Candidate Nomination Dates');
$fields->addFieldToTab('Root.Main', $NominationsOpenHeader, 'NominationsOpen');
// Nominations Close
$NominationsCloseField = new DateField('NominationsClose', 'Date the nominations close (11:59PM this day)');
$NominationsCloseField->setConfig('showcalendar', true);
$NominationsCloseField->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $NominationsCloseField, 'Content');
// Nomination App Deadline
$NominationAppDeadlineField = new DateField('NominationAppDeadline', 'Date candidates must have completed the application in order to be listed (11:59PM this day)');
$NominationAppDeadlineField->setConfig('showcalendar', true);
$NominationAppDeadlineField->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $NominationAppDeadlineField, 'Content');
// Elections Open
$ElectionsOpenField = new DateField('ElectionsOpen', 'Date the elections open (12:00AM this day)');
$ElectionsOpenField->setConfig('showcalendar', true);
$ElectionsOpenField->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $ElectionsOpenField, 'Content');
$NominationsOpenHeader = new HeaderField('Election Dates');
$fields->addFieldToTab('Root.Main', $NominationsOpenHeader, 'ElectionsOpen');
// Elections Close
$ElectionsCloseField = new DateField('ElectionsClose', 'Date the elections close (11:59PM this day)');
$ElectionsCloseField->setConfig('showcalendar', true);
$ElectionsCloseField->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $ElectionsCloseField, 'Content');
return $fields;
}
示例12: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
// the date field is added in a bit more complex manner so it can have the dropdown date picker
$EventStartDate = new DateField('EventStartDate', 'First Day of Event');
$EventStartDate->setConfig('showcalendar', true);
$EventStartDate->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $EventStartDate, 'Content');
// same things for the event end date
$EventEndDate = new DateField('EventEndDate', 'Last Day of Event');
$EventEndDate->setConfig('showcalendar', true);
$EventEndDate->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $EventEndDate, 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventLink', 'Event Button Link (URL)'), 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventLinkLabel', 'Event Button Label'), 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventLocation', 'Event Location'), 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventSponsor', 'Event Sponsor'), 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventSponsorLogoUrl', 'URL of the Event Sponsor Logo'), 'Content');
$fields->addFieldToTab('Root.Main', new CheckboxField('IsSummit', 'Official OpenStack Summit Event'), 'Content');
// remove unneeded fields
$fields->removeFieldFromTab("Root.Main", "MenuTitle");
// rename fields
$fields->renameField("Content", "Event Page Content");
$fields->renameField("Title", "Event Title");
return $fields;
}
示例13: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
if ($this->ID) {
Session::set("FamilyMemberID", $this->ID);
}
if (Session::get("FamilyID")) {
$this->FamilyID = Session::get("FamilyID");
$fields->replaceField('FamilyID', new HiddenField('FamilyID'));
}
$dateOfBirth = new DateField('DateOfBirth', 'Date Of Birth');
$dateOfBirth->setConfig('dateformat', 'dd-MM-yyyy');
$dateOfBirth->setDescription('e.g. ' . date('d-m-Y'));
$dateOfBirth->setAttribute('placeholder', 'dd-MM-yyyy');
$fields->addFieldsToTab('Root.Main', $dateOfBirth);
$genders = Config::inst()->get('FamilyMember', 'Gender');
$gender = new OptionsetField("Gender", 'Gender', $genders);
$fields->addFieldsToTab('Root.Main', $gender);
$status = Config::inst()->get('FamilyMember', 'MartialStatus');
$martialStatus = new OptionsetField("MartialStatus", 'Martial Status', $status);
$fields->addFieldsToTab('Root.Main', $martialStatus);
$fields->insertBefore(new Tab('Job', 'Job'), 'CommunityGroups');
//Job GridField
$jobGridFieldConfig = GridFieldConfig_RecordEditor::create();
$jobList = Job::get()->filter(array('FamilyMemberID' => $this->ID))->sort('ID ASC');
if ($jobList->count()) {
$jobGridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
}
$jobGridField = new GridField('Job', 'Job', $jobList, $jobGridFieldConfig);
$fields->addFieldsToTab('Root.Job', array($jobGridField));
$fields->insertBefore(new Tab('Health', 'Health'), 'CommunityGroups');
//Health GridField
$healthGridFieldConfig = GridFieldConfig_RecordEditor::create();
$healthList = Health::get()->filter(array('FamilyMemberID' => $this->ID))->sort('ID ASC');
if ($healthList->count()) {
$healthGridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
}
$healthGridField = new GridField('Health', 'Health', $healthList, $healthGridFieldConfig);
$fields->addFieldsToTab('Root.Health', array($healthGridField));
//Job GridField
/*
$communityGroupsCongfig = GridFieldConfig_RelationEditor::create();
//$jobGridFieldConfig = GridFieldConfig_RecordEditor::create();
$communityGroupsList = $this->CommunityGroups();
$communityGroupsGridField = new GridField('CommunityGroups', 'Community Groups',
$communityGroupsList,
$communityGroupsCongfig);
$fields->addFieldsToTab('Root.CommunityGroups', array(
$communityGroupsGridField
));
*/
//CommunityGroups ListboxField
$communityGroupsList = CommunityGroup::get()->map('ID', 'Title')->toArray();
$communityGroupsField = new ListboxField($name = "CommunityGroups", $title = "Communtiy Groups", $communityGroupsList);
$communityGroupsField->setMultiple(true);
$fields->addFieldsToTab('Root.CommunityGroups', $communityGroupsField);
//exit('dd');
return $fields;
}
示例14: DoBeforeCreate
protected function DoBeforeCreate()
{
$selectQuery = 'SELECT task.task_name,
project.project_name,
timesheet.name,
timesheet.date,
timesheet.hours,
timesheet.staff_id,
pay_period.start_date,
pay_period.end_date,
pay_period.pay_period_number,
pay_period.YEAR,
staff.position,
staff.emp_number
FROM timesheet
LEFT JOIN task ON timesheet.task_id = task.task_id
LEFT JOIN project ON task.project_id = project.project_id
LEFT JOIN staff ON timesheet.staff_id = staff.staff_id
LEFT JOIN pay_period ON timesheet.date BETWEEN pay_period.start_date AND pay_period.end_date';
$insertQuery = array();
$updateQuery = array();
$deleteQuery = array();
$this->dataset = new QueryDataset(new MyConnectionFactory(), GetConnectionOptions(), $selectQuery, $insertQuery, $updateQuery, $deleteQuery, 'View Pay Period');
$field = new StringField('task_name');
$this->dataset->AddField($field, false);
$field = new StringField('project_name');
$this->dataset->AddField($field, false);
$field = new StringField('name');
$this->dataset->AddField($field, false);
$field = new DateField('date');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new StringField('hours');
$this->dataset->AddField($field, true);
$field = new IntegerField('staff_id');
if (!$this->GetSecurityInfo()->AdminGrant()) {
$field->SetReadOnly(true, GetApplication()->GetCurrentUserId());
}
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new DateTimeField('start_date');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new DateTimeField('end_date');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new IntegerField('pay_period_number');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new IntegerField('YEAR');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new StringField('position');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
$field = new StringField('emp_number');
$field->SetIsNotNull(true);
$this->dataset->AddField($field, true);
}
示例15: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Main", $dateField = new DateField("DueDate", "Date Due"));
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'dd/MM/YYYY');
return $fields;
}