public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('Capacity');
     $fields->removeByName('Registrations');
     $fields->removeByName('Tickets');
     $fields->removeByName('EmailReminder');
     $fields->removeByName('RemindDays');
     $fields->removeByName('PaymentID');
     $fields->removeByName('ReminderJobID');
     if (!$this->isInDB()) {
         $fields->push(new LiteralField('RegistrationNote', '<p>You can configure registration once ' . 'you save for the first time.</p>'));
         return $fields;
     }
     $fields->push(new GridField('Tickets', _t('EventManagement.AVAILABLE_TICKETS', 'Available Tickets'), $this->Tickets(), GridFieldConfig::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new GridFieldToolbarHeader())->addComponent($add = new GridFieldAddExistingSearchButton())->addComponent(new GridFieldTitleHeader())->addComponent(new GridFieldOrderableRows('Sort'))->addComponent($editable = new GridFieldEditableColumns())->addComponent(new GridFieldDeleteAction(true))));
     $fields->push($capacity = new NumericField('Capacity', _t('EventManagement.CAPACITY', 'Capacity')));
     $editable->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'ReadonlyField'), 'StartSummary' => 'Sales Start', 'PriceSummary' => 'Price', 'Available' => array('field' => 'NumericField')));
     $add->setTitle(_t('EventManagement.ADD_TICKET_TYPE', 'Add Ticket Type'));
     $capacity->setDescription('Set to 0 for unlimited capacity.');
     if (class_exists('AbstractQueuedJob')) {
         if ($this->ReminderJobID && $this->ReminderJob()->StepsProcessed) {
             $fields->push(new LiteralField('RemindersAlreadySent', '<p>Reminder emails have already been sent out.</p>'));
         } else {
             $fields->push(new CheckboxField('EmailReminder', _t('EventManagement.SEND_REMINDER_EMAIL', 'Send the registered attendees a reminder email?')));
             $fields->push($remindDays = new NumericField('RemindDays', _t('EventManagement.SEND_REMINDER', 'Send reminder')));
             $remindDays->setDescription(_t('EventManagement.DAYS_BEFORE_EVENT', 'Days before the event starts.'));
         }
     }
     return $fields;
 }
 public function getSettingsFields()
 {
     $fields = parent::getSettingsFields();
     Requirements::javascript('eventmanagement/javascript/cms.js');
     $fields->addFieldsToTab('Root.Registration', array(new CheckboxField('OneRegPerEmail', _t('EventManagement.ONE_REG_PER_EMAIL', 'Limit to one registration per email address?')), new CheckboxField('RequireLoggedIn', _t('EventManagement.REQUIRE_LOGGED_IN', 'Require users to be logged in to register?')), $limit = new NumericField('RegistrationTimeLimit', _t('EventManagement.REG_TIME_LIMIT', 'Registration time limit'))));
     $limit->setDescription(_t('EventManagement.REG_TIME_LIMIT_NOTE', 'The time limit to complete registration, in seconds. Set to 0 to disable place holding.'));
     $fields->addFieldsToTab('Root.Email', array(new EmailField('EventManagerEmail', _t('EventManagement.EMAIL_EVENT_MANAGER', 'Event manager email to receive registration notifications?')), new CheckboxField('RegEmailConfirm', _t('EventManagement.REQ_EMAIL_CONFIRM', 'Require email confirmation to complete free registrations?')), $info = new TextField('EmailConfirmMessage', _t('EventManagement.EMAIL_CONFIRM_INFO', 'Email confirmation information')), $limit = new NumericField('ConfirmTimeLimit', _t('EventManagement.EMAIL_CONFIRM_TIME_LIMIT', 'Email confirmation time limit')), new CheckboxField('UnRegEmailConfirm', _t('EventManagement.REQ_UN_REG_EMAIL_CONFIRM', 'Require email confirmation to un-register?')), new CheckboxField('EmailNotifyChanges', _t('EventManagement.EMAIL_NOTIFY_CHANGES', 'Notify registered users of event changes via email?')), new CheckboxSetField('NotifyChangeFields', _t('EventManagement.NOTIFY_CHANGE_IN', 'Notify of changes in'), singleton('RegistrableDateTime')->fieldLabels(false))));
     $info->setDescription(_t('EventManagement.EMAIL_CONFIRM_INFO_NOTE', 'This message is displayed to users to let them know they need to confirm their registration.'));
     $limit->setDescription(_t('EventManagement.CONFIRM_TIME_LIMIT_NOTE', 'The time limit to conform registration, in seconds. Set to 0 for no limit.'));
     return $fields;
 }
 /**
  * Overwrites SiteTree.getCMSFields.
  *
  * This method creates a customised CMS form for back-end user.
  *
  * @return fieldset
  */
 function getCMSFields()
 {
     Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
     Requirements::javascript('openlayers/javascript/ollayeradmin.js');
     $fields = parent::getCMSFields();
     $fields->removeFieldsFromTab("Root.Main", array("Url", "DisplayPriority", "Cluster", "Enabled", "Visible", "Queryable", "ogc_name", "ogc_map", "ogc_transparent"));
     $geometryType = $fields->fieldByName("Root.Main.GeometryType");
     $opacity = $fields->fieldByName("Root.Main.Opacity");
     $LayerCategory = $fields->fieldByName("Root.Main.LayerType");
     $fields->removeFieldFromTab("Root.Main", "GeometryType");
     $fields->removeFieldFromTab("Root.Main", "Opacity");
     $fields->removeFieldFromTab("Root.Main", "LayerType");
     $ogc_format = $fields->fieldByName("Root.Main.ogc_format");
     $fields->removeFieldFromTab("Root.Main", "ogc_format");
     $LayerType = $fields->fieldByName("Root.Main.Type");
     $fields->removeFieldFromTab("Root.Main", "Type");
     $reducedLayerFieldObject = $fields->fieldByName("Root.Main.ReducedLayer");
     $fields->removeFieldFromTab("Root.Main", "ReducedLayer");
     $fullOGCNameFieldObject = $fields->fieldByName("Root.Main.full_ogc_name");
     $fields->removeFieldFromTab("Root.Main", "full_ogc_name");
     $clusterPopupHeader = $fields->fieldByName("Root.Main.ClusterPopupHeader");
     $clusterAttributes = $fields->fieldByName("Root.Main.ClusterAttributes");
     $baselayer = $fields->fieldByName("Root.Main.Baselayer");
     $fields->removeFieldFromTab("Root.Main", "Baselayer");
     $styleMaps = $fields->fieldByName("Root.Main.StyleMapID");
     $fields->removeFieldFromTab("Root.Main", "StyleMapID");
     $fields->removeFieldFromTab("Root.Main", "ClusterPopupHeader");
     $fields->removeFieldFromTab("Root.Main", "ClusterAttributes");
     $XMLWhitelist = $fields->fieldByName("Root.Main.XMLWhitelist");
     $Labels = $fields->fieldByName("Root.Main.Labels");
     $SinglePopupHeader = $fields->fieldByName("Root.Main.SinglePopupHeader");
     $fields->removeFieldFromTab("Root.Main", "XMLWhitelist");
     $fields->removeFieldFromTab("Root.Main", "Labels");
     $fields->removeFieldFromTab("Root.Main", "SinglePopupHeader");
     $wmsCompositeField = new CustomCompositeField(new LiteralField("WMSLabel", "<br /><h3>OGC WMS Configuration</h3>"), $baselayer, $opacityField = new OpacityNumericField('Opacity', 'Opacity', $this->Opacity), $ogc_format, $OGCTransparencyField = new CheckboxField("ogc_transparent", "Transparency"));
     $wmsCompositeField->addClassName('wmscomposite');
     $wmsCompositeField->addClassName('wmsUntiledcomposite');
     $wmsCompositeField->addClassName('ogccomposite');
     $baselayer->setDescription("Each map must have one base layer.");
     $opacityField->setDescription("Define layer's opacity, use number between 0.0 (fully transparent) to 1.0 (not transparent).<br>50% opacity can be entered as 0.5.");
     $ogc_format->setDescription("Defines the MIME/Type for getmap requests.");
     $OGCTransparencyField->setDescription("Use this flag if the layer shall have alpha channel, if available.");
     $wfsCompositeField = new CustomCompositeField(new LiteralField("WFSLabel", "<br /><h3>OGC WFS Configuration</h3>"), $styleMaps, $reducedLayerFieldObject, $FullLayerName = new TextField("full_ogc_name", "Detailed Layer Name"), $ClusterField = new CheckboxField("Cluster", "Cluster"));
     $wfsCompositeField->addClassName('wfscomposite');
     $wfsCompositeField->addClassName('ogccomposite');
     $styleMaps->setDescription("Define the render style of the vector layer. Use Style Maps admin to define those styles.<br/>If no style is selected, the layer will be rendered with a default style.");
     $reducedLayerFieldObject->setDescription("Enable this if the vector layer is very large and the layer rendered is only a subset of the available <br/>attributes. The Detailed Layer Name field defines the OGC WFS layer which will be used to<br/>retrieve all attribute data, i.e. when the user clicks on a feature.");
     $FullLayerName->setDescription("Define a second WFS layer which will be used to retrieve attribute data from a seelcted feature.");
     $ClusterField->setDescription("Cluster can be applied ideally for point layers and group large datasets to cluster points.");
     //
     $fields->addFieldsToTab("Root.Main", array(new CompositeField(new LiteralField("OGCLabel", "<h2>Display Settings</h2>"), $EnabledField = new CheckboxField("Enabled", "Enabled"), $VisibleField = new CheckboxField("Visible", "Visible"), $geometryType, $LayerCategory, $QueryableField = new CheckboxField("Queryable", "Queryable"), $DisplayPriorityField = new NumericField("DisplayPriority", "Draw Priority")), new CompositeField(new LiteralField("OGCSettings", "<h2>OGC Server Settings</h2>"), new TextField("Url", "URL"), $mapParameterField = new TextField("ogc_map", "Map filename"), $LayerType, $LayerNameField = new TextField("ogc_name", "Layer Name")), $wmsCompositeField, $wfsCompositeField));
     $mapParameterField->setDescription("Optional: Path to UMN Mapserver mapfile.");
     $LayerType->setDescription('Define the source of data and its behaviour on the map. The URL will be appended as a <br/>vendor parameter to each OGC request.') . $EnabledField->setDescription("Flag if the layer is shown and used on the map.");
     $DisplayPriorityField->setDescription("Higher numbered layers will be drawn on top or lower numbered layers.");
     $LayerCategory->setDescription("Use layer type to define its behaviour: <br/>Overlay: selectable, background: static data, contextual: base map.");
     $VisibleField->setDescription("Sets the default state of the map if it is visible or hidden.");
     $QueryableField->setDescription("Sets the behaviour is the user can query items on the map for this layer.");
     $LayerNameField->setDescription("Use the OGC layer name as it appears in the GetCapabilities XML document.");
     $fields->addFieldsToTab("Root.MapPopup", array(new CheckboxField("UseTemplateForPopupWindow", "Use SilverStripe HTML templates"), new LiteralField("divPopupAttributes1", "<div class='divAttributesTemplate'>"), new LiteralField("label01", "<h3>Popup Window - Single Item</h3>"), new TextField("SinglePopupHeader", "Popup Header"), new LiteralField("SinglePopupHeader_description", "<strong>Popup Header</strong>: Static text line for popup header for this layer, i.e., '<strong><em>Selected Item:</em></strong>)'. If no value is provided, the layer title will be shown instead.<br/><br/>"), new TextField("XMLWhitelist", "Attributes"), new LiteralField("XMLWhitelist_description", "<strong>Attributes</strong>: comma separated list of attributes (available via the OGC interface).<br/><br/>"), new TextField("Labels", "Labels for Attributes"), new LiteralField("Labels_description", "<strong>Attributes</strong>: comma separated list of lables for the attributes (see Attributes).<br/><br/>"), new LiteralField("label02", "<h3>Popup Window - Multiple Items</h3>"), new TextField("ClusterPopupHeader", "Popup Header"), new LiteralField("ClusterPopupHeader_description", "<strong>Attributes</strong>: Text line for cluster popup header, i.e., 'There are \$items.TotalItems Sites'></strong>).<br/><br/>"), new TextField("ClusterAttributes", "Attributes"), new LiteralField("ClusterAttributes_description", "<strong>Attributes</strong>: comma separated list of lables for the attributes (see Attributes).<br/><br/>"), new LiteralField("divPopupAttributes2", "</div>"), new LiteralField("divPopupTemplate1", "<div class='divPopupTemplate'>"), new LiteralField("label04", "<h3>Popup Window</h3>"), new TextareaField('Popup_SingleInformation', 'Template - Single Item', $this->Popup_SingleInformation), new TextareaField('Popup_ClusterInformation', 'Template - Cluster Items', $this->Popup_ClusterInformation), new LiteralField("divPopupTemplate2", "</div>"), new LiteralField("label03", "<h3>Available Attributes (WFS layers only)</h3>"), new LiteralField('describeFeatureType', "<a href='#' class='describeFeatureType' data-id='" . $this->ID . "' onclick='return false;'>List  Labels</a>"), new LiteralField('featureTypeAttributes', "<div id='featureTypeAttributes'><ul><li>Not loaded...</li></ul></div>")));
     return $fields;
 }