Skip to content

Commit 80fd800

Browse files
committed
[smarcet] - #13927
* added a way to select the regular presentation types and published presentation types per summit for speakers
1 parent 0445626 commit 80fd800

3 files changed

Lines changed: 129 additions & 32 deletions

File tree

summit/code/infrastructure/active_records/Summit.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ class Summit extends DataObject implements ISummit
9696
'ExcludedCategoriesForRejectedPresentations' => 'PresentationCategory',
9797
// summit speaker upload slide deck email
9898
'ExcludedTracksForUploadPresentationSlideDeck' => 'PresentationCategory',
99+
'RegularPresentationTypes' => 'PresentationType',
100+
'PublishedPresentationTypes' => 'PresentationType',
99101
];
100102

101103
private static $many_many_extraFields = [];
@@ -1656,6 +1658,28 @@ public function copyPreviousRsvpTemplates() {
16561658
}
16571659
}
16581660
}
1661+
1662+
/**
1663+
* @return array
1664+
*/
1665+
public function getRegularPresentationTypesList(){
1666+
$list = [];
1667+
foreach($this->RegularPresentationTypes() as $et){
1668+
$list[] = $et->Type;
1669+
}
1670+
return $list;
1671+
}
1672+
1673+
/**
1674+
* @return array
1675+
*/
1676+
public function getPublishedPresentationTypesList(){
1677+
$list = [];
1678+
foreach($this->PublishedPresentationTypes() as $et){
1679+
$list[] = $et->Type;
1680+
}
1681+
return $list;
1682+
}
16591683
}
16601684

16611685

