public function getCMSFields() { $f = parent::getCMSFields(); $f->addFieldToTab('Root.Main', new TextField('Capacity', 'Capacity')); $f->addFieldToTab('Root.Main', new HiddenField('VenueID', 'VenueID')); // hack $this->SummitID = $_REQUEST['SummitID']; return $f; }
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; }
/** * @param mixed $day * @param int $location_id * @return SummitEvent[] * @throws Exception */ public function getBlackouts($day, $location_id) { $blackouts = new ArrayList(); $location = SummitAbstractLocation::get()->byID($location_id); if (!is_null($location) && !$location->overridesBlackouts()) { $event_repository = new SapphireSummitEventRepository(); $blackouts = $event_repository->getOtherBlackoutsByDay($this, $day, $location_id); } return $blackouts; }
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; }
public function details(SS_HTTPRequest $r) { $location = SummitAbstractLocation::get()->byID((int) $r->param('ID')); if (!$location) { return $this->httpError(404); } $class = $location->ClassName; $location = $class::get()->byID((int) $r->param('ID')); return array('Location' => $location); }
public function getCMSFields() { $f = parent::getCMSFields(); $f->addFieldToTab('Root.Main', new TextField('WebSiteUrl', 'WebSite Url')); $f->addFieldToTab('Root.Main', new CheckboxField('DisplayOnSite', 'Should Display On Site')); $f->addFieldToTab('Root.Main', $messageField = new TextField('LocationMessage', 'Message to display for this location')); $messageField->setAttribute('style', 'max-width:100% !important'); $f->addFieldToTab('Root.Main', new CheckboxField('DetailsPage', 'Send people to a details page first?')); $f->addFieldsToTab("Root.Location", array(HiddenField::create("Lat"), HiddenField::create("Lng"), TextField::create("Address1"), TextField::create("Address2"), TextField::create("ZipCode"), TextField::create("City"), TextField::create("State"), CountryDropdownField::create("Country"), GoogleMapField::create("Map", array("height" => "500px", "width" => "600px", "lng_field" => "Form_ItemEditForm_Lng", "lat_field" => "Form_ItemEditForm_Lat", "address_field" => array('address1' => "Address1", 'zip_code' => "ZipCode", 'city' => "City", 'state' => "State", 'country' => "Country"), 'start_lat' => $this->Lat, 'start_lng' => $this->Lng)))); if ($this->ID > 0) { $config = GridFieldConfig_RecordEditor::create(); $gridField = new GridField('Maps', 'Maps', $this->Maps(), $config); $config->addComponent($sort = new GridFieldSortableRows('Order')); $f->addFieldToTab('Root.Maps', $gridField); } return $f; }
public function getLink() { return parent::getLink() . '/#room=' . $this->ID; }