public function getCMSFields() { $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID; $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main'))); $f->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $f->addFieldToTab('Root.Main', new HtmlEditorField('Description', 'Description')); $f->addFieldToTab('Root.Main', new HtmlEditorField('ShortDescription', 'Short Description')); $f->tag('Tags', 'Tags', Tag::get(), $this->Tags())->configure()->setTitleField('Tag')->end(); $f->addFieldToTab('Root.Main', new CheckboxField('AllowFeedBack', 'Is feedback allowed?')); $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID')); $f->addFieldToTab('Root.Main', $date = new DatetimeField('StartDate', 'Start Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('EndDate', 'End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $locations = SummitAbstractLocation::get()->filter('SummitID', $summit_id)->filter('ClassName', array('SummitVenue', 'SummitVenueRoom', 'SummitExternalLocation')); $locations_source = array(); foreach ($locations as $l) { $locations_source[$l->ID] = $l->getFullName(); } $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('LocationID', 'Location', $locations_source)); $ddl_location->setEmptyString('-- Select a Location --'); $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('TypeID', 'Event Type', SummitEventType::get()->filter('SummitID', $summit_id)->map('ID', 'Type'))); $ddl_location->setEmptyString('-- Select a Event Type --'); $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID')); if ($this->ID > 0) { // summits types $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter'); $completer->setSearchList(SummitType::get()->filter('SummitID', $summit_id)); $summit_types = new GridField('AllowedSummitTypes', 'Summit Types', $this->AllowedSummitTypes(), $config); $f->addFieldToTab('Root.Main', $summit_types); // sponsors $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $sponsors = new GridField('Sponsors', 'Sponsors', $this->Sponsors(), $config); $f->addFieldToTab('Root.Sponsors', $sponsors); // feedback $config = new GridFieldConfig_RecordEditor(100); $config->removeComponentsByType('GridFieldAddNewButton'); $feedback = new GridField('Feedback', 'Feedback', $this->Feedback(), $config); $f->addFieldToTab('Root.Feedback', $feedback); } return $f; }
public function getCMSFields() { Requirements::customScript("\n jQuery( document ).ready(function() {\n jQuery('body').on('change','#Form_ItemEditForm_RSVPTemplateID',\n function(){\n jQuery('#Form_ItemEditForm_action_save').click();\n }\n );\n });"); $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID; $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main'))); $f->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $f->addFieldToTab('Root.Main', new HtmlEditorField('Description', 'Description')); $f->addFieldToTab('Root.Main', new HtmlEditorField('ShortDescription', 'Abstract')); $f->addFieldToTab('Root.Main', new TextField('HeadCount', 'HeadCount')); $f->tag('Tags', 'Tags', Tag::get(), $this->Tags())->configure()->setTitleField('Tag')->end(); $f->addFieldToTab('Root.Main', new CheckboxField('AllowFeedBack', 'Is feedback allowed?')); $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID')); $f->addFieldToTab('Root.Main', $date = new DatetimeField('StartDate', 'Start Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('EndDate', 'End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldsToTab('Root.Main', new ReadonlyField('AvgFeedbackRate', 'AvgFeedbackRate')); $locations = SummitAbstractLocation::get()->filter('SummitID', $summit_id)->filter('ClassName', array('SummitVenue', 'SummitVenueRoom', 'SummitExternalLocation')); $locations_source = array(); foreach ($locations as $l) { $locations_source[$l->ID] = $l->getFullName(); } $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('LocationID', 'Location', $locations_source)); $ddl_location->setEmptyString('-- Select a Location --'); $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('TypeID', 'Event Type', SummitEventType::get()->filter('SummitID', $summit_id)->map('ID', 'Type'))); $ddl_location->setEmptyString('-- Select a Event Type --'); $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID')); if ($this->ID > 0) { // summits types $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter'); $completer->setSearchList(SummitType::get()->filter('SummitID', $summit_id)); $summit_types = new GridField('AllowedSummitTypes', 'Summit Types', $this->AllowedSummitTypes(), $config); $f->addFieldToTab('Root.Main', $summit_types); // sponsors $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $sponsors = new GridField('Sponsors', 'Sponsors', $this->Sponsors(), $config); $f->addFieldToTab('Root.Sponsors', $sponsors); // feedback $config = new GridFieldConfig_RecordEditor(100); $config->removeComponentsByType('GridFieldAddNewButton'); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $feedback = new GridField('Feedback', 'Feedback', $this->Feedback(), $config); $f->addFieldToTab('Root.Feedback', $feedback); // rsvp $f->addFieldsToTab('Root.RSVP', new TextField('RSVPLink', 'RSVP External Link')); $rsvp_template = new DropdownField('RSVPTemplateID', 'Select a Template', RSVPTemplate::get()->filter('SummitID', $summit_id)->map()); $rsvp_template->setEmptyString('-- View All Templates --'); $f->addFieldToTab('Root.RSVP', LiteralField::create('AddNew', 'Or add a new custom RSVP Configuration')); $f->addFieldToTab('Root.RSVP', $rsvp_template); $f->addFieldToTab('Root.RSVP', new NumericField('RSVPMaxUserNumber', 'Max # Number')); $f->addFieldToTab('Root.RSVP', new NumericField('RSVPMaxUserWaitListNumber', 'Max # Wait List')); $f->addFieldToTab('Root.RSVP', $rsvp_template); if ($this->RSVPTemplate()->exists()) { $config = new GridFieldConfig_RecordEditor(100); $config->removeComponentsByType('GridFieldAddNewButton'); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $rsvps = new GridField('RSVPSubmissions', 'RSVP Submissions', $this->RSVPSubmissions(), $config); $f->addFieldToTab('Root.RSVP', $rsvps); } } if ($this->ID > 0) { $_REQUEST['SummitEventID'] = $this->ID; } return $f; }