public function GroupList() { // See if there's a list for the group $GroupList = SummitSelectedPresentationList::get()->filter(array('ListType' => 'Group', 'CategoryID' => $this->ID))->first(); // if a group selection list doesn't exist for this category, create it if (!$GroupList) { $GroupList = new SummitSelectedPresentationList(); $GroupList->ListType = 'Group'; $GroupList->CategoryID = $this->ID; $GroupList->write(); } return $GroupList; }
public function TrackGroupLists() { return SummitSelectedPresentationList::get()->filter('ListType', 'Group')->innerJoin('PresentationCategory', 'PresentationCategory.ID = SummitSelectedPresentationList.CategoryID')->where('PresentationCategory.SummitID = ' . $this->ID)->sort('SummitSelectedPresentationList.Name', 'ASC'); }
/** * @param $SummitCategoryID * @return bool|SummitSelectedPresentationList */ public static function getMemberList($SummitCategoryID) { if (!Member::currentUser()) { return false; } $MemberID = Member::currentUser()->ID; $SummitSelectedPresentationList = SummitSelectedPresentationList::get()->filter(array('CategoryID' => $SummitCategoryID, 'ListType' => 'Individual', 'MemberID' => Member::currentUser()->ID))->first(); // if a summit talk list doesn't exist for this member and category, create it if (!$SummitSelectedPresentationList) { $SummitSelectedPresentationList = new SummitSelectedPresentationList(); $SummitSelectedPresentationList->ListType = 'Individual'; $SummitSelectedPresentationList->CategoryID = $SummitCategoryID; $SummitSelectedPresentationList->MemberID = Member::currentUser()->ID; $SummitSelectedPresentationList->write(); } return $SummitSelectedPresentationList; }
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 handleRestoreOrders() { $activeSummit = Summit::get_active(); $SummitCategories = DataObject::get('PresentationCategory', $activeSummit->ID); foreach ($SummitCategories as $Category) { // Grab the track chairs selections for the category $SelectedPresentationList = SummitSelectedPresentationList::get()->filter(array('CategoryID' => $Category->ID)); foreach ($SelectedPresentationList as $list) { $selections = $list->SummitSelectedPresentations()->sort('Order', 'ASC'); $i = 1; foreach ($selections as $selection) { $selection->Order = $i; $selection->write(); $i++; } } } }
/** * Used by the track chair app to allow chairs to remove a presentation from a group list. **/ public function removeFromGroupList() { // Check permissions of user on talk if ($this->CanAssign()) { $GroupList = SummitSelectedPresentationList::get()->filter(array('CategoryID' => $this->CategoryID, 'ListType' => 'Group'))->first(); // See if the presentation has already been assigned $AlreadyAssigned = $GroupList->SummitSelectedPresentations('PresentationID = ' . $this->ID)->first(); if ($AlreadyAssigned->exists()) { $AlreadyAssigned->delete(); } } }
/** * @param SS_HTTPRequest $r * @return SS_HTTPResponse * @throws ValidationException * @throws null */ public function handleReorderList(SS_HTTPRequest $r) { $vars = Convert::json2array($r->getBody()); $idList = $vars['order']; $listID = $vars['list_id']; $collection = $vars['collection']; $list = SummitSelectedPresentationList::get()->byId($listID); if (!$list->memberCanEdit()) { return $this->httpError(403, 'You cannot edit this list'); } $isTeam = $list->ListType === 'Group'; // Remove any presentations that are not in the list SummitSelectedPresentation::get()->filter(['SummitSelectedPresentationListID' => $listID, 'Collection' => $collection])->exclude(['PresentationID' => array_values($idList)])->removeAll(); if (is_array($idList)) { foreach ($idList as $order => $id) { $attributes = ['PresentationID' => $id, 'SummitSelectedPresentationListID' => $listID, 'Collection' => $collection]; $selection = SummitSelectedPresentation::get()->filter($attributes)->first(); if (!$selection) { $selection = SummitSelectedPresentation::create($attributes); if ($isTeam) { $presentation = Presentation::get()->byID($id); if ($presentation) { $presentation->addNotification('{member} added this presentation to the team list'); } } } $selection->Order = $order + 1; $selection->write(); } } return $this->ok(); }