/** * @param int $summit_id * @param array $data * @return ISummitType */ public function buildSummitType(array $data, $summit_id) { $summit_type = new SummitType(); $summit_type->setTitle(trim($data['title'])); $summit_type->setDescription(trim($data['description'])); $summit_type->setAudience(trim($data['audience'])); $summit_type->setStartDate(trim($data['start_date'])); $summit_type->setEndDate(trim($data['end_date'])); $summit_type->setSummitId(trim($summit_id)); return $summit_type; }
protected function getEntities() { $summit_id = intval($_REQUEST['SummitID']); $res = SummitType::get()->filter('SummitID', $summit_id)->map('ID', 'Title'); $additional_actions = array(); foreach ($res->toArray() as $k => $v) { $additional_actions[$k . '_ALL'] = $v . ' ( COMPLETE RECORDSET )'; } foreach ($additional_actions as $k => $v) { $res->push($k, $v); } return $res; }
/** * @param int $summit_id * @throws ValidationException * @throws null */ public static function seedSummitTypes($summit_id) { $summit = Summit::get()->byID($summit_id); if (!SummitType::get()->filter(array('Title' => 'Main Conference', 'SummitID' => $summit_id))->first()) { $main_type = new SummitType(); $main_type->Title = 'Main Conference'; $main_type->Description = 'This Schedule is for general attendees. Its includes breakout tracks, hand-ons labs, keynotes and sponsored sessions'; $main_type->Audience = 'General Attendees'; $main_type->SummitID = $summit_id; $main_type->StartDate = $summit->BeginDate; $main_type->EndDate = $summit->EndDate; $main_type->Type = 'MAIN'; $main_type->write(); } if (!SummitType::get()->filter(array('Title' => 'Design Summit', 'SummitID' => $summit_id))->first()) { $design_type = new SummitType(); $design_type->Title = 'Design Summit'; $design_type->Description = 'This Schedule is specifically for developers and operators who contribute to the roadmap for the N release cycle. The Design Summit is not a classic track with speakers and presentations and its not the right place to get started or learn the basics of OpenStack. This schedule also Includes the Main Conference Sessions'; $design_type->Audience = 'Developers And Operators'; $design_type->SummitID = $summit_id; $design_type->StartDate = $summit->BeginDate; $design_type->EndDate = $summit->EndDate; $design_type->Type = 'DESIGN'; $design_type->write(); } }
public function getCMSFields() { $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID; $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main'))); $f->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $f->addFieldToTab('Root.Main', new HtmlEditorField('Description', 'Description')); $f->addFieldToTab('Root.Main', new HtmlEditorField('ShortDescription', 'Short Description')); $f->tag('Tags', 'Tags', Tag::get(), $this->Tags())->configure()->setTitleField('Tag')->end(); $f->addFieldToTab('Root.Main', new CheckboxField('AllowFeedBack', 'Is feedback allowed?')); $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID')); $f->addFieldToTab('Root.Main', $date = new DatetimeField('StartDate', 'Start Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('EndDate', 'End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $locations = SummitAbstractLocation::get()->filter('SummitID', $summit_id)->filter('ClassName', array('SummitVenue', 'SummitVenueRoom', 'SummitExternalLocation')); $locations_source = array(); foreach ($locations as $l) { $locations_source[$l->ID] = $l->getFullName(); } $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('LocationID', 'Location', $locations_source)); $ddl_location->setEmptyString('-- Select a Location --'); $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('TypeID', 'Event Type', SummitEventType::get()->filter('SummitID', $summit_id)->map('ID', 'Type'))); $ddl_location->setEmptyString('-- Select a Event Type --'); $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID')); if ($this->ID > 0) { // summits types $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter'); $completer->setSearchList(SummitType::get()->filter('SummitID', $summit_id)); $summit_types = new GridField('AllowedSummitTypes', 'Summit Types', $this->AllowedSummitTypes(), $config); $f->addFieldToTab('Root.Main', $summit_types); // sponsors $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $sponsors = new GridField('Sponsors', 'Sponsors', $this->Sponsors(), $config); $f->addFieldToTab('Root.Sponsors', $sponsors); // feedback $config = new GridFieldConfig_RecordEditor(100); $config->removeComponentsByType('GridFieldAddNewButton'); $feedback = new GridField('Feedback', 'Feedback', $this->Feedback(), $config); $f->addFieldToTab('Root.Feedback', $feedback); } return $f; }
public function getCMSFields() { Requirements::customScript("\n jQuery( document ).ready(function() {\n jQuery('body').on('change','#Form_ItemEditForm_RSVPTemplateID',\n function(){\n jQuery('#Form_ItemEditForm_action_save').click();\n }\n );\n });"); $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID; $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main'))); $f->addFieldToTab('Root.Main', new TextField('Title', 'Title')); $f->addFieldToTab('Root.Main', new HtmlEditorField('Description', 'Description')); $f->addFieldToTab('Root.Main', new HtmlEditorField('ShortDescription', 'Abstract')); $f->addFieldToTab('Root.Main', new TextField('HeadCount', 'HeadCount')); $f->tag('Tags', 'Tags', Tag::get(), $this->Tags())->configure()->setTitleField('Tag')->end(); $f->addFieldToTab('Root.Main', new CheckboxField('AllowFeedBack', 'Is feedback allowed?')); $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID')); $f->addFieldToTab('Root.Main', $date = new DatetimeField('StartDate', 'Start Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldToTab('Root.Main', $date = new DatetimeField('EndDate', 'End Date')); $date->getDateField()->setConfig('showcalendar', true); $date->setConfig('dateformat', 'dd/MM/yyyy'); $f->addFieldsToTab('Root.Main', new ReadonlyField('AvgFeedbackRate', 'AvgFeedbackRate')); $locations = SummitAbstractLocation::get()->filter('SummitID', $summit_id)->filter('ClassName', array('SummitVenue', 'SummitVenueRoom', 'SummitExternalLocation')); $locations_source = array(); foreach ($locations as $l) { $locations_source[$l->ID] = $l->getFullName(); } $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('LocationID', 'Location', $locations_source)); $ddl_location->setEmptyString('-- Select a Location --'); $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('TypeID', 'Event Type', SummitEventType::get()->filter('SummitID', $summit_id)->map('ID', 'Type'))); $ddl_location->setEmptyString('-- Select a Event Type --'); $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID')); if ($this->ID > 0) { // summits types $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter'); $completer->setSearchList(SummitType::get()->filter('SummitID', $summit_id)); $summit_types = new GridField('AllowedSummitTypes', 'Summit Types', $this->AllowedSummitTypes(), $config); $f->addFieldToTab('Root.Main', $summit_types); // sponsors $config = new GridFieldConfig_RelationEditor(100); $config->removeComponentsByType('GridFieldEditButton'); $config->removeComponentsByType('GridFieldAddNewButton'); $sponsors = new GridField('Sponsors', 'Sponsors', $this->Sponsors(), $config); $f->addFieldToTab('Root.Sponsors', $sponsors); // feedback $config = new GridFieldConfig_RecordEditor(100); $config->removeComponentsByType('GridFieldAddNewButton'); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $feedback = new GridField('Feedback', 'Feedback', $this->Feedback(), $config); $f->addFieldToTab('Root.Feedback', $feedback); // rsvp $f->addFieldsToTab('Root.RSVP', new TextField('RSVPLink', 'RSVP External Link')); $rsvp_template = new DropdownField('RSVPTemplateID', 'Select a Template', RSVPTemplate::get()->filter('SummitID', $summit_id)->map()); $rsvp_template->setEmptyString('-- View All Templates --'); $f->addFieldToTab('Root.RSVP', LiteralField::create('AddNew', 'Or add a new custom RSVP Configuration')); $f->addFieldToTab('Root.RSVP', $rsvp_template); $f->addFieldToTab('Root.RSVP', new NumericField('RSVPMaxUserNumber', 'Max # Number')); $f->addFieldToTab('Root.RSVP', new NumericField('RSVPMaxUserWaitListNumber', 'Max # Wait List')); $f->addFieldToTab('Root.RSVP', $rsvp_template); if ($this->RSVPTemplate()->exists()) { $config = new GridFieldConfig_RecordEditor(100); $config->removeComponentsByType('GridFieldAddNewButton'); $config->addComponent(new GridFieldAjaxRefresh(1000, false)); $rsvps = new GridField('RSVPSubmissions', 'RSVP Submissions', $this->RSVPSubmissions(), $config); $f->addFieldToTab('Root.RSVP', $rsvps); } } if ($this->ID > 0) { $_REQUEST['SummitEventID'] = $this->ID; } return $f; }
public function getAllowedSummitTypesBySummit($summit_id) { return SummitType::get()->filter(array('SummitID' => $summit_id)); }
protected function validate() { $valid = parent::validate(); if (!$valid->valid()) { return $valid; } $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID; $summit = Summit::get()->byID($summit_id); if (!$summit) { return $valid->error('Invalid Summit!'); } $count = intval(SummitType::get()->filter(array('SummitID' => $summit->ID, 'Title' => trim($this->Title), 'ID:ExactMatch:not' => $this->ID))->count()); if ($count > 0) { return $valid->error(sprintf('Summit Type %s already exists!. please set another one', $this->Title)); } $start_date = $this->getStartDate(); $end_date = $this->getEndDate(); if (empty($start_date) || empty($end_date)) { return $valid->error('You must define a start/end datetime!'); } if (!empty($start_date) && !empty($end_date)) { $start_date = new DateTime($start_date); $end_date = new DateTime($end_date); if ($end_date < $start_date) { return $valid->error('start datetime must be greather or equal than end datetime!'); } if (!$summit->isEventInsideSummitDuration($this)) { return $valid->error(sprintf('start/end datetime must be between summit start/end datetime! (%s - %s)', $summit->getBeginDate(), $summit->getEndDate())); } } return $valid; }
protected function getEntities() { $summit_id = intval(Controller::curr()->getRequest()->param('ID')); return SummitType::get()->filter('SummitID', $summit_id)->map('ID', 'Title'); }