BestowalCourtSlotService
in package
Court slots tie a bestowal to a scheduled activity on the gathering's Event Schedule, or to roaming court when the award may be given at any time during the event.
Table of Contents
Constants
- ROAMING_COURT_VALUE : mixed = 'roaming'
- Form/API value for the roaming court dropdown option.
Methods
- applyCourtSessionSelection() : void
- Apply court session form input to a bestowal entity.
- applyEligibleCourtSessionSelection() : void
- Apply a to-do court assignment, accepting only roaming or award-eligible scheduled activities.
- buildEligibleOptionsForBestowal() : array<int|string, string>
- Build court assignment options limited to sessions that can give the bestowal award.
-
buildInitialFormData()
: array{options: array
, available: bool, hasScheduledSessions: bool, optionDates: array , gatheringStartDate: string|null, suggestedBestowedDate: string|null} - Build the initial court slot data needed by edit forms in one pass.
- buildOptionDates() : array<int|string, string>
- Court session ID (or roaming) => bestowal date (Y-m-d).
- buildOptions() : array<int|string, string>
- Build select options for court slot dropdowns.
- countScheduledActivities() : int
- courtSessionSelectValue() : string|int|null
- Selected value for the court session dropdown.
- fieldHelpText() : string
- Help text shown when court slot selection is available.
- formatCourtSlotDisplay() : string
- Display label for grid and detail views.
- formatCourtSlotExport() : string
- Format a court slot for spreadsheet-safe plain-text exports.
- gatheringSupportsCourtSlots() : bool
- Whether court session selection is available for a gathering.
- getGatheringStartDateYmd() : string|null
- First day of the gathering event (Y-m-d), or null when unknown.
- hasAgendaAssignment() : bool
- Whether the bestowal already satisfies the Added to Agenda court assignment requirement.
- isRoamingCourt() : bool
- Whether the bestowal is scheduled for roaming court (handles DB boolean types).
- noScheduleMessage() : string
- Message when the gathering has no schedule entries yet.
- resolveBestowedDate() : string|null
- Suggested bestowed date: court session day when assigned, otherwise first day of the event.
- roamingCourtLabel() : string
- Human-readable label for roaming court.
- scheduledActivityCanGiveBestowalAward() : bool
- Check whether a scheduled activity belongs to the bestowal gathering and can give its award.
- buildActivityLabel() : string
- courtSessionDateYmd() : string
- fetchEligibleScheduledActivities() : array<int, object>
- fetchScheduledActivities() : array<int, object>
- findGatheringStartDateYmd() : string|null
- First day of a gathering as Y-m-d, or null when missing.
- formatCourtSessionStart() : string
- suggestedBestowedDateFromContext() : string|null
Constants
ROAMING_COURT_VALUE
Form/API value for the roaming court dropdown option.
public
mixed
ROAMING_COURT_VALUE
= 'roaming'
Methods
applyCourtSessionSelection()
Apply court session form input to a bestowal entity.
public
applyCourtSessionSelection(Bestowal $bestowal, mixed $rawActivityId) : void
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
- $rawActivityId : mixed
-
Submitted gathering_scheduled_activity_id value.
applyEligibleCourtSessionSelection()
Apply a to-do court assignment, accepting only roaming or award-eligible scheduled activities.
public
applyEligibleCourtSessionSelection(Bestowal $bestowal, mixed $rawActivityId) : void
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
- $rawActivityId : mixed
-
Submitted court assignment value.
buildEligibleOptionsForBestowal()
Build court assignment options limited to sessions that can give the bestowal award.
public
buildEligibleOptionsForBestowal(Bestowal $bestowal[, Member|array<string|int, mixed>|null $member = null ]) : array<int|string, string>
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
- $member : Member|array<string|int, mixed>|null = null
-
Viewer for timezone conversion.
Return values
array<int|string, string> —Option value => label.
buildInitialFormData()
Build the initial court slot data needed by edit forms in one pass.
public
buildInitialFormData(int|null $gatheringId[, string|int|null $selectedActivityId = null ][, Member|array<string|int, mixed>|null $member = null ][, bool $roamingCourtSelected = false ]) : array{options: array, available: bool, hasScheduledSessions: bool, optionDates: array, gatheringStartDate: string|null, suggestedBestowedDate: string|null}
Parameters
- $gatheringId : int|null
-
Gathering primary key.
- $selectedActivityId : string|int|null = null
-
Selected scheduled activity or roaming value.
- $member : Member|array<string|int, mixed>|null = null
-
Viewer for timezone conversion.
- $roamingCourtSelected : bool = false
-
Whether roaming court is the current selection.
Return values
array{options: arraybuildOptionDates()
Court session ID (or roaming) => bestowal date (Y-m-d).
public
buildOptionDates(int|null $gatheringId[, Member|array<string|int, mixed>|null $member = null ]) : array<int|string, string>
Parameters
- $gatheringId : int|null
-
Gathering primary key.
- $member : Member|array<string|int, mixed>|null = null
-
Viewer for timezone conversion.
Return values
array<int|string, string>buildOptions()
Build select options for court slot dropdowns.
public
buildOptions(int|null $gatheringId[, int|null $selectedActivityId = null ][, Member|array<string|int, mixed>|null $member = null ][, bool $roamingCourtSelected = false ]) : array<int|string, string>
Parameters
- $gatheringId : int|null
-
Gathering primary key.
- $selectedActivityId : int|null = null
-
Currently selected scheduled activity.
- $member : Member|array<string|int, mixed>|null = null
-
Viewer for timezone conversion.
- $roamingCourtSelected : bool = false
-
Whether roaming court is the current selection.
Return values
array<int|string, string> —Option value => label
countScheduledActivities()
public
countScheduledActivities(int|null $gatheringId) : int
Parameters
- $gatheringId : int|null
-
Gathering primary key.
Return values
intcourtSessionSelectValue()
Selected value for the court session dropdown.
public
courtSessionSelectValue(Bestowal $bestowal) : string|int|null
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
Return values
string|int|nullfieldHelpText()
Help text shown when court slot selection is available.
public
static fieldHelpText() : string
Return values
stringformatCourtSlotDisplay()
Display label for grid and detail views.
public
formatCourtSlotDisplay(Bestowal $bestowal) : string
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
Return values
stringformatCourtSlotExport()
Format a court slot for spreadsheet-safe plain-text exports.
public
formatCourtSlotExport(Bestowal $bestowal) : string
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
Return values
stringgatheringSupportsCourtSlots()
Whether court session selection is available for a gathering.
public
gatheringSupportsCourtSlots(int|null $gatheringId) : bool
Parameters
- $gatheringId : int|null
-
Gathering primary key.
Return values
boolgetGatheringStartDateYmd()
First day of the gathering event (Y-m-d), or null when unknown.
public
getGatheringStartDateYmd(int|null $gatheringId) : string|null
Parameters
- $gatheringId : int|null
-
Gathering primary key.
Return values
string|nullhasAgendaAssignment()
Whether the bestowal already satisfies the Added to Agenda court assignment requirement.
public
hasAgendaAssignment(Bestowal $bestowal) : bool
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
Return values
boolisRoamingCourt()
Whether the bestowal is scheduled for roaming court (handles DB boolean types).
public
isRoamingCourt(Bestowal $bestowal) : bool
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
Return values
boolnoScheduleMessage()
Message when the gathering has no schedule entries yet.
public
static noScheduleMessage() : string
Return values
stringresolveBestowedDate()
Suggested bestowed date: court session day when assigned, otherwise first day of the event.
public
resolveBestowedDate(int|null $gatheringId[, string|int|null $scheduledActivityId = null ][, Member|array<string|int, mixed>|null $member = null ]) : string|null
Parameters
- $gatheringId : int|null
-
Gathering primary key.
- $scheduledActivityId : string|int|null = null
-
Scheduled court activity or roaming value.
- $member : Member|array<string|int, mixed>|null = null
-
Viewer for timezone conversion.
Return values
string|null —Date in Y-m-d form.
roamingCourtLabel()
Human-readable label for roaming court.
public
static roamingCourtLabel() : string
Return values
stringscheduledActivityCanGiveBestowalAward()
Check whether a scheduled activity belongs to the bestowal gathering and can give its award.
public
scheduledActivityCanGiveBestowalAward(Bestowal $bestowal, int $scheduledActivityId) : bool
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
- $scheduledActivityId : int
-
Scheduled gathering activity id.
Return values
boolbuildActivityLabel()
private
buildActivityLabel(object $activity[, Member|array<string|int, mixed>|null $member = null ]) : string
Parameters
- $activity : object
-
Scheduled activity entity.
- $member : Member|array<string|int, mixed>|null = null
-
Viewer for timezone conversion.
Return values
stringcourtSessionDateYmd()
private
courtSessionDateYmd(DateTime|string $startDatetime[, Member|array<string|int, mixed>|null $member = null ]) : string
Parameters
- $startDatetime : DateTime|string
-
UTC stored start time.
- $member : Member|array<string|int, mixed>|null = null
-
Viewer for timezone conversion.
Return values
string —Date in Y-m-d form in the viewer's timezone.
fetchEligibleScheduledActivities()
private
fetchEligibleScheduledActivities(Bestowal $bestowal) : array<int, object>
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
Return values
array<int, object>fetchScheduledActivities()
private
fetchScheduledActivities(int|null $gatheringId[, int|string|null $selectedActivityId = null ]) : array<int, object>
Parameters
- $gatheringId : int|null
- $selectedActivityId : int|string|null = null
Return values
array<int, object>findGatheringStartDateYmd()
First day of a gathering as Y-m-d, or null when missing.
private
findGatheringStartDateYmd(int|null $gatheringId) : string|null
Parameters
- $gatheringId : int|null
-
Gathering primary key.
Return values
string|nullformatCourtSessionStart()
private
formatCourtSessionStart(DateTime|string $startDatetime[, Member|array<string|int, mixed>|null $member = null ]) : string
Parameters
- $startDatetime : DateTime|string
-
UTC stored start time.
- $member : Member|array<string|int, mixed>|null = null
-
Viewer for timezone conversion.
Return values
stringsuggestedBestowedDateFromContext()
private
suggestedBestowedDateFromContext(int|string|null $scheduledActivityId, array<int|string, string> $optionDates, string|null $gatheringStartDate) : string|null
Parameters
- $scheduledActivityId : int|string|null
- $optionDates : array<int|string, string>
- $gatheringStartDate : string|null