summit/code/infrastructure/active_records/events/presentations/PresentationSpeaker.php

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@
66
class PresentationSpeaker extends DataObject
77
implements IPresentationSpeaker
88
{
9+
static $default_published_presentation_types = [
10+
IPresentationType::Keynotes,
11+
IPresentationType::Panel,
12+
IPresentationType::Presentation,
13+
IPresentationType::LightingTalks,
14+
IPresentationType::Workshop,
15+
IPresentationType::Fishbowl
16+
];
17+
18+
static $default_regular_presentation_types = [
19+
IPresentationType::Keynotes,
20+
IPresentationType::Panel,
21+
IPresentationType::Presentation,
22+
IPresentationType::Workshop
23+
];
924

1025
use SummitEntityMetaTagGenerator;
1126

@@ -385,20 +400,23 @@ public function AllRelatedPresentations()
385400
*/
386401
public function PublishedPresentations($summit_id = null, $role = IPresentationSpeaker::RoleSpeaker, $exclude_privates_tracks = true, array $excluded_tracks = [])
387402
{
388-
$types = [
389-
IPresentationType::Keynotes,
390-
IPresentationType::Panel,
391-
IPresentationType::Presentation,
392-
IPresentationType::LightingTalks,
393-
IPresentationType::Workshop,
394-
IPresentationType::Fishbowl
395-
];
403+
$regular_types = [];
404+
405+
if(is_null(!$summit_id))
406+
{
407+
$summit = Summit::get()->byID($summit_id);
408+
if($summit)
409+
$regular_types = $summit->getPublishedPresentationTypesList();
410+
}
411+
412+
if(count($regular_types))
413+
$regular_types = self::$default_published_presentation_types;
396414

397415
return $this->PublishedPresentationsByType
398416
(
399417
$summit_id,
400418
$role,
401-
$types,
419+
$regular_types,
402420
$exclude_privates_tracks,
403421
$excluded_tracks
404422
);
@@ -419,16 +437,23 @@ public function PublishedRegularPresentations
419437
array $excluded_tracks = []
420438
)
421439
{
440+
$regular_types = [];
441+
442+
if(is_null(!$summit_id))
443+
{
444+
$summit = Summit::get()->byID($summit_id);
445+
if($summit)
446+
$regular_types = $summit->getRegularPresentationTypesList();
447+
}
448+
449+
if(count($regular_types))
450+
$regular_types = self::$default_regular_presentation_types;
451+
422452
$list = $this->PublishedPresentationsByType
423453
(
424454
$summit_id,
425455
$role,
426-
[
427-
IPresentationType::Keynotes,
428-
IPresentationType::Panel,
429-
IPresentationType::Presentation,
430-
IPresentationType::Workshop
431-
],
456+
$regular_types,
432457
true,
433458
$excluded_tracks
434459
)->toArray();
@@ -438,12 +463,7 @@ public function PublishedRegularPresentations
438463
(
439464
$summit_id,
440465
IPresentationSpeaker::RoleSpeaker,
441-
[
442-
IPresentationType::Keynotes,
443-
IPresentationType::Panel,
444-
IPresentationType::Presentation,
445-
IPresentationType::Workshop
446-
],
466+
$regular_types,
447467
true,
448468
$excluded_tracks
449469
);
@@ -530,16 +550,23 @@ public function hasPublishedLightningPresentations
530550
public function PublishedPresentationsByType(
531551
$summit_id = null,
532552
$role = IPresentationSpeaker::RoleSpeaker,
533-
array $types_slugs = [
534-
IPresentationType::Keynotes,
535-
IPresentationType::Panel,
536-
IPresentationType::Presentation,
537-
IPresentationType::Workshop,
538-
IPresentationType::LightingTalks
539-
],
553+
array $types_slugs = [],
540554
$exclude_privates_tracks = true,
541555
array $excluded_tracks = []
542556
){
557+
if(!count($types_slugs)){
558+
559+
if(is_null(!$summit_id))
560+
{
561+
$summit = Summit::get()->byID($summit_id);
562+
if($summit)
563+
$types_slugs = $summit->getRegularPresentationTypesList();
564+
}
565+
566+
if(count($types_slugs))
567+
$types_slugs = self::$default_regular_presentation_types;
568+
}
569+
543570
$summit = !$summit_id ? Summit::get_active() : Summit::get()->byID($summit_id);
544571
if (!$summit) return false;
545572

summit/code/pages/admin/SummitAdminUI.php

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,62 @@ public function updateCMSFields(FieldList $f) {
206206

207207
$multi_class_selector->setClasses
208208
(
209-
array
210-
(
211-
'SummitEventType' => 'Event Type',
209+
[
210+
'SummitEventType' => 'Event Type',
212211
'PresentationType' => 'Presentation Type',
213-
)
212+
]
214213
);
215214

216215
$config->addComponent($multi_class_selector);
216+
217+
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields
218+
(
219+
[
220+
'ID' => 'ID',
221+
'Type' => 'Type',
222+
'ClassName' => 'ClassName',
223+
]
224+
);
225+
217226
$gridField = new GridField('EventTypes', 'EventTypes', $this->owner->EventTypes(), $config);
218227
$f->addFieldToTab('Root.EventTypes', $gridField);
219228

229+
$config = GridFieldConfig_RelationEditor::create(50);
230+
$config->removeComponentsByType("GridFieldAddNewButton");
231+
$completer = $config->getComponentByType('GridFieldAddExistingAutocompleter');
232+
233+
$completer->setResultsFormat('$Type ($ID)');
234+
$completer->setSearchFields(['Type', 'ID']);
235+
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields
236+
(
237+
[
238+
'ID' => 'ID',
239+
'Type' => 'Type',
240+
]
241+
);
242+
$completer->setSearchList(PresentationType::get()->filter(['SummitID' => $this->owner->ID]));
243+
$categories = new GridField('RegularPresentationTypes',
244+
'Regular Presentation Types (Presentation types used to calculate regular speakers published presentations)',
245+
$this->owner->RegularPresentationTypes(), $config);
246+
$f->addFieldToTab('Root.EventTypes', $categories);
247+
248+
$config = GridFieldConfig_RelationEditor::create(50);
249+
$config->removeComponentsByType("GridFieldAddNewButton");
250+
$completer = $config->getComponentByType('GridFieldAddExistingAutocompleter');
251+
$completer->setResultsFormat('$Type ($ID)');
252+
$completer->setSearchFields(['Type', 'ID']);
253+
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields
254+
(
255+
[
256+
'ID' => 'ID',
257+
'Type' => 'Type',
258+
]
259+
);
260+
$completer->setSearchList(PresentationType::get()->filter(['SummitID' => $this->owner->ID]));
261+
$categories = new GridField('PublishedPresentationTypes',
262+
'Published Presentation Types (Presentation types used to calculate speakers published presentations)',
263+
$this->owner->PublishedPresentationTypes(), $config);
264+
$f->addFieldToTab('Root.EventTypes', $categories);
220265
//schedule
221266

222267
$config = GridFieldConfig_RecordEditor::create(50);
@@ -437,6 +482,7 @@ public function updateCMSFields(FieldList $f) {
437482
$completer->setSearchList($this->owner->Categories());
438483
$categories = new GridField('ExcludedTracksForUploadPresentationSlideDeck', 'Excluded Tracks For Upload Presentation Slide Deck Email', $this->owner->ExcludedTracksForUploadPresentationSlideDeck(), $config);
439484
$f->addFieldToTab('Root.Speakers Emails', $categories);
485+
440486
}
441487
}
442488

0 commit comments

Comments
 (0)