public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Main', new HtmlEditorField('PresentationDeadlineText', 'Presentation Deadline Text'));
     $fields->addFieldsToTab('Root.LegalAgreement', new HtmlEditorField('LegalAgreement', 'Legal Agreement'));
     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
         $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 getCMSFields()
 {
     $f = parent::getCMSFields();
     //current summit
     $f->removeByName('Content');
     $f->addFieldToTab('Root.CurrentSummit', new HtmlEditorField('ThankYouText', 'ThankYouText'));
     $f->addFieldToTab('Root.CurrentSummit', new TextField('CurrentSummitFlickrUrl', 'Flickr Url'));
     $image = new UploadField('CurrentSummitBackgroundImage', 'Background Image');
     $image->setAllowedMaxFileNumber(1);
     $image->setFolderName(sprintf('summits/%s/highlights/', $this->SummitID));
     $f->addFieldToTab('Root.CurrentSummit', $image);
     // statistics
     $f->addFieldToTab('Root.Statistics', new TextField('AttendanceQty', 'Attendance Qty'));
     $f->addFieldToTab('Root.Statistics', new TextField('CompaniesRepresentedQty', 'Companies Represented Qty'));
     $f->addFieldToTab('Root.Statistics', new TextField('CountriesRepresentedQty', 'Countries Represented Qty'));
     $f->addFieldToTab('Root.Statistics', new TextField('StatisticsVideoUrl', 'Video Url'));
     $file = new UploadField('StatisticsVideo', 'Video');
     $file->setAllowedMaxFileNumber(1);
     $file->setAllowedExtensions(array('mp4'));
     $file->setFolderName(sprintf('summits/%s/highlights/statistics', $this->SummitID));
     $f->addFieldToTab('Root.Statistics', $file);
     $image = new UploadField('StatisticsVideoPoster', 'Video Poster');
     $image->setAllowedMaxFileNumber(1);
     $image->setFolderName(sprintf('summits/%s/highlights/statistics', $this->SummitID));
     $f->addFieldToTab('Root.Statistics', $image);
     // next summit
     $f->addFieldToTab('Root.NextSummit', new HtmlEditorField('NextSummitText', 'Next Summit Text'));
     $dropdown = DropdownField::create('NextSummitBackgroundImageID', 'Please choose an image for this page', SummitImage::get()->map("ID", "Title", "Please Select"))->setEmptyString('(None)');
     $f->addFieldToTab('Root.NextSummit', $dropdown);
     $image = new UploadField('NextSummitTinyBackgroundImage', 'Promo Background Image');
     $image->setAllowedMaxFileNumber(1);
     $image->setFolderName(sprintf('summits/%s/highlights/next_summit/', $this->SummitID));
     $f->addFieldToTab('Root.NextSummit', $image);
     // release
     $f->addFieldToTab('Root.ReleaseAnnounced', new TextField('ReleaseAnnouncedTitle', 'Title'));
     $f->addFieldToTab('Root.ReleaseAnnounced', new HtmlEditorField('ReleaseAnnouncedDescription', 'Description'));
     $f->addFieldToTab('Root.ReleaseAnnounced', new TextField('ReleaseAnnouncedButtonTitle', 'Button Text'));
     $f->addFieldToTab('Root.ReleaseAnnounced', new TextField('ReleaseAnnouncedButtonLink', 'Button Link'));
     $release_image = new UploadField('ReleaseAnnouncedImage', 'Image');
     $release_image->setAllowedMaxFileNumber(1);
     $release_image->setFolderName(sprintf('summits/%s/highlights/release/', $this->SummitID));
     $f->addFieldToTab('Root.ReleaseAnnounced', $release_image);
     if ($this->ID > 0) {
         $config = GridFieldConfig_RecordEditor::create();
         $config->addComponent($sort = new GridFieldSortableRows('Order'));
         $gridField = new GridField('KeynotesImages', 'KeynotesImages', $this->KeynotesImages(), $config);
         $f->addFieldToTab('Root.KeyNotesImages', $gridField);
         $config = GridFieldConfig_RecordEditor::create();
         $config->addComponent($sort = new GridFieldSortableRows('Order'));
         $gridField = new GridField('Pics', 'Pics', $this->Pics(), $config);
         $f->addFieldToTab('Root.Pics', $gridField);
     }
     return $f;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->ID) {
         // Summit Updates
         $updateFields = singleton('SummitUpdate')->getCMSFields();
         $config = GridFieldConfig_RelationEditor::create();
         $config->addComponent(new GridFieldSortableRows('Order'));
         $gridField = new GridField('Updates', 'Updates', $this->SummitUpdates(), $config);
         $fields->addFieldToTab('Root.Updates', $gridField);
         // Summit Important Dates
         $dateFields = singleton('SummitActivityDate')->getCMSFields();
         $config = GridFieldConfig_RelationEditor::create();
         $config->getComponentByType('GridFieldDetailForm')->setFields($dateFields);
         $gridField = new GridField('ImportantDates', 'Important Dates', $this->ImportantDates(), $config);
         $fields->addFieldToTab('Root.ImportantDates', $gridField);
     }
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->ID) {
         // Summit Questions
         $questionFields = singleton('SummitQuestion')->getCMSFields();
         $config = GridFieldConfig_RelationEditor::create();
         $config->getComponentByType('GridFieldDetailForm')->setFields($questionFields);
         $config->addComponent(new GridFieldSortableRows('Order'));
         $gridField = new GridField('Questions', 'Questions', $this->Questions(), $config);
         $fields->addFieldToTab('Root.Questions', $gridField);
         // Summit Question Categories
         $categoryFields = singleton('SummitQuestionCategory')->getCMSFields();
         $config = GridFieldConfig_RelationEditor::create();
         $config->getComponentByType('GridFieldDetailForm')->setFields($categoryFields);
         $gridField = new GridField('Categories', 'Categories', $this->Categories(), $config);
         $fields->addFieldToTab('Root.QuestionCategories', $gridField);
     }
     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;
 }
 public function validate()
 {
     $valid = parent::validate();
     if (!$valid->valid()) {
         return $valid;
     }
     /*if(empty($this->SummitID)){
           return $valid->error('You must select a valid Summit!');
       }*/
     return $valid;
 }
 /**
  * @param Summit $s
  * @return array
  */
 protected function createSummitJSON(Summit $s)
 {
     $page = SummitPage::get()->filter('SummitID', $s->ID)->first();
     $image = null;
     if ($page) {
         $image = $page->SummitImage()->Image();
     }
     return ['id' => $s->ID, 'title' => $s->Title, 'dates' => $s->getSummitDateRange(), 'videoCount' => PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true, 'PresentationID' => $s->Presentations()->column('ID')])->count(), 'imageURL' => $image && $image->exists() && Director::fileExists($image->Filename) ? $image->CroppedImage(263, 148)->URL : 'summit-video-app/production/images/placeholder-image.jpg'];
 }
 function TwitterTrackingCode()
 {
     $request = $this->request;
     $order = $request->requestVar("order");
     $tracking_code = '';
     if (isset($order) && $order == "complete") {
         //add FB tracking script
         $page = SummitPage::get()->byID($this->ID);
         if ($page && !empty($page->TwitterPixelId)) {
             $tracking_code = $this->renderWith("SummitPage_Twitter", array("Twitter_Data" => new ArrayData(array("TwitterPixelId" => $page->TwitterPixelId))));
         }
     }
     return $tracking_code;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Main', new TextField('SchedEmbedURL', 'Enter The Sched Embed URL'), 'Content');
     return $fields;
 }
 function onAfterWrite()
 {
     parent::onAfterWrite();
     $summit = Summit::get_active();
     //update all relationships with sponsors
     foreach ($this->Companies() as $company) {
         if (isset($_REQUEST["SponsorshipType_{$company->ID}"])) {
             $type = $_REQUEST["SponsorshipType_{$company->ID}"];
             $sql = "UPDATE SummitSponsorPage_Companies SET SponsorshipType ='{$type}', SummitID = '{$summit->ID}' WHERE CompanyID={$company->ID} AND SummitSponsorPageID={$this->ID};";
             DB::query($sql);
         }
         if (isset($_REQUEST["SubmitPageUrl_{$company->ID}"])) {
             $page_url = $_REQUEST["SubmitPageUrl_{$company->ID}"];
             $sql = "UPDATE SummitSponsorPage_Companies SET SubmitPageUrl ='{$page_url}', SummitID = '{$summit->ID}' WHERE CompanyID={$company->ID} AND SummitSponsorPageID={$this->ID};";
             DB::query($sql);
         }
     }
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->add(new TextField('IntroText', 'Intro Text'));
     return $fields;
 }
 /**
  * @param Summit $s
  * @return array
  */
 protected function createSummitJSON(Summit $s)
 {
     $page = SummitPage::get()->filter('SummitID', $s->ID)->first();
     $image = null;
     if ($page) {
         $image = $page->SummitImage()->Image();
     }
     $tracks = array_map(function ($t) {
         return ['id' => $t->ID, 'slug' => $t->Slug, 'title' => $t->Title, 'has_videos' => 0];
     }, $s->Categories()->toArray());
     $videos = PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true])->sort('DateUploaded', 'DESC')->innerJoin('Presentation', 'Presentation.ID = PresentationMaterial.PresentationID')->innerJoin('SummitEvent', 'SummitEvent.ID = PresentationMaterial.PresentationID')->filter('SummitEvent.SummitID', $s->ID);
     $videos_groupedby_track = GroupedList::create($videos)->groupBy('Track');
     foreach ($tracks as &$track) {
         if (array_key_exists($track['title'], $videos_groupedby_track)) {
             $track['has_videos'] = 1;
         }
     }
     return ['id' => $s->ID, 'title' => $s->Title, 'dates' => $s->getSummitDateRange(), 'videoCount' => PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true, 'PresentationID' => $s->Presentations()->column('ID')])->count(), 'imageURL' => $image && $image->exists() && Director::fileExists($image->Filename) ? $image->CroppedImage(263, 148)->URL : 'summit-video-app/production/images/placeholder-image.jpg', 'slug' => $s->Slug, 'tracks' => $tracks];
 }