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; }
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; }
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; }
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; }
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; }
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; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab("Root.Main", $dateField = new DateField("Date", "Date")); $dateField->setConfig('showcalendar', true); $dateField->setConfig('dateformat', 'dd/MM/YYYY'); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $datefield = new DateField('Date'); $datefield->setConfig('showcalendar', true); $datefield->setConfig('showdropdown', true); $fields->addFieldToTab('Root.Main', $datefield, 'Content'); $fields->addFieldToTab('Root.Main', new TextField('Author'), 'Content'); return $fields; }
/** * @param \FieldList $parameterFields * @param array $filters * @param \SS_HTTPRequest $request * @return void */ public function modifyParameterFields(\FieldList $parameterFields, array $filters, \SS_HTTPRequest $request) { $parameterFields->push($start = new \DateField('StartDate')); $start->setConfig('showcalendar', true); $start->setConfig('dateformat', 'dd/MM/YYYY'); $parameterFields->push($end = new \DateField('EndDate')); $end->setConfig('showcalendar', true); $end->setConfig('dateformat', 'dd/MM/YYYY'); $parameterFields->push(new \DropdownField('Range', 'Range', ['' => '-- Range --', 'Today' => 'Today', 'Yesterday' => 'Yesterday', 'Current Week' => 'Current Week', 'Last Week' => 'Last Week', 'Current Month' => 'Current Month', 'Last Month' => 'Last Month', 'Current Year' => 'Current Year', 'All Time' => 'All Time'])); }
function getCMSFields() { $fields = parent::getCMSFields(); // the date field is added in a bit more complex manner so it can have the dropdown date picker $MustBeMemberBy = new DateField('MustBeMemberBy', 'Only show foundation members that signed up before this date:'); $MustBeMemberBy->setConfig('showcalendar', true); $MustBeMemberBy->setConfig('showdropdown', true); $fields->addFieldToTab('Root.Main', $MustBeMemberBy, 'Content'); return $fields; }
public function getCMSFields() { $Sfields = parent::getCMSFields(); $dateField = new DateField('Date', 'Article Date (for example: 20/12/2010)'); $dateField->setConfig('showcalendar', true); $dateField->setConfig('dateformat', 'dd/MM/YYYY'); $fields->addFieldToTab('Root.Main', $dateField, 'Content'); $fields->addFieldToTab('Root.Main', new TextField('Author', 'Author Name'), 'Content'); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', new CheckboxField('IsExplicit', 'Contains Explicit Content'), 'Content'); $fields->addFieldToTab('Root.Main', new TextField('ChapterTitle', 'Chapter Title'), 'Content'); $fields->addFieldToTab('Root.Main', $dateField = new DateField('Added', 'Added on (for example: 12/20/2010)'), 'Content'); $dateField->setConfig('showcalendar', true); $dateField->setConfig('dateformat', 'MM/dd/YYYY'); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $Datepckr = new DateField('Date'); $Datepckr->setConfig('dateformat', 'dd-MM-yyyy'); // global setting $Datepckr->setConfig('showcalendar', 1); // field-specific setting $fields->addFieldToTab("Root.Main", $Datepckr, 'Content'); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $datefield = new DateField('Date', 'Date'); $datefield->setConfig('showcalendar', true); $datefield->setConfig('showdropdown', true); $datefield->setConfig('dateformat', 'dd/MM/YYYY'); $fields->addFieldToTab('Root.Main', $datefield, 'Content'); $fields->addFieldToTab('Root.Main', new CheckboxField('Featured', 'Not for display on homepage'), 'Content'); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', new TextField('Description', 'Contest Short Description'), 'Content'); $fields->addFieldToTab('Root.Main', new UploadField('CoverImage', 'Cover Image'), 'Content'); $fields->addFieldToTab('Root.Main', $startField = new DateField('StartDate', 'Start Date'), 'Content'); $startField->setConfig('showcalendar', true); $startField->setConfig('dateformat', 'MM/dd/YYYY'); $fields->addFieldToTab('Root.Main', $deadlineField = new DateField('Deadline', 'Submission Deadline'), 'Content'); $deadlineField->setConfig('showcalendar', true); $deadlineField->setConfig('dateformat', 'MM/dd/YYYY'); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); // Set some fields $fields->addFieldToTab('Root.Main', new TextField('Location')); $fields->addFieldToTab('Root.Main', new TextField('CapturedBy')); // Configure the date field $df = new DateField('DateCaptured', 'Date Captured (dd/mm/yyyy)'); $df->setLocale('en_NZ'); $df->setConfig('dateformat', 'dd/MM/YYYY'); $df->setConfig('showcalendar', 'true'); $fields->addFieldToTab('Root.Main', $df); return $fields; }
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; }
public function getCMSFields() { $fields = parent::getCMSFields(); //$fields->addFieldToTab('Root.Main', new TextField('Location'), 'Content'); $fields->addFieldToTab('Root.Main', new TextField('Subtitle'), 'Content'); $fields->addFieldToTab('Root.Main', new TextareaField('Excerpt'), 'Content'); $dateField = new DateField('Date'); $dateField->setConfig('showcalendar', true); $dateField->setConfig('dateformat', 'dd.MM.YYYY'); $fields->addFieldToTab('Root.Main', $dateField, 'Content'); $locationDropDown = new DropdownField('LocationID', 'Choose Location', $this->getLocationOptions()); $locationDropDown->setEmptyString('(Select Location)'); $locationDropDown->setDescription('Create new Locations in Model Admin'); $fields->addFieldToTab('Root.Main', $locationDropDown, 'Content'); return $fields; }
public function getCMSFields() { $startdatefield = new DateField('StartDate', 'Start Date'); $startdatefield->setConfig('showcalendar', true); $startdatefield->setConfig('dateformat', 'MM/dd/yyyy'); $enddatefield = new DateField('EndDate', 'End Date'); $enddatefield->setConfig('showcalendar', true); $enddatefield->setConfig('dateformat', 'MM/dd/yyyy'); $imagefield = UploadField::create('Photo'); $imagefield->folderName = 'Calendar'; $imagefield->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png'); $resourcefield = UploadField::create('Resource')->setTitle('Flyer/Brochure (PDF or Doc)'); $resourcefield->folderName = 'Calendar'; $resourcefield->getValidator()->allowedExtensions = array('pdf', 'doc', 'docx'); return new FieldList(TextField::create('Title'), $startdatefield, $enddatefield, TimeField::create('StartTime')->setTitle('Start Time'), TimeField::create('EndTime')->setTitle('End Time'), TextField::create('Location'), $imagefield, $resourcefield, HTMLEditorField::create('Content')->setTitle('Event Description')); }
/** * 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; }
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; }
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; }
public function parameterFields() { $member = Member::currentUserID() ? Member::currentUser() : new Member(); $dateformat = $member->getDateFormat(); $fields = new FieldList($start = new DateField("StartPeriod", "Start Date"), $end = new DateField("EndPeriod", "End Date")); if ($this->grouping) { $fields->push(new DropdownField("Grouping", "Group By", array("Year" => "Year", "Month" => "Month", "Day" => "Day"), 'Month')); if (self::config()->display_uncategorised_data) { $fields->push(CheckboxField::create("IncludeUncategorised", "Include Uncategorised Data")->setDescription("Display data that doesn't have a date.")); } } $start->setConfig("dateformat", $dateformat); $end->setConfig("dateformat", $dateformat); $start->setConfig("showcalendar", true); $end->setConfig("showcalendar", true); return $fields; }
public function updateCMSFields(\FieldList $fields) { parent::updateCMSFields($fields); $field = new DateField('FromDate'); $field->setConfig('showcalendar', true); $field->setConfig('dateformat', 'dd/MM/YYYY'); $field->setTitle(_t("BlogEntry.FROMDT", "Date")); if ($this->owner->Created == $this->owner->LastEdited) { // In caso di nuovo post, setto il campo FromDate ad oggi $now = Zend_Date::now(); $this->owner->FromDate = $now->toString('d/M/Y'); } $fields->addFieldToTab('Root.PublishedPeriod', $field); $field = new DateField('ToDate'); $field->setConfig('showcalendar', true); $field->setConfig('dateformat', 'dd/MM/YYYY'); $field->setTitle(_t("BlogEntry.TODT", "Date")); $fields->addFieldToTab('Root.PublishedPeriod', $field); }
public function getCMSFields() { $fields = parent::getCMSFields(); $dateField = new DateField('Date'); $dateField->setConfig('showcalendar', true); $fields->addFieldToTab('Root.Main', $dateField, 'Content'); $fields->addFieldToTab('Root.Main', new TextField('Author'), 'Content'); $fields->addFieldToTab('Root.Main', new TextField('Try'), 'Content'); $fields->addFieldToTab("Root.Images", new UploadField('Photo')); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', new TextField('Description', 'Story Summary'), 'Content'); $fields->addFieldToTab('Root.Main', new UploadField('CoverImage', 'Cover Image'), 'Content'); $fields->addFieldToTab('Root.Main', new DropdownField('Rating', 'Story Rating', $this->dbObject('Rating')->enumValues()), 'Content'); $fields->addFieldToTab('Root.Main', new DropdownField('StoryStatus', 'Story Status', $this->dbObject('StoryStatus')->enumValues()), 'Content'); $fields->addFieldToTab('Root.Main', new DropdownField('Type', 'Story Type', $this->dbObject('Type')->enumValues()), 'Content'); $fields->addFieldToTab('Root.Main', $dateField = new DateField('Added', 'Added on (for example: 12/20/2010)'), 'Content'); $dateField->setConfig('showcalendar', true); $dateField->setConfig('dateformat', 'MM/dd/YYYY'); $characters = DataObject::get('Character'); if (!empty($characters)) { // create an array('ID'=>'Name') $characterMap = $characters->map("ID", "Name", "Please Select"); // create a Multi-select group based on the array $fields->addFieldToTab('Root.Details', ListboxField::Create('Characters', 'Select a Character')->setMultiple(true)->setSource($characterMap)); } $series = DataObject::get('Series'); if (!empty($series)) { // create an array('ID'=>'Name') $seriesMap = $series->map("ID", "Name", "Please Select"); // create a Multi-select group based on the array $fields->addFieldToTab('Root.Details', ListboxField::Create('Series', 'Select a Series')->setMultiple(true)->setSource($seriesMap)); } $genres = DataObject::get('Genre'); if (!empty($genres)) { // create an array('ID'=>'Name') $genreMap = $genres->map("ID", "Name", "Please Select"); // create a Multi-select group based on the array $fields->addFieldToTab('Root.Details', ListboxField::Create('Genres', 'Select a Genre')->setMultiple(true)->setSource($genreMap)); } $authors = DataObject::get('Author'); if (!empty($authors)) { // create an array('ID'=>'Name') $authorMap = $authors->map("ID", "Name", "Please Select"); // create a Multi-select group based on the array $fields->addFieldToTab('Root.Details', ListboxField::create('Authors', 'Select an Author')->setMultiple(true)->setSource($authorMap)); } return $fields; }
public function getCMSFields() { $this->beforeUpdateCMSFields(function ($fields) { $datefield = new DateField('Date', 'Date (DD/MM/YYYY)'); $datefield->setConfig('showcalendar', true); $datefield->setConfig('showdropdown', true); $datefield->setConfig('dateformat', 'dd/MM/YYYY'); $fields->addFieldToTab('Root.Main', $datefield, 'Content'); $image = new UploadField('AttachedImage', 'Main Image'); $image->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif')); $image->setConfig('allowedMaxFileNumber', 1); $image->setFolderName('Managed/NewsImages'); $image->setCanPreviewFolder(false); $image->setRightTitle("Displayed to the right of the content in the main article, where it can be clicked to enlarge. <br />A thumbnail also appears next to the article summary on the main News page."); $fields->addFieldToTab('Root.Main', $image, "Content"); }); $fields = parent::getCMSFields(); $fields->renameField("Title", "Headline"); $fields->removeFieldFromTab("Root.Main", "MenuTitle"); return $fields; }
function getCMSFields() { $this->beforeUpdateCMSFields(function ($fields) { $datefield = new DateField('Date', 'Date (DD/MM/YYYY)*'); $datefield->setConfig('showcalendar', true); $datefield->setConfig('dateformat', 'dd/MM/YYYY'); $imagefield = new UploadField('Image', 'Image'); $imagefield->allowedExtensions = array('jpg', 'gif', 'png'); $imagefield->setFolderName("Managed/CalendarImages"); $imagefield->setCanPreviewFolder(false); $fields->addFieldToTab('Root.Main', new TextField('Title', "Event Title*")); $fields->addFieldToTab('Root.Main', $datefield); $fields->addFieldToTab('Root.Main', new TextField('Time', "Time (HH:MM)")); $fields->addFieldToTab('Root.Main', new TextareaField('Description')); $fields->addFieldToTab('Root.Main', $imagefield); }); $fields = parent::getCMSFields(); $this->extend('updateCMSFields', $fields); $fields->removeFieldFromTab("Root.Main", "CalendarPageID"); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); // the date field is added in a bit more complex manner so it can have the dropdown date picker $JobPostedDate = new DateField('JobPostedDate', 'Date Posted'); $JobPostedDate->setConfig('showcalendar', true); $JobPostedDate->setConfig('showdropdown', true); $fields->addFieldToTab('Root.Main', $JobPostedDate, 'Content'); $fields->addFieldToTab('Root.Main', new DateField_Disabled('ExpirationDate', 'Expiration Date'), 'Content'); $fields->addFieldToTab('Root.Main', new TextField('JobMoreInfoLink', 'More Information About This Job (URL)'), 'Content'); $fields->addFieldToTab('Root.Main', new TextField('JobCompany', 'Company'), 'Content'); $fields->addFieldToTab('Root.Main', new HtmlEditorField('JobInstructions2Apply', 'Job Instructions to Apply'), 'Content'); $fields->addFieldToTab('Root.Main', new CheckboxField('FoundationJob', 'This is a job with the OpenStack Foundation')); $fields->addFieldToTab('Root.Main', new CheckboxField('Active', 'Is Active?')); $fields->addFieldToTab('Root.Main', new DropdownField('LocationType', 'Location Type', singleton('JobPage')->dbObject('LocationType')->enumValues())); // remove unneeded fields $fields->removeFieldFromTab("Root.Main", "MenuTitle"); // rename fields $fields->renameField("Content", "Job Description"); $fields->renameField("Title", "Job Title"); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $dateField = new DateField('Date'); $dateField->setConfig('showcalendar', true); $fields->addFieldToTab('Root.Main', $dateField, 'Content'); $fields->addFieldToTab('Root.Main', new UploadField('FeaturedImage', 'Featured Image'), 'Content'); if (self::$use_summary) { $fields->addFieldToTab('Root.Main', new TextareaField('Summary'), 'Content'); } $this->addCategoriesTab($fields); return $fields; }