public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', new HTMLEditorField('VisaInformation', 'Visa Information')); $fields->addFieldToTab('Root.Main', new HTMLEditorField('TravelSupport', 'Travel Support')); $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('CityIntro', 'City Intro')); $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('AboutTheCity', 'About The City')); $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('Locals', 'In The Words Of The Locals')); $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('GettingAround', 'Getting Around')); $fields->addFieldsToTab('Root.CityInfo', new TextField('HostCityLat', 'City Latitude (Map Center)')); $fields->addFieldsToTab('Root.CityInfo', new TextField('HostCityLng', 'City Longitude (Map Center)')); $fields->addFieldToTab('Root.MapLocations', new HTMLEditorField('LocationsTextHeader', 'Intro Text')); $fields->addFieldToTab('Root.MapLocations', new HTMLEditorField('OtherLocations', 'Other Locations')); if ($this->ID) { // Summit Question Categories $fields->addFieldsToTab('Root.Main', $venue_back = new UploadField('VenueBackgroundImage', 'Venue Background Image')); $venue_back->setFolderName('summits/locations'); $venue_back->setAllowedMaxFileNumber(1); $venue_back->setAllowedFileCategories('image'); $fields->addFieldsToTab('Root.Main', new TextField('VenueBackgroundImageHero', 'Venue Background Image Author')); $fields->addFieldsToTab('Root.Main', new TextField('VenueBackgroundImageHeroSource', 'Venue Background Image Author Url')); $fields->addFieldsToTab('Root.CityInfo', $about_back = new UploadField('AboutTheCityBackgroundImage', 'About The City Background Image')); $about_back->setFolderName('summits/location/about'); $about_back->setAllowedMaxFileNumber(1); $about_back->setAllowedFileCategories('image'); $fields->addFieldsToTab('Root.CityInfo', new TextField('AboutTheCityBackgroundImageHero', 'About The City Background Image Author')); $fields->addFieldsToTab('Root.CityInfo', new TextField('AboutTheCityBackgroundImageHeroSource', 'About The City Background Image Author Source Url')); } $fields->addFieldToTab('Root.Main', new TextField('VenueTitleText', 'Venue Title Text')); $fields->addFieldToTab('Root.Main', new TextField('AirportsTitle', 'Airports Title')); $fields->addFieldToTab('Root.Main', new TextField('AirportsSubTitle', 'Airports SubTitle')); $fields->addFieldToTab('Root.Main', new TextField('CampusGraphic', 'URL of image of campus graphic')); return $fields; }
public function updateCMSFields(FieldList $fields) { // Main $fields->addFieldToTab('Root.Main', $gaCode = new TextField('GACode', 'Google Analytics account')); $gaCode->setRightTitle('Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)'); $fields->addFieldToTab('Root.Main', $showTitle = new CheckboxField('ShowTitleInHeader', 'Show title in header'), 'Tagline'); /* @var $logoField UploadField */ $logoField = new UploadField('Logo', 'Large logo, to appear in the header.'); $logoField->setAllowedFileCategories('image'); $logoField->setConfig('allowedMaxFileNumber', 1); $mobileLogoField = new UploadField('LogoMobile', 'Mobile logo, to appear in the header.'); $mobileLogoField->setAllowedFileCategories('image'); $mobileLogoField->setConfig('allowedMaxFileNumber', 1); $fields->addFieldToTab('Root.Main', $logoField); $fields->addFieldToTab('Root.Main', $this->getLogoOffSetField()); $fields->addFieldToTab('Root.Main', $mobileLogoField); $fields->addFieldToTab('Root.Main', $this->getMobileLogoOffSetField()); //Footer $fields->addFieldToTab('Root.Footer', $footerLogoField = new UploadField('FooterLogo', 'Footer logo, to appear in the bottom right.')); $footerLogoField->setAllowedFileCategories('image'); $footerLogoField->setConfig('allowedMaxFileNumber', 1); $fields->addFieldToTab('Root.Footer', $footerLink = new TextField('FooterLogoLink', 'Footer Logo link')); $footerLink->setRightTitle('Please include the protocol (ie, http:// or https://) unless it is an internal link.'); $fields->addFieldToTab('Root.Footer', new TextField('FooterLogoDescription', 'Footer Logo description')); $fields->addFieldToTab('Root.Footer', new TreeMultiselectField('FooterLinks', 'Footer Links', 'SiteTree')); $fields->addFieldToTab('Root.Footer', new TextField('Copyright', 'Copyright')); }
function getCMSFields() { $_REQUEST["CompanyId"] = $this->ID; $large_logo = new UploadField('BigLogo', 'Large Company Logo'); $large_logo->setFolderName('companies/main_logo'); $large_logo->setAllowedFileCategories('image'); $small_logo = new UploadField('Logo', 'Small Company Logo'); $small_logo->setAllowedFileCategories('image'); //logo validation rules $large_logo_validator = new Upload_Image_Validator(); $large_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg')); $large_logo_validator->setAllowedMaxImageWidth(500); $large_logo->setValidator($large_logo_validator); $small_logo_validator = new Upload_Image_Validator(); $small_logo_validator->setAllowedExtensions(array('jpg', 'png', 'jpeg')); $small_logo_validator->setAllowedMaxImageWidth(200); $small_logo->setValidator($small_logo_validator); $fields = new FieldList(new TabSet($name = "Root", new Tab($title = 'Company', new HeaderField("Company Data"), new TextField('Name', 'Company Name'), new TextField('URLSegment', 'Unique page name for this company profile (ie: company-name)'), new TextField('URL', 'Company Web Address (URL)'), $level = new DropDownField('MemberLevel', 'OpenStack Foundation Member Level', $this->dbObject('MemberLevel')->enumValues()), new ColorField("Color", "Company Color"), new CheckboxField('DisplayOnSite', 'List this company on openstack.org'), new CheckboxField('Featured', 'Include this company in featured companies area'), new LiteralField('Break', '<hr/>'), $this->canEditLogo() ? $large_logo : new LiteralField('Space', '<br/>'), $this->canEditLogo() ? $small_logo : new LiteralField('Space', '<br/>'), new TextField('Industry', 'Industry (<4 Words)'), new HtmlEditorField('Description', 'Company Description'), new HtmlEditorField('Contributions', 'How you are contributing to OpenStack (<150 words)'), new HtmlEditorField('Products', 'Products/Services Related to OpenStack (<100 words)'), new HtmlEditorField('Overview', 'Company Overview'), new TextField('CommitmentAuthor', 'Commitment Author (Optional)'), new HtmlEditorField('Commitment', "OpenStack Commitment"), new LiteralField('Break', '<hr/>'), new TextField('ContactEmail', 'Best Contact email address (optional)')))); $level->setEmptyString('-- Choose One --'); if ($this->ID > 0) { $admin_list = $this->Administrators()->sort('ID'); $query = $admin_list->dataQuery(); $query->groupby('MemberID'); $admin_list = $admin_list->setDataQuery($query); $config = GridFieldConfig_RelationEditor::create(); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('FirstName' => 'First Name', 'Surname' => 'Last Name', 'Email' => 'Email', 'DDLAdminSecurityGroup' => 'Security Group')); $admins = new GridField('Administrators', 'Company Administrators', $admin_list, $config); $contracts = new GridField("Contracts", "Contracts", $this->Contracts(), GridFieldConfig_RecordEditor::create(10)); $fields->addFieldsToTab('Root.Administrators', array(new HeaderField("Companies Administrators"), $admins)); $fields->addFieldsToTab('Root.Contracts', array(new HeaderField("Companies Contracts"), $contracts)); } return $fields; }
public function scaffoldFormField($title = null, $params = null) { if (empty($this->object)) { return null; } $relationName = substr($this->name, 0, -2); $hasOneClass = $this->object->hasOneComponent($relationName); if (empty($hasOneClass)) { return null; } $hasOneSingleton = singleton($hasOneClass); if ($hasOneSingleton instanceof File) { $field = new UploadField($relationName, $title); if ($hasOneSingleton instanceof Image) { $field->setAllowedFileCategories('image/supported'); } return $field; } // Build selector / numeric field $titleField = $hasOneSingleton->hasField('Title') ? "Title" : "Name"; $list = DataList::create($hasOneClass); // Don't scaffold a dropdown for large tables, as making the list concrete // might exceed the available PHP memory in creating too many DataObject instances if ($list->count() < 100) { $field = new DropdownField($this->name, $title, $list->map('ID', $titleField)); $field->setEmptyString(' '); } else { $field = new NumericField($this->name, $title); } return $field; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', $image = new UploadField('ProductImage', 'Upload an image to use for this product (max 1 in total)'), 'Price'); $image->setFolderName('products'); $image->setAllowedFileCategories('image'); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Image Upload', $uploadHeroField = new UploadField('BackgroundImage', 'Please upload an image to be used as the Background Image for your Text Slice.')); $uploadHeroField->setFolderName('TextSlice'); $uploadHeroField->setAllowedFileCategories('image'); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Image Upload', $uploadHeroField = new UploadField('HeroImage', 'Please upload an image to be used as your Hero Image. Remember, this is usually the first thing your visitors will see.')); $uploadHeroField->setFolderName('Hero'); $uploadHeroField->setAllowedFileCategories('image'); return $fields; }
public function getCMSFields() { $fields = new FieldList(); $fields->add($upload_0 = new UploadField('Image', 'Photo')); $upload_0->setFolderName('summits/overview/networking'); $upload_0->setAllowedMaxFileNumber(1); $upload_0->setAllowedFileCategories('image'); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('SortID'); $fields->removeByName('GalleryAlbum'); $fields->addFieldToTab('Root.Main', $uploadField = new UploadField('GalleryImage', 'Please upload an image to showcase in your gallery.')); // $uploadField->setFolderName('Gallery/' . $this->Gallery()->Title()); // $album = $this->GalleryAlbum()->Title(); $uploadField->setFolderName('Gallery'); $uploadField->setAllowedFileCategories('image'); return $fields; }
public function getCMSFields() { $fields = new FieldList(); $image_field = new UploadField("Image", "Staff Image"); $image_field->setAllowedFileCategories('image'); $fields->push(new TextField('Name', 'Staff Name')); $fields->push(new TextField('Title', 'Staff Title')); $fields->push($image_field); $fields->push(new TextField('Caption', 'Inside Picture Caption')); $fields->push(new HTMLEditorField('Bio', 'Staff Bio')); $this->extend('updateCMSFields', $fields); return $fields; }
function getCMSFields() { $f = parent::getCMSFields(); $f->removeByName(array('SortOrder', 'Image')); $f->removeByName('SortOrder'); $f->addFieldsToTab('Root.Main', HtmlEditorField::create("Description")->setRows(15)); $f->addFieldsToTab('Root.Image', $HeroImage = new UploadField('Image', 'Please upload a Hero image <span>(max. 1 files)</span>')); $HeroImage->setAllowedFileCategories('image'); $HeroImage->setAllowedMaxFileNumber(1); $HeroImage->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif')); $HeroImage->setConfig('allowedMaxFileNumber', 1); $HeroImage->setFolderName('Uploads/Distributors/' . $this->URLSegment); return $f; }
public function getCMSFields() { $fields = new FieldList(); $image = new UploadField('Thumbnail', 'Thumbnail'); $image->setFolderName('marketing'); $image->setAllowedFileCategories('image'); $doc = new UploadField('Doc', 'Doc'); $doc->setFolderName('marketing'); $doc->getValidator()->setAllowedMaxFileSize(40 * 1024 * 1024); $fields->push(new TextField('Label')); $fields->push(new TextField('SortOrder')); $fields->push($doc); $fields->push($image); return $fields; }
public function updateCMSFields(FieldList $fields) { $fields->addFieldToTab('Root.Logo Upload', $uploadHeaderField = new UploadField('HeaderImage', 'Please upload the logo you would like to display in your header.')); $uploadHeaderField->setFolderName('Header'); $uploadHeaderField->setAllowedFileCategories('image'); $fields->addFieldToTab('Root.Logo Upload', $uploadHeroField = new UploadField('FooterLogo', 'Please upload the logo you would like to display in your header.')); $uploadHeroField->setFolderName('Footer'); $uploadHeroField->setAllowedFileCategories('image'); $fields->addFieldToTab("Root.Contact Details", new TextField("Address", "Physical Address")); $fields->addFieldToTab("Root.Contact Details", new TextField("Phone", "Phone Number")); $fields->addFieldToTab("Root.Contact Details", new TextField("Email", "Email Address")); $fields->addFieldToTab("Root.Social Media", new TextField("Facebook", "Facebook")); $fields->addFieldToTab("Root.Social Media", new TextField("Twitter", "Twitter")); $fields->addFieldToTab("Root.Social Media", new TextField("Linkedin", "Linkedin")); $fields->addFieldToTab("Root.Social Media", new TextField("Instagram", "Instagram")); }
public function getCMSFields() { $fields = new FieldList(); $imageTab = new Tab('Image'); $seoTab = new Tab('Metadata'); $tabset = new TabSet("Root", $imageTab, $seoTab); $fields->push($tabset); $image_field = new UploadField("FullsizeImage", "Image"); $image_field->setAllowedFileCategories('image'); $imageTab->push($image_field); $imageTab->push(new TextField("Alt", "Image Alt Tag")); $imageTab->push(new TextField("Title")); $imageTab->push(new HTMLEditorField("Description")); $seoTab->push(new TextField("MetaTitle", "Meta Title")); $seoTab->push(new TextField("MetaKeywords", "Meta Keywords")); $seoTab->push(new TextAreaField("MetaDescription", "Meta Description")); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->add(new TextField('AddEntityText', 'Add Text')); $fields->add(new TextField('DeleteEntityText', 'Delete Text')); $fields->add(new TextField('EditEntityText', 'Edit Text')); $icon = new UploadField('EntityIcon', 'Upload Entity Icon'); $icon->setCanAttachExisting(false); $icon->setAllowedMaxFileNumber(1); $icon->setAllowedFileCategories('image'); $icon->setFolderName('survey-builder'); if ($this->ID > 0) { $fields->add($icon); $id = (int) $this->ID; $parent_id = (int) $this->SurveyTemplateID; $fields->add($ddl_entity = new DropdownField('EntityID', 'Please choose an entity to hold', EntitySurveyTemplate::get()->where(" (OwnerID = 0 OR OwnerID = {$id} ) AND ParentID = {$parent_id} ")->map("ID", "EntityName"))); $ddl_entity->setEmptyString('-- Please Select --'); } return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', new HTMLEditorField('VisaInformation', 'Visa Information')); $fields->addFieldToTab('Root.Main', new HTMLEditorField('TravelSupport', 'Travel Support')); $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('CityIntro', 'City Intro')); $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('AboutTheCity', 'About The City')); $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('Locals', 'In The Words Of The Locals')); $fields->addFieldToTab('Root.CityInfo', new HTMLEditorField('GettingAround', 'Getting Around')); $fields->addFieldsToTab('Root.CityInfo', new TextField('HostCityLat', 'City Latitude (Map Center)')); $fields->addFieldsToTab('Root.CityInfo', new TextField('HostCityLng', 'City Longitude (Map Center)')); $fields->addFieldToTab('Root.MapLocations', new HTMLEditorField('LocationsTextHeader', 'Intro Text')); $fields->addFieldToTab('Root.MapLocations', new HTMLEditorField('OtherLocations', 'Other Locations')); if ($this->ID) { // Summit Question Categories $LocationFields = singleton('SummitLocation')->getCMSFields(); $config = GridFieldConfig_RelationEditor::create(); $config->getComponentByType('GridFieldDetailForm')->setFields($LocationFields); $config->addComponent(new GridFieldSortableRows('Order')); $gridField = new GridField('Locations', 'Locations', $this->Locations(), $config); $fields->addFieldToTab('Root.MapLocations', $gridField); $fields->addFieldsToTab('Root.Main', $venue_back = new UploadField('VenueBackgroundImage', 'Venue Background Image')); $venue_back->setFolderName('summits/locations'); $venue_back->setAllowedMaxFileNumber(1); $venue_back->setAllowedFileCategories('image'); $fields->addFieldsToTab('Root.Main', new TextField('VenueBackgroundImageHero', 'Venue Background Image Author')); $fields->addFieldsToTab('Root.Main', new TextField('VenueBackgroundImageHeroSource', 'Venue Background Image Author Url')); $fields->addFieldsToTab('Root.CityInfo', $about_back = new UploadField('AboutTheCityBackgroundImage', 'About The City Background Image')); $about_back->setFolderName('summits/location/about'); $about_back->setAllowedMaxFileNumber(1); $about_back->setAllowedFileCategories('image'); $fields->addFieldsToTab('Root.CityInfo', new TextField('AboutTheCityBackgroundImageHero', 'About The City Background Image Author')); $fields->addFieldsToTab('Root.CityInfo', new TextField('AboutTheCityBackgroundImageHeroSource', 'About The City Background Image Author Source Url')); } $fields->addFieldToTab('Root.Main', new TextField('VenueTitleText', 'Venue Title Text')); $fields->addFieldToTab('Root.Main', new TextField('AirportsTitle', 'Airports Title')); $fields->addFieldToTab('Root.Main', new TextField('AirportsSubTitle', 'Airports SubTitle')); $fields->addFieldToTab('Root.Main', new TextField('CampusGraphic', 'URL of image of campus graphic')); return $fields; }
/** * Creates our social sharing upload field * * @since version 1.0.0 * * @return object Return the Social image UploadField object **/ private function SharingImage() { $image = new UploadField('SocialImage'); $image->getValidator()->setAllowedMaxFileSize($this->getMaxSocialImageSize()); $image->setFolderName(Config::inst()->get('SEO_Extension', 'social_image_folder')); $image->setAllowedFileCategories('image'); return $image; }
public static function getUploadForm($file, $parentClass, $parentId, $parentField) { if ($file instanceof File && class_exists($parentClass) && is_subclass_of($parentClass, "DataObject")) { $parent = $parentClass::get()->byId($parentId); $fields = new FieldList($uploadField = new UploadField($parentField, 'Upload', $parent)); $uploadField->setCanAttachExisting(false); // Block access to Silverstripe assets library $uploadField->setCanPreviewFolder(false); // Don't show target filesystem folder on upload field $uploadField->relationAutoSetting = false; // Prevents the form thinking the GalleryPage is the underlying object $uploadField->setFolderName('Address Book'); $uploadField->setAllowedMaxFileNumber(1); if ($file instanceof Image) { $uploadField->setAllowedFileCategories('image'); } $actions = new FieldList(new FormAction('submit', 'Save')); $from = new Form(Controller::curr(), 'feFileUploadForm', $fields, $actions, null); $urlParams = array('feclass' => $parentClass, 'fefield' => $parentField, 'feid' => $parentId, 'filesUpload' => true, 'fefileid' => $file->ID, 'fefileclass' => $file->ClassName); // feclass: parentClass, // fefield: parentField, // feid: parentId, // feisUpload: true, // value: "{feclass: " + objClass + ",feid: " + objId + "}" // echo http_build_query($urlParams) . "\n"; $from->setFormAction('home/feFileUploadForm?' . http_build_query($urlParams)); return $from; } }
public function updateCMSFields(FieldList $f) { //clear all fields $oldFields = $f->toArray(); foreach ($oldFields as $field) { $f->remove($field); } $_REQUEST['SummitID'] = $this->owner->ID; $f->add($rootTab = new TabSet("Root", $tabMain = new Tab('Main'))); $summit_time_zone = null; if ($this->owner->TimeZone) { $time_zone_list = timezone_identifiers_list(); $summit_time_zone = $time_zone_list[$this->owner->TimeZone]; } if ($this->owner->RandomVotingLists()->exists()) { $f->addFieldToTab('Root.Main', HeaderField::create('The presentations in this summit have been randomised for voting', 4)); } $f->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $f->addFieldToTab('Root.Main', $link = new TextField('Link', 'Summit Page Link')); $link->setDescription('The link to the site page for this summit. Eg: <em>/summit/vancouver-2015/</em>'); $f->addFieldToTab('Root.Main', new CheckboxField('Active', 'This is the active summit')); $f->addFieldToTab('Root.Main', $date_label = new TextField('DateLabel', 'Date label')); $date_label->setDescription('A readable piece of text representing the date, e.g. <em>May 12-20, 2015</em> or <em>December 2016</em>'); $f->addFieldToTab('Root.Main', $registration_link = new TextField('RegistrationLink', 'Registration Link')); $registration_link->setDescription('Link to the site where tickets can be purchased.'); $f->addFieldsToTab('Root.Dates', $ddl_timezone = new DropdownField('TimeZone', 'Time Zone', DateTimeZone::listIdentifiers())); $ddl_timezone->setEmptyString('-- Select a Timezone --'); if ($summit_time_zone) { $f->addFieldToTab('Root.Dates', new HeaderField("All dates below are in <span style='color:red;'>{$summit_time_zone}</span> time.")); } else { $f->addFieldToTab('Root.Dates', new HeaderField("All dates below in the timezone of the summit's venue.")); } $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SummitBeginDate', "When does the summit begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SummitEndDate', "When does the summit end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('StartShowingVenuesDate', "When do you begin showing venues?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SubmissionBeginDate', "When do submissions begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SubmissionEndDate', "When do submissions end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('VotingBeginDate', "When does voting begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('VotingEndDate', "When does voting end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SelectionBeginDate', "When do selections begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('SelectionEndDate', "When do selections end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('RegistrationBeginDate', "When does registration begin?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DatetimeField('RegistrationEndDate', "When does registration end?")); $date->getDateField()->setConfig('showcalendar', true); $date->getDateField()->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Dates', $date = new DateField('ScheduleDefaultStartDate', "Default Start Date to show on schedule page?")); $date->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldsToTab('Root.Main', new NumericField('MaxSubmissionAllowedPerUser', 'Max. Submission Allowed Per User')); $logo_field = new UploadField('Logo', 'Logo'); $logo_field->setAllowedMaxFileNumber(1); $logo_field->setAllowedFileCategories('image'); $logo_field->setFolderName('summits/logos/'); $logo_field->getValidator()->setAllowedMaxFileSize(1024 * 1024 * 1); $f->addFieldToTab('Root.Main', $logo_field); $f->addFieldToTab('Root.Main', new TextField('ComingSoonBtnText', 'Coming Soon Btn Text')); $f->addFieldToTab('Root.Main', new TextField('ExternalEventId', 'Eventbrite Event Id')); if ($this->owner->ID > 0) { $summit_id = $this->owner->ID; // tracks $config = GridFieldConfig_RecordEditor::create(25); $categories = new GridField('Categories', 'Presentation Categories', $this->owner->getCategories(), $config); $f->addFieldToTab('Root.Presentation Categories', $categories); $config = GridFieldConfig_RelationEditor::create(25); $config->removeComponentsByType(new GridFieldDataColumns()); $config->removeComponentsByType(new GridFieldDetailForm()); $config->addComponent(new GridFieldUpdateDefaultCategoryTags()); $default_tags = new GridField('CategoryDefaultTags', 'Category Default Tags', $this->owner->CategoryDefaultTags(), $config); $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter'); $completer->setResultsFormat('$Tag'); $completer->setSearchFields(array('Tag')); $completer->setSearchList(Tag::get()); $editconf = new GridFieldDetailForm(); $editconf->setFields(FieldList::create(TextField::create('Tag', 'Tag'), DropdownField::create('ManyMany[Group]', 'Group', array('topics' => 'Topics', 'speaker' => 'Speaker', 'openstack projects mentioned' => 'OpenStack Projects Mentioned')))); $summaryfieldsconf = new GridFieldDataColumns(); $summaryfieldsconf->setDisplayFields(array('Tag' => 'Tag', 'Group' => 'Group')); $config->addComponent($editconf); $config->addComponent($summaryfieldsconf, new GridFieldFilterHeader()); $f->addFieldToTab('Root.Presentation Categories', $default_tags); // track groups $config = GridFieldConfig_RecordEditor::create(25); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('PresentationCategoryGroup' => 'Category Group', 'PrivatePresentationCategoryGroup' => 'Private Category Group')); $config->addComponent($multi_class_selector); $categories = new GridField('CategoryGroups', 'Category Groups', $this->owner->CategoryGroups(), $config); $f->addFieldToTab('Root.Category Groups', $categories); // locations $config = GridFieldConfig_RecordEditor::create(); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('SummitVenue' => 'Venue', 'SummitHotel' => 'Hotel', 'SummitAirport' => 'Airport', 'SummitExternalLocation' => 'External Location')); $config->addComponent($multi_class_selector); $config->addComponent($sort = new GridFieldSortableRows('Order')); $gridField = new GridField('Locations', 'Locations', $this->owner->Locations()->where("ClassName <> 'SummitVenueRoom' "), $config); $f->addFieldToTab('Root.Locations', $gridField); // types $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldAddDefaultSummitTypes()); $gridField = new GridField('SummitTypes', 'SummitTypes', $this->owner->Types(), $config); $f->addFieldToTab('Root.SummitTypes', $gridField); // event types $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldAddDefaultEventTypes()); $gridField = new GridField('EventTypes', 'EventTypes', $this->owner->EventTypes(), $config); $f->addFieldToTab('Root.EventTypes', $gridField); //schedule $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->removeComponentsByType('GridFieldDeleteAction'); $gridField = new GridField('Schedule', 'Schedule', $this->owner->Events()->filter('Published', true)->sort(array('StartDate' => 'ASC', 'EndDate' => 'ASC')), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Schedule', $gridField); $config->addComponent(new GridFieldPublishSummitEventAction()); // events $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Type'); $gridField = new GridField('Events', 'Events', $this->owner->Events()->filter('ClassName', 'SummitEvent'), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Events', $gridField); //track selection list presentations $config = GridFieldConfig_RecordEditor::create(25); $gridField = new GridField('TrackChairsSelectionLists', 'TrackChairs Selection Lists', SummitSelectedPresentationList::get()->filter('ListType', 'Group')->where(' CategoryID IN ( SELECT ID FROM PresentationCategory WHERE SummitID = ' . $summit_id . ')'), $config); $f->addFieldToTab('Root.TrackChairs Selection Lists', $gridField); // attendees $config = GridFieldConfig_RecordEditor::create(25); $gridField = new GridField('Attendees', 'Attendees', $this->owner->Attendees(), $config); $f->addFieldToTab('Root.Attendees', $gridField); //tickets types $config = GridFieldConfig_RecordEditor::create(25); $gridField = new GridField('SummitTicketTypes', 'Ticket Types', $this->owner->SummitTicketTypes(), $config); $f->addFieldToTab('Root.TicketTypes', $gridField); // promo codes $config = GridFieldConfig_RecordEditor::create(50); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('SpeakerSummitRegistrationPromoCode' => 'Speaker Promo Code')); $config->addComponent($multi_class_selector); $promo_codes = new GridField('SummitRegistrationPromoCodes', 'Registration Promo Codes', $this->owner->SummitRegistrationPromoCodes(), $config); $f->addFieldToTab('Root.RegistrationPromoCodes', $promo_codes); // speakers $config = GridFieldConfig_RecordEditor::create(25); $gridField = new GridField('Speakers', 'Speakers', $this->owner->Speakers(false), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Bio" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Speakers', $gridField); // presentations $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Type'); $gridField = new GridField('Presentations', 'Presentations', $this->owner->Presentations()->where(" Title IS NOT NULL AND Title <>'' "), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Presentations', $gridField); // push notifications $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Channel' => 'Channel', 'Message' => 'Message', 'Owner.FullName' => 'Owner', 'IsSent' => 'Is Sent?', 'SentDate' => 'Sent Date')); $config->getComponentByType('GridFieldDetailForm')->setItemRequestClass('GridFieldDetailFormPushNotification'); $gridField = new GridField('Notifications', 'Notifications', $this->owner->Notifications(), $config); $f->addFieldToTab('Root.PushNotifications', $gridField); //entity events $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent(new GridFieldWipeDevicesDataAction()); $config->addComponent(new GridFieldDeleteAllSummitEntityEventsAction()); $config->removeComponentsByType('GridFieldAddNewButton'); $gridField = new GridField('EntityEvents', 'EntityEvents', $this->owner->EntityEvents(), $config); $f->addFieldToTab('Root.EntityEvents', $gridField); //TrackChairs $config = GridFieldConfig_RecordEditor::create(25); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $gridField = new GridField('TrackChairs', 'TrackChairs', $this->owner->TrackChairs(), $config); $f->addFieldToTab('Root.TrackChairs', $gridField); //RSVP templates $config = GridFieldConfig_RecordEditor::create(40); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $gridField = new GridField('RSVPTemplates', 'RSVPTemplates', $this->owner->RSVPTemplates(), $config); $f->addFieldToTab('Root.RSVPTemplates', $gridField); } }
public function updateCMSFields(FieldList $fields) { $fields->addFieldToTab(CrackerjackModule::get_config_setting(__CLASS__, 'tab_name'), $uploadField = new UploadField(self::FieldName, $this->fieldLabel(self::FieldName, $this()->i18n_singular_name() . ' images'))); $uploadField->setAllowedFileCategories(array('image')); }
public function getCMSFields() { $fields = parent::getCMSFields(); // Optional Sponsor Alert $sponsorAlertField = new TextField('SponsorAlert', 'Sponsor Alert'); $fields->addFieldToTab('Root.Main', $sponsorAlertField); $fields->addFieldsToTab('Root.Main', new HtmlEditorField('SponsorIntro', 'Sponsor Intro Text')); $fields->addFieldsToTab('Root.Main', new HtmlEditorField('HowToSponsorContent', 'How To Sponsor (Bottom)')); $fields->addFieldsToTab('Root.Main', new HtmlEditorField('VenueMapContent', 'Venue Map Content')); // Sponsor Steps Editor $sponsorStepsField = new HTMLEditorField('SponsorSteps', 'Steps To Become A Sponsor'); $fields->addFieldToTab('Root.Main', $sponsorStepsField, 'Content'); //call for sponsorship dates $start_date = new DatetimeField('CallForSponsorShipStartDate', 'Call For SponsorShip - Start Date'); $end_date = new DatetimeField('CallForSponsorShipEndDate', 'Call For SponsorShip - End Date'); $start_date->getDateField()->setConfig('showcalendar', true); $start_date->setConfig('dateformat', 'dd/MM/yyyy'); $end_date->getDateField()->setConfig('showcalendar', true); $end_date->setConfig('dateformat', 'dd/MM/yyyy'); $fields->addFieldToTab('Root.Main', $start_date); $fields->addFieldToTab('Root.Main', $end_date); if ($this->ID) { //set current page id $_REQUEST["PageId"] = $this->ID; // Summit Packages $config = GridFieldConfig_RelationEditor::create(); $config->addComponent(new GridFieldSortableRows('Order')); $gridField = new GridField('SummitPackages', 'Sponsor Packages', $this->SummitPackages(), $config); $fields->addFieldToTab('Root.Packages', $gridField); // Summit Add Ons $config = GridFieldConfig_RelationEditor::create(); $config->addComponent(new GridFieldSortableRows('Order')); // Remove pagination so that you can sort all add-ons collectively $config->removeComponentsByType('GridFieldPaginator'); $config->removeComponentsByType('GridFieldPageCount'); $gridField = new GridField('SummitAddOn', 'Sponsor Add Ons', $this->SummitAddOns(), $config); $fields->addFieldToTab('Root.AddOns', $gridField); $prospectusField = new TextField('SponsorProspectus'); $fields->addFieldToTab('Root.ProspectusAndContract', $prospectusField); $contractField = new TextField('SponsorContract'); $fields->addFieldToTab('Root.ProspectusAndContract', $contractField); // sponsors $companies = new GridField('Companies', 'Sponsors', $this->Companies(), GridFieldConfig_RelationEditor::create(10)); $companies->getConfig()->removeComponentsByType('GridFieldEditButton'); $companies->getConfig()->removeComponentsByType('GridFieldAddNewButton'); $companies->getConfig()->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Name' => 'Name', "DDLSponsorshipType" => "Sponsorship Type", "InputSubmitPageUrl" => "Sponsor Link")); $fields->addFieldToTab('Root.SponsorCompanies', $companies); $fields->addFieldsToTab("Root.Main", $upload_0 = new UploadField('CrowdImage', 'Crowd Image')); $fields->addFieldsToTab("Root.Main", $upload_1 = new UploadField('ExhibitImage', 'Exhibit Image')); $upload_0->setFolderName('summits/sponsorship/backgroun'); $upload_0->setAllowedMaxFileNumber(1); $upload_0->setAllowedFileCategories('image'); $upload_1->setFolderName('summits/sponsorship/background'); $upload_1->setAllowedMaxFileNumber(1); $upload_1->setAllowedFileCategories('image'); //audience $config = GridFieldConfig_RecordEditor::create(); $config->addComponent($sort = new GridFieldSortableRows('Order')); $gridField = new GridField('AttendeesByRegion', 'Attendees By Region', $this->AttendeesByRegion(), $config); $fields->add($gridField); $config = GridFieldConfig_RecordEditor::create(); $config->addComponent($sort = new GridFieldSortableRows('Order')); $gridField = new GridField('AttendeesByRoles', 'Attendees By Roles', $this->AttendeesByRoles(), $config); $fields->add($gridField); } $fields->addFieldsToTab('Root.Audience', new CheckboxField('ShowAudience', 'Show Audience')); $fields->addFieldsToTab('Root.Audience', new HtmlEditorField('AudienceIntro', 'Intro')); $fields->addFieldsToTab('Root.Audience', new TextField('AudienceMetricsTitle', 'Metrics Title')); $fields->addFieldsToTab('Root.Audience', new TextField('AudienceTotalSummitAttendees', 'Total Summit Attendees')); $fields->addFieldsToTab('Root.Audience', new TextField('AudienceCompaniesRepresented', 'Companies Represented')); $fields->addFieldsToTab('Root.Audience', new TextField('AudienceCountriesRepresented', 'Countries Represented')); return $fields; }
public function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldsToTab('Root.Main', new HtmlEditorField('OverviewIntro', 'Overview Intro')); if ($this->ID > 0) { $fields->addFieldToTab('Root.Networking', new HtmlEditorField('NetworkingContent', 'Content')); //networking photos $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldSortableRows('Order')); $gridField = new GridField('NetworkingPhotos', 'Photos', $this->NetworkingPhotos(), $config); $fields->addFieldToTab('Root.Networking', $gridField); $fields->addFieldToTab('Root.Networking', new HtmlEditorField('NetworkingContent', 'Content')); //menu items $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldSortableRows('Order')); $gridField = new GridField('HelpMenuItems', 'Help Menu Items', $this->HelpMenuItems(), $config); $fields->addFieldToTab('Root.HelpSideBarMenu', $gridField); } $fields->addFieldsToTab('Root.Schedule', new TextField('ScheduleTitle', 'Title')); $fields->addFieldsToTab('Root.Schedule', new HtmlEditorField('ScheduleText', 'Text')); $fields->addFieldsToTab('Root.Schedule', new TextField('ScheduleUrl', 'Url')); $fields->addFieldsToTab('Root.Schedule', new TextField('ScheduleBtnText', 'Button Caption')); // Video Recap $fields->addFieldsToTab('Root.VideoRecap', new TextField('RecapTitle', 'Title')); $fields->addFieldsToTab('Root.VideoRecap', new TextField('VideoRecapCaption1', 'Caption Text 1')); $fields->addFieldsToTab('Root.VideoRecap', new TextField('VideoRecapYouTubeID1', 'YouTubeID 1')); $fields->addFieldsToTab('Root.VideoRecap', new TextField('VideoRecapCaption2', 'Caption Text 2')); $fields->addFieldsToTab('Root.VideoRecap', new TextField('VideoRecapYouTubeID2', 'YouTubeID 2')); // GrowthBox $fields->addFieldToTab("Root.GrowthBox", new HtmlEditorField('GrowthBoxTextTop', 'Text Top')); $fields->addFieldToTab("Root.GrowthBox", new HtmlEditorField('GrowthBoxTextBottom', 'Text Bottom')); $fields->addFieldsToTab("Root.GrowthBox", $upload_0 = new UploadField('GrowthBoxBackground', 'Background Image')); $fields->addFieldsToTab("Root.GrowthBox", $upload_1 = new UploadField('GrowthBoxChartLegend', 'Chart Legend (SVG)')); $fields->addFieldsToTab("Root.GrowthBox", $upload_2 = new UploadField('GrowthBoxChartLegendPng', 'Chart Legend (PNG)')); $fields->addFieldsToTab("Root.GrowthBox", $upload_3 = new UploadField('GrowthBoxChart', 'Chart (SVG)')); $fields->addFieldsToTab("Root.GrowthBox", $upload_4 = new UploadField('GrowthBoxChartPng', 'Chart (PNG)')); $upload_0->setFolderName('summits/overview'); $upload_0->setAllowedMaxFileNumber(1); $upload_0->setAllowedFileCategories('image'); $upload_0->setOverwriteWarning(false); $upload_0->getUpload()->setReplaceFile(true); $upload_1->setFolderName('summits/overview'); $upload_1->setAllowedMaxFileNumber(1); $upload_1->setAllowedExtensions(array('svg')); $upload_1->setOverwriteWarning(false); $upload_1->getUpload()->setReplaceFile(true); $upload_2->setFolderName('summits/overview'); $upload_2->setAllowedMaxFileNumber(1); $upload_2->setAllowedExtensions(array('png')); $upload_2->setOverwriteWarning(false); $upload_2->getUpload()->setReplaceFile(true); $upload_3->setFolderName('summits/overview'); $upload_3->setAllowedMaxFileNumber(1); $upload_3->setAllowedExtensions(array('svg')); $upload_3->setOverwriteWarning(false); $upload_3->getUpload()->setReplaceFile(true); $upload_4->setFolderName('summits/overview'); $upload_4->setAllowedMaxFileNumber(1); $upload_4->setAllowedExtensions(array('png')); $upload_4->setOverwriteWarning(false); $upload_4->getUpload()->setReplaceFile(true); //two main events $fields->addFieldsToTab('Root.TwoMainEvents', new TextField('TwoMainEventsTitle', 'Title')); $fields->addFieldsToTab('Root.TwoMainEvents', new TextField('EventOneTitle', 'Event One - Title')); $fields->addFieldsToTab('Root.TwoMainEvents', new TextField('EventOneSubTitle', 'Event One - SubTitle')); $fields->addFieldsToTab('Root.TwoMainEvents', new HtmlEditorField('EventOneContent', 'Event One - Content')); $fields->addFieldsToTab('Root.TwoMainEvents', new TextField('EventTwoTitle', 'Event Two - Title')); $fields->addFieldsToTab('Root.TwoMainEvents', new TextField('EventTwoSubTitle', 'Event Two - SubTitle')); $fields->addFieldsToTab('Root.TwoMainEvents', new HtmlEditorField('EventTwoContent', 'Event Two - Content')); $fields->addFieldsToTab("Root.TwoMainEvents", $upload_5 = new UploadField('EventOneLogo', 'Event Two Logo (SVG)')); $fields->addFieldsToTab("Root.TwoMainEvents", $upload_6 = new UploadField('EventOneLogoPng', 'Event Two Logo (PNG)')); $fields->addFieldsToTab("Root.TwoMainEvents", $upload_7 = new UploadField('EventTwoLogo', 'Event Two Logo (SVG)')); $fields->addFieldsToTab("Root.TwoMainEvents", $upload_8 = new UploadField('EventTwoLogoPng', 'Event Two Logo (PNG)')); $upload_5->setFolderName('summits/overview/events'); $upload_5->setAllowedMaxFileNumber(1); $upload_5->setAllowedExtensions(array('svg')); $upload_5->setOverwriteWarning(false); $upload_5->getUpload()->setReplaceFile(true); $upload_6->setFolderName('summits/overview/events'); $upload_6->setAllowedMaxFileNumber(1); $upload_6->setAllowedExtensions(array('png')); $upload_6->setOverwriteWarning(false); $upload_6->getUpload()->setReplaceFile(true); $upload_7->setFolderName('summits/overview/events'); $upload_7->setAllowedMaxFileNumber(1); $upload_7->setAllowedExtensions(array('svg')); $upload_7->setOverwriteWarning(false); $upload_7->getUpload()->setReplaceFile(true); $upload_8->setFolderName('summits/overview/events'); $upload_8->setAllowedMaxFileNumber(1); $upload_8->setAllowedExtensions(array('png')); $upload_8->setOverwriteWarning(false); $upload_8->getUpload()->setReplaceFile(true); //atendees chart $fields->addFieldsToTab("Root.AtendeesChart", $upload_13 = new UploadField('AtendeesChartRef', 'Atendees Chart Legend (SVG)')); $fields->addFieldsToTab("Root.AtendeesChart", $upload_19 = new UploadField('AtendeesChartRefPng', 'Atendees Chart Legend (PNG)')); $fields->addFieldToTab("Root.AtendeesChart", new TextField('Atendees1Label', 'Atendees 1 Label')); $fields->addFieldsToTab("Root.AtendeesChart", $upload_9 = new UploadField('Atendees1Chart', 'Atendees 1 Chart (SVG)')); $fields->addFieldsToTab("Root.AtendeesChart", $upload_15 = new UploadField('Atendees1ChartPng', 'Atendees 1 Chart (PNG)')); $fields->addFieldToTab("Root.AtendeesChart", new TextField('Atendees2Label', 'Atendees 2 Label')); $fields->addFieldsToTab("Root.AtendeesChart", $upload_10 = new UploadField('Atendees2Chart', 'Atendees 2 Chart (SVG)')); $fields->addFieldsToTab("Root.AtendeesChart", $upload_16 = new UploadField('Atendees2ChartPng', 'Atendees 2 Chart (PNG)')); $fields->addFieldToTab("Root.AtendeesChart", new TextField('Atendees3Label', 'Atendees 3 Label')); $fields->addFieldsToTab("Root.AtendeesChart", $upload_11 = new UploadField('Atendees3Chart', 'Atendees 3 Chart (SVG)')); $fields->addFieldsToTab("Root.AtendeesChart", $upload_17 = new UploadField('Atendees3ChartPng', 'Atendees 3 Chart (PNG)')); $fields->addFieldToTab("Root.AtendeesChart", new TextField('Atendees4Label', 'Atendees 4 Label')); $fields->addFieldsToTab("Root.AtendeesChart", $upload_12 = new UploadField('Atendees4Chart', 'Atendees 4 Chart (SVG)')); $fields->addFieldsToTab("Root.AtendeesChart", $upload_18 = new UploadField('Atendees4ChartPng', 'Atendees 4 Chart (PNG)')); $upload_9->setFolderName('summits/overview'); $upload_9->setAllowedMaxFileNumber(1); $upload_9->setAllowedExtensions(array('svg')); $upload_9->setOverwriteWarning(false); $upload_9->getUpload()->setReplaceFile(true); $upload_10->setFolderName('summits/overview'); $upload_10->setAllowedMaxFileNumber(1); $upload_10->setAllowedExtensions(array('svg')); $upload_10->setOverwriteWarning(false); $upload_10->getUpload()->setReplaceFile(true); $upload_11->setFolderName('summits/overview'); $upload_11->setAllowedMaxFileNumber(1); $upload_11->setAllowedExtensions(array('svg')); $upload_11->setOverwriteWarning(false); $upload_11->getUpload()->setReplaceFile(true); $upload_12->setFolderName('summits/overview'); $upload_12->setAllowedMaxFileNumber(1); $upload_12->setAllowedExtensions(array('svg')); $upload_12->setOverwriteWarning(false); $upload_12->getUpload()->setReplaceFile(true); $upload_13->setFolderName('summits/overview'); $upload_13->setAllowedMaxFileNumber(1); $upload_13->setAllowedExtensions(array('svg')); $upload_13->setOverwriteWarning(false); $upload_13->getUpload()->setReplaceFile(true); $upload_15->setFolderName('summits/overview'); $upload_15->setAllowedMaxFileNumber(1); $upload_15->setAllowedExtensions(array('png')); $upload_15->setOverwriteWarning(false); $upload_15->getUpload()->setReplaceFile(true); $upload_16->setFolderName('summits/overview'); $upload_16->setAllowedMaxFileNumber(1); $upload_16->setAllowedExtensions(array('png')); $upload_16->setOverwriteWarning(false); $upload_16->getUpload()->setReplaceFile(true); $upload_17->setFolderName('summits/overview'); $upload_17->setAllowedMaxFileNumber(1); $upload_17->setAllowedExtensions(array('png')); $upload_17->setOverwriteWarning(false); $upload_17->getUpload()->setReplaceFile(true); $upload_18->setFolderName('summits/overview'); $upload_18->setAllowedMaxFileNumber(1); $upload_18->setAllowedExtensions(array('png')); $upload_18->setOverwriteWarning(false); $upload_18->getUpload()->setReplaceFile(true); $upload_19->setFolderName('summits/overview'); $upload_19->setAllowedMaxFileNumber(1); $upload_19->setAllowedExtensions(array('png')); $upload_19->setOverwriteWarning(false); $upload_19->getUpload()->setReplaceFile(true); //summit timeline $fields->addFieldToTab("Root.Timeline", new TextField('TimelineCaption', 'Timeline Caption')); $fields->addFieldsToTab("Root.Timeline", $upload_14 = new UploadField('TimelineImage', 'Timeline (SVG)')); $fields->addFieldsToTab("Root.Timeline", $upload_20 = new UploadField('TimelineImagePng', 'Timeline (PNG)')); $upload_14->setFolderName('summits/overview'); $upload_14->setAllowedMaxFileNumber(1); $upload_14->setAllowedExtensions(array('svg')); $upload_14->setOverwriteWarning(false); $upload_14->getUpload()->setReplaceFile(true); $upload_20->setFolderName('summits/overview'); $upload_20->setAllowedMaxFileNumber(1); $upload_20->setAllowedExtensions(array('png')); $upload_20->setOverwriteWarning(false); $upload_20->getUpload()->setReplaceFile(true); return $fields; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Content'); $fields->addFieldToTab('Root.Main', new LiteralField('HideSections', '<label>Hide Sections</label><hr>')); $fields->addFieldToTab('Root.Main', new CheckboxField('HideFee', 'Hide Exam Fee and Pricing')); $fields->addFieldToTab('Root.Main', new CheckboxField('HidePurchaseExam', 'Hide Purchase Exam Section')); $fields->addFieldToTab('Root.Main', new CheckboxField('HideVirtualExam', 'Hide Virtual Exam Section')); $fields->addFieldToTab('Root.Main', new CheckboxField('HideHowGetStarted', 'Hide How to get started Section')); $fields->addFieldToTab('Root.Main', new TextField('BannerTitle', 'Banner Title')); $fields->addFieldToTab('Root.Main', $banner_html = new HtmlEditorField('BannerText', 'Banner Text')); $banner_html->setRows(5); $fields->addFieldToTab('Root.Main', $how_html = new HtmlEditorField('GetStartedText', 'How to Get Started')); $how_html->setRows(5); $fields->addFieldToTab('Root.Main', new TextField('HandBookLink', 'HandBook Link')); $fields->addFieldToTab('Root.Main', new TextField('GetStartedURL', 'Get Started URL')); $fields->addFieldToTab('Root.Main', new TextField('GetStartedLabel', 'Get Started Label')); $fields->addFieldToTab('Root.Main', new TextField('AlreadyRegisteredURL', 'Already Registered URL')); // exam details $fields->addFieldToTab('Root.ExamDetails', $html_details = new HtmlEditorField('ExamDetails', 'Details Title')); $html_details->setRows(5); $fields->addFieldToTab('Root.ExamDetails', new TextField('ExamCost', 'Cost (include currency sign)')); $fields->addFieldToTab('Root.ExamDetails', new TextField('ExamDuration', 'Duration ( include time unit)')); $fields->addFieldToTab('Root.ExamDetails', $html_format = new HtmlEditorField('ExamFormat', 'Format')); $html_format->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_req = new HtmlEditorField('ExamIDRequirements', 'ID Requirements')); $html_req->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_system = new HtmlEditorField('ExamSystemRequirements', 'System Requirements')); $html_system->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_score = new HtmlEditorField('ExamScoring', 'Scoring')); $html_score->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_lang = new HtmlEditorField('ExamLanguage', 'Language')); $html_lang->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_duration = new HtmlEditorField('ExamHowLongSchedule', 'How long do I have to schedule my exam?')); $html_duration->setRows(5); $fields->addFieldToTab('Root.ExamDetails', $html_retake = new HtmlEditorField('ExamRetake', 'Retake')); $html_retake->setRows(5); if ($this->ID > 0) { $logo_field = new UploadField('HeroImage', 'Hero Image'); $logo_field->setAllowedMaxFileNumber(1); $logo_field->setAllowedFileCategories('image'); $logo_field->setFolderName('coa/hero_images/'); $logo_field->getValidator()->setAllowedMaxFileSize(1048576); $fields->addFieldToTab('Root.Main', $logo_field); $config = GridFieldConfig_RelationEditor::create(); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $config->addComponent($sort = new GridFieldSortableRows('Order')); $partners = new GridField('TrainingPartners', 'Training Partners', $this->TrainingPartners(), $config); $fields->addFieldsToTab('Root.TrainingPartners', $partners); } return $fields; }
public function getCMSFields() { $_REQUEST['SummitID'] = $this->ID; $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main'))); $f->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $f->addFieldToTab('Root.Main', $link = new TextField('Link', 'Summit Page Link')); $link->setDescription('The link to the site page for this summit. Eg: <em>/summit/vancouver-2015/</em>'); $f->addFieldToTab('Root.Main', new CheckboxField('Active', 'This is the active summit')); $f->addFieldToTab('Root.Main', $date_label = new TextField('DateLabel', 'Date label')); $date_label->setDescription('A readable piece of text representing the date, e.g. <em>May 12-20, 2015</em> or <em>December 2016</em>'); $f->addFieldToTab('Root.Main', $registration_link = new TextField('RegistrationLink', 'Registration Link')); $registration_link->setDescription('Link to the site where tickets can be purchased.'); $f->addFieldsToTab('Root.Main', $ddl_timezone = new DropdownField('TimeZone', 'Time Zone', DateTimeZone::listIdentifiers())); $ddl_timezone->setEmptyString('-- Select a Timezone --'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SummitBeginDate', 'Summit Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SummitEndDate', 'Summit End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('StartShowingVenuesDate', 'Start Showing Venues')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SubmissionBeginDate', 'Submission Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SubmissionEndDate', 'Submission End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('VotingBeginDate', 'Voting Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('VotingEndDate', 'Voting End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SelectionBeginDate', 'Selection Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('SelectionEndDate', 'Selection End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('RegistrationBeginDate', 'Registration Begin Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('RegistrationEndDate', 'Registration End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $logo_field = new UploadField('Logo', 'Logo'); $logo_field->setAllowedMaxFileNumber(1); $logo_field->setAllowedFileCategories('image'); $logo_field->setFolderName('summits/logos/'); $logo_field->getValidator()->setAllowedMaxFileSize(1048576); $f->addFieldToTab('Root.Main', $logo_field); $f->addFieldToTab('Root.Main', new TextField('ComingSoonBtnText', 'Coming Soon Btn Text')); $f->addFieldToTab('Root.Main', new TextField('ExternalEventId', 'Eventbrite Event Id')); if ($this->ID > 0) { // tracks $config = GridFieldConfig_RecordEditor::create(10); $categories = new GridField('Categories', 'Presentation Categories', $this->Categories(), $config); $f->addFieldToTab('Root.Presentation Categories', $categories); // track groups $config = GridFieldConfig_RecordEditor::create(10); $categories = new GridField('CategoryGroups', 'Category Groups', $this->CategoryGroups(), $config); $f->addFieldToTab('Root.Category Groups', $categories); // locations $config = GridFieldConfig_RecordEditor::create(); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('SummitVenue' => 'Venue', 'SummitHotel' => 'Hotel', 'SummitAirport' => 'Airport', 'SummitExternalLocation' => 'External Location')); $config->addComponent($multi_class_selector); $config->addComponent($sort = new GridFieldSortableRows('Order')); $gridField = new GridField('Locations', 'Locations', $this->Locations()->where("ClassName <> 'SummitVenueRoom' "), $config); $f->addFieldToTab('Root.Locations', $gridField); // types $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldAddDefaultSummitTypes()); $gridField = new GridField('Types', 'Types', $this->Types(), $config); $f->addFieldToTab('Root.Types', $gridField); // event types $config = GridFieldConfig_RecordEditor::create(); $config->addComponent(new GridFieldAddDefaultEventTypes()); $gridField = new GridField('EventTypes', 'EventTypes', $this->EventTypes(), $config); $f->addFieldToTab('Root.EventTypes', $gridField); //schedule $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->removeComponentsByType('GridFieldDeleteAction'); $gridField = new GridField('Schedule', 'Schedule', $this->Events()->filter('Published', true)->sort(array('StartDate' => 'ASC', 'EndDate' => 'ASC')), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Schedule', $gridField); $config->addComponent(new GridFieldPublishSummitEventAction()); // events $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Types'); $gridField = new GridField('Events', 'Events', $this->Events()->filter('ClassName', 'SummitEvent'), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Events', $gridField); //track selection list presentations $result = DB::query("SELECT DISTINCT SummitEvent.*, Presentation.*\nFROM SummitEvent\nINNER JOIN Presentation ON Presentation.ID = SummitEvent.ID\nINNER JOIN SummitSelectedPresentation ON SummitSelectedPresentation.PresentationID = Presentation.ID\nINNER JOIN SummitSelectedPresentationList ON SummitSelectedPresentation.SummitSelectedPresentationListID = SummitSelectedPresentationList.ID\nWHERE(ListType = 'Group') AND (SummitEvent.ClassName IN ('Presentation')) AND (SummitEvent.SummitID = {$this->ID})"); $presentations = new ArrayList(); foreach ($result as $row) { $presentations->add(new Presentation($row)); } $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Types'); $config->removeComponentsByType('GridFieldAddNewButton'); $gridField = new GridField('TrackChairs', 'TrackChairs Selection Lists', $presentations, $config); $gridField->setModelClass('Presentation'); $f->addFieldToTab('Root.TrackChairs Selection Lists', $gridField); // attendees $config = GridFieldConfig_RecordEditor::create(50); $gridField = new GridField('Attendees', 'Attendees', $this->Attendees(), $config); $f->addFieldToTab('Root.Attendees', $gridField); //tickets types $config = GridFieldConfig_RecordEditor::create(50); $gridField = new GridField('SummitTicketTypes', 'Ticket Types', $this->SummitTicketTypes(), $config); $f->addFieldToTab('Root.TicketTypes', $gridField); // promo codes $config = GridFieldConfig_RecordEditor::create(50); $config->removeComponentsByType('GridFieldAddNewButton'); $multi_class_selector = new GridFieldAddNewMultiClass(); $multi_class_selector->setClasses(array('SpeakerSummitRegistrationPromoCode' => 'Speaker Promo Code')); $config->addComponent($multi_class_selector); $promo_codes = new GridField('SummitRegistrationPromoCodes', 'Registration Promo Codes', $this->SummitRegistrationPromoCodes(), $config); $f->addFieldToTab('Root.RegistrationPromoCodes', $promo_codes); // speakers $config = GridFieldConfig_RecordEditor::create(50); $gridField = new GridField('Speakers', 'Speakers', $this->Speakers(false), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Bio" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Speakers', $gridField); // presentations $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldPublishSummitEventAction()); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->addComponent($bulk_summit_types = new GridFieldBulkActionAssignSummitTypeSummitEvents()); $bulk_summit_types->setTitle('Set Summit Types'); $gridField = new GridField('Presentations', 'Presentations', $this->Presentations()->where(" Title IS NOT NULL AND Title <>'' "), $config); $config->getComponentByType("GridFieldDataColumns")->setFieldCasting(array("Description" => "HTMLText->BigSummary")); $f->addFieldToTab('Root.Presentations', $gridField); // push notifications $config = GridFieldConfig_RecordEditor::create(50); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Channel' => 'Channel', 'Message' => 'Message', 'Owner.FullName' => 'Owner', 'IsSent' => 'Is Sent?')); $gridField = new GridField('Notifications', 'Notifications', $this->Notifications(), $config); $f->addFieldToTab('Root.Notifications', $gridField); } return $f; }
function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName('Content'); $fields->addFieldToTab('Root.Main', new TextField('BannerTitle', 'Banner Title')); $fields->addFieldToTab('Root.Main', new HtmlEditorField('BannerText', 'Banner Text')); $fields->addFieldToTab('Root.Main', new HtmlEditorField('GetStartedText', 'How to Get Started')); $fields->addFieldToTab('Root.Main', new TextField('HandBookLink', 'HandBook Link')); $fields->addFieldToTab('Root.Main', new TextField('GetStartedURL', 'Get Started URL')); $fields->addFieldToTab('Root.Main', new TextField('AlreadyRegisteredURL', 'Already Registered URL')); // exam details $fields->addFieldToTab('Root.ExamDetails', new HtmlEditorField('ExamDetails', 'Details Title')); $fields->addFieldToTab('Root.ExamDetails', new TextField('ExamCost', 'Cost (include currency sign)')); $fields->addFieldToTab('Root.ExamDetails', new TextField('ExamDuration', 'Duration ( include time unit)')); $fields->addFieldToTab('Root.ExamDetails', new HtmlEditorField('ExamFormat', 'Format')); $fields->addFieldToTab('Root.ExamDetails', new HtmlEditorField('ExamIDRequirements', 'ID Requirements')); $fields->addFieldToTab('Root.ExamDetails', new HtmlEditorField('ExamSystemRequirements', 'System Requirements')); $fields->addFieldToTab('Root.ExamDetails', new HtmlEditorField('ExamScoring', 'Scoring')); $fields->addFieldToTab('Root.ExamDetails', new HtmlEditorField('ExamLanguage', 'Language')); $fields->addFieldToTab('Root.ExamDetails', new HtmlEditorField('ExamHowLongSchedule', 'How long do I have to schedule my exam?')); if ($this->ID > 0) { $logo_field = new UploadField('HeroImage', 'Hero Image'); $logo_field->setAllowedMaxFileNumber(1); $logo_field->setAllowedFileCategories('image'); $logo_field->setFolderName('coa/hero_images/'); $logo_field->getValidator()->setAllowedMaxFileSize(1048576); $fields->addFieldToTab('Root.Main', $logo_field); $config = GridFieldConfig_RelationEditor::create(); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $config->addComponent($sort = new GridFieldSortableRows('Order')); $partners = new GridField('TrainingPartners', 'Training Partners', $this->TrainingPartners(), $config); $fields->addFieldsToTab('Root.TrainingPartners', $partners); } return $fields; }