KMP PHP API Reference

CourtAgendaService
in package
uses LocatorAwareTrait

Builds and mutates gathering court agendas for visual planning and print output.

Table of Contents

Constants

LONG_AGENDA_MINUTES  : mixed = 90
LONG_SEGMENT_MINUTES  : mixed = 45
ROAMING_SEGMENT_NAME  : mixed = 'Roaming Court'

Properties

$awardActivityEligibility  : array<string, bool>
Request-local award/activity eligibility lookup keyed by "awardId:activityId".
$syncingAgendaPlacement  : bool
Re-entrancy guard for bestowal-driven agenda placement sync.

Methods

addBestowalToSegment()  : CourtAgendaItem
Add an eligible gathering bestowal to a court segment.
addBlock()  : CourtAgendaItem
addSegment()  : CourtAgendaSegment
buildAgendaViewModel()  : array<string, mixed>
ensureEligibleCourtSegments()  : int
Ensure scheduled gathering activities that can present awards are represented as court lanes.
estimateMinutesForBestowal()  : int
getOrCreateDefaultAgenda()  : CourtAgenda
importGatheringBestowals()  : int
Import bestowals already assigned to the agenda gathering.
moveItem()  : void
moveToRoamingCourt()  : CourtAgendaItem
Move a bestowal or existing agenda item into roaming court.
removeItem()  : void
Remove an agenda item from court planning.
syncAgendaPlacementForBestowal()  : void
Mirror a bestowal's court assignment onto its gathering's default agenda in real time.
updateItem()  : CourtAgendaItem
activityDisplayLabel()  : string
activityTimeLabel()  : string|null
applyAgendaPlacementForBestowal()  : void
assertBestowalCanUseSegment()  : void
assertScheduledActivityBelongsToGathering()  : void
assertSegmentCanAcceptAgendaItems()  : void
awardActivityEligibilityKey()  : string
awardLabel()  : string
bestowalAwardLabel()  : string
bestowalCanUseSegment()  : bool
bestowalsForEligibility()  : array<int, Bestowal>
clearBestowalCourtAssignment()  : void
consolidateAutoSegments()  : void
Collapse duplicate blank auto-created segments from earlier imports.
deleteEmptyLegacyCourtSegments()  : void
durationHint()  : string
eligibleBestowalsBySegment()  : array<int, array<int, Bestowal>>
eligibleScheduledActivitiesForGathering()  : array<int, object>
Scheduled activities that can host a court: any entry whose activity type can present awards, plus entries that already have bestowals assigned to them.
eligibleSegmentOptionsForBestowal()  : array<int, string>
eligibleSegmentOptionsFromMap()  : array<int, string>
emptyToNull()  : mixed
ensureRoamingSegment()  : CourtAgendaSegment
existingAgendaBestowalIds()  : array<int, int>
hydrateAgendaItemBestowals()  : void
isRoamingSegment()  : bool
itemLabel()  : string
moveSegmentItems()  : void
moveSegmentOptions()  : array<int, string>
nextItemSortOrder()  : int
nextSegmentSortOrder()  : int
nextSortOrder()  : int
placedBestowalIds()  : array<string|int, int>
plannedStartTimeLabel()  : string|null
Start-only label for the segment planned_start_time column (max 20 chars).
primeAwardActivityEligibility()  : void
recommendationReasons()  : array<int, string>
recommendationSpecialties()  : array<int, string>
renumberItems()  : void
resolveSegmentForBestowalSlot()  : CourtAgendaSegment|null
Resolve (creating when needed) the agenda segment matching a bestowal's court slot.
scheduledActivityLabel()  : string
scheduledActivityOptions()  : array<int|string, string>
segmentIdForBestowal()  : int
segmentIdForBestowalWithCache()  : int
segmentIdsByScheduledActivity()  : array<int, int>
segmentOptions()  : array<int, string>
syncBestowalPlacementFromSegment()  : void
syncBestowalStackRanksForAgenda()  : void
syncBestowalStackRanksForSegment()  : void
syncBestowalStackRanksForSegmentEntity()  : void
unscheduledBestowalData()  : array<int, array<string, mixed>>
unscheduledBestowals()  : array<int, Bestowal>

Constants

Properties

$awardActivityEligibility

Request-local award/activity eligibility lookup keyed by "awardId:activityId".

private array<string, bool> $awardActivityEligibility = []

$syncingAgendaPlacement

Re-entrancy guard for bestowal-driven agenda placement sync.

private static bool $syncingAgendaPlacement = false

Methods

addBestowalToSegment()

Add an eligible gathering bestowal to a court segment.

public addBestowalToSegment(int $agendaId, int $bestowalId, int $targetSegmentId[, int|null $actorId = null ]) : CourtAgendaItem
Parameters
$agendaId : int

Agenda ID.

$bestowalId : int

Bestowal ID.

$targetSegmentId : int

Target segment ID.

$actorId : int|null = null

Actor ID.

Return values
CourtAgendaItem

addBlock()

public addBlock(array<string, mixed> $data[, int|null $actorId = null ]) : CourtAgendaItem
Parameters
$data : array<string, mixed>

Submitted block data.

$actorId : int|null = null

Actor ID.

Return values
CourtAgendaItem

buildAgendaViewModel()

public buildAgendaViewModel(int $agendaId) : array<string, mixed>
Parameters
$agendaId : int

Agenda ID.

Return values
array<string, mixed>

ensureEligibleCourtSegments()

Ensure scheduled gathering activities that can present awards are represented as court lanes.

public ensureEligibleCourtSegments(int $agendaId[, int|null $actorId = null ]) : int
Parameters
$agendaId : int

Agenda ID.

$actorId : int|null = null

Optional actor ID.

Return values
int

Number of created segments.

estimateMinutesForBestowal()

public estimateMinutesForBestowal(object $bestowal) : int
Parameters
$bestowal : object

Bestowal entity.

Return values
int

getOrCreateDefaultAgenda()

public getOrCreateDefaultAgenda(int $gatheringId[, int|null $actorId = null ]) : CourtAgenda
Parameters
$gatheringId : int

Gathering ID.

$actorId : int|null = null

Optional actor ID for audit fields.

Return values
CourtAgenda

importGatheringBestowals()

Import bestowals already assigned to the agenda gathering.

public importGatheringBestowals(int $agendaId[, int|null $actorId = null ]) : int
Parameters
$agendaId : int

Agenda ID.

$actorId : int|null = null

Optional actor ID.

Return values
int

Number of imported items.

moveItem()

public moveItem(int $itemId, int $targetSegmentId, int $targetSortOrder[, int|null $actorId = null ]) : void
Parameters
$itemId : int

Item ID.

$targetSegmentId : int

Target segment ID.

$targetSortOrder : int

Target order.

$actorId : int|null = null

Actor ID.

moveToRoamingCourt()

Move a bestowal or existing agenda item into roaming court.

public moveToRoamingCourt(int $agendaId[, int|null $itemId = null ][, int|null $bestowalId = null ][, int|null $actorId = null ]) : CourtAgendaItem
Parameters
$agendaId : int

Agenda ID.

$itemId : int|null = null

Optional agenda item ID.

$bestowalId : int|null = null

Optional bestowal ID.

$actorId : int|null = null

Actor ID.

Return values
CourtAgendaItem

removeItem()

Remove an agenda item from court planning.

public removeItem(int $itemId[, int|null $actorId = null ]) : void

Bestowal items stay assigned to the gathering, but their court slot is cleared so they return to the eligible backlog instead of roaming court.

Parameters
$itemId : int

Item ID.

$actorId : int|null = null

Actor ID.

syncAgendaPlacementForBestowal()

Mirror a bestowal's court assignment onto its gathering's default agenda in real time.

public syncAgendaPlacementForBestowal(Bestowal $bestowal[, int|null $actorId = null ]) : void

Invoked from BestowalsTable::afterSave whenever the gathering or court slot fields change, so agenda items follow the canonical bestowal fields without a manual "Refresh Scheduled Bestowals" pass: assignments create or move the bestowal's agenda item, cleared slots (or gathering moves) remove stale items. Only PRESENT bestowal items are managed — interjection blocks are untouched, and this direction never writes bestowal fields or to-dos.

Parameters
$bestowal : Bestowal

Saved bestowal.

$actorId : int|null = null

Actor for audit columns on created rows.

updateItem()

public updateItem(int $itemId, array<string, mixed> $data[, int|null $actorId = null ]) : CourtAgendaItem
Parameters
$itemId : int

Item ID.

$data : array<string, mixed>

Submitted data.

$actorId : int|null = null

Actor ID.

Return values
CourtAgendaItem

activityDisplayLabel()

private activityDisplayLabel(object $activity) : string
Parameters
$activity : object

Scheduled activity.

Return values
string

activityTimeLabel()

private activityTimeLabel(object $activity) : string|null
Parameters
$activity : object

Scheduled activity.

Return values
string|null

applyAgendaPlacementForBestowal()

private applyAgendaPlacementForBestowal(Bestowal $bestowal, int|null $actorId) : void
Parameters
$bestowal : Bestowal

Saved bestowal.

$actorId : int|null

Actor ID.

assertScheduledActivityBelongsToGathering()

private assertScheduledActivityBelongsToGathering(int $scheduledActivityId, int $gatheringId) : void
Parameters
$scheduledActivityId : int

Scheduled gathering activity ID.

$gatheringId : int

Agenda gathering ID.

awardActivityEligibilityKey()

private awardActivityEligibilityKey(int $awardId, int $activityId) : string
Parameters
$awardId : int

Award ID.

$activityId : int

Gathering activity ID.

Return values
string

clearBestowalCourtAssignment()

private clearBestowalCourtAssignment(Bestowal $bestowal, int|null $actorId) : void
Parameters
$bestowal : Bestowal

Bestowal.

$actorId : int|null

Actor ID.

consolidateAutoSegments()

Collapse duplicate blank auto-created segments from earlier imports.

private consolidateAutoSegments(int $agendaId, int|null $actorId) : void
Parameters
$agendaId : int

Agenda ID.

$actorId : int|null

Actor ID.

deleteEmptyLegacyCourtSegments()

private deleteEmptyLegacyCourtSegments(int $agendaId) : void
Parameters
$agendaId : int

Agenda ID.

eligibleScheduledActivitiesForGathering()

Scheduled activities that can host a court: any entry whose activity type can present awards, plus entries that already have bestowals assigned to them.

private eligibleScheduledActivitiesForGathering(int $gatheringId) : array<int, object>
Parameters
$gatheringId : int

Gathering ID.

Return values
array<int, object>

eligibleSegmentOptionsFromMap()

private eligibleSegmentOptionsFromMap(Bestowal $bestowal, array<int, CourtAgendaSegment$segments, array<int, array<int, Bestowal>> $eligibleBySegment) : array<int, string>
Parameters
$bestowal : Bestowal

Bestowal.

$segments : array<int, CourtAgendaSegment>

Court segments.

$eligibleBySegment : array<int, array<int, Bestowal>>

Eligible bestowals by segment.

Return values
array<int, string>

emptyToNull()

private emptyToNull(mixed $value) : mixed
Parameters
$value : mixed

Value.

existingAgendaBestowalIds()

private existingAgendaBestowalIds(int $agendaId, array<int, Bestowal$bestowals) : array<int, int>
Parameters
$agendaId : int

Agenda ID.

$bestowals : array<int, Bestowal>

Candidate bestowals.

Return values
array<int, int>

moveSegmentItems()

private moveSegmentItems(int $sourceSegmentId, int $targetSegmentId, int|null $actorId) : void
Parameters
$sourceSegmentId : int

Source segment ID.

$targetSegmentId : int

Target segment ID.

$actorId : int|null

Actor ID.

nextItemSortOrder()

private nextItemSortOrder(int $segmentId) : int
Parameters
$segmentId : int

Segment ID.

Return values
int

nextSegmentSortOrder()

private nextSegmentSortOrder(int $agendaId) : int
Parameters
$agendaId : int

Agenda ID.

Return values
int

nextSortOrder()

private nextSortOrder(Table $table, string $foreignKey, int $foreignId) : int
Parameters
$table : Table

Table instance.

$foreignKey : string

Foreign key.

$foreignId : int

Foreign ID.

Return values
int

plannedStartTimeLabel()

Start-only label for the segment planned_start_time column (max 20 chars).

private plannedStartTimeLabel(object $activity) : string|null
Parameters
$activity : object

Scheduled activity.

Return values
string|null

renumberItems()

private renumberItems(int $segmentId) : void
Parameters
$segmentId : int

Segment ID.

resolveSegmentForBestowalSlot()

Resolve (creating when needed) the agenda segment matching a bestowal's court slot.

private resolveSegmentForBestowalSlot(Bestowal $bestowal, int $gatheringId, int|null $actorId) : CourtAgendaSegment|null
Parameters
$bestowal : Bestowal

Saved bestowal.

$gatheringId : int

Bestowal gathering ID.

$actorId : int|null

Actor ID.

Return values
CourtAgendaSegment|null

Null when the bestowal has no valid slot.

scheduledActivityOptions()

private scheduledActivityOptions(int $gatheringId) : array<int|string, string>
Parameters
$gatheringId : int

Gathering ID.

Return values
array<int|string, string>

segmentIdForBestowal()

private segmentIdForBestowal(int $agendaId, object $bestowal, int|null $actorId) : int
Parameters
$agendaId : int

Agenda ID.

$bestowal : object

Bestowal entity.

$actorId : int|null

Actor ID.

Return values
int

segmentIdForBestowalWithCache()

private segmentIdForBestowalWithCache(int $agendaId, object $bestowal, int|null $actorId, array<int, int> &$segmentIdsByActivity) : int
Parameters
$agendaId : int

Agenda ID.

$bestowal : object

Bestowal entity.

$actorId : int|null

Actor ID.

$segmentIdsByActivity : array<int, int>

Cached scheduled activity to segment map.

Return values
int

syncBestowalStackRanksForAgenda()

private syncBestowalStackRanksForAgenda(int $agendaId) : void
Parameters
$agendaId : int

Agenda ID.

syncBestowalStackRanksForSegment()

private syncBestowalStackRanksForSegment(int $segmentId) : void
Parameters
$segmentId : int

Segment ID.

unscheduledBestowalData()

private unscheduledBestowalData(array<int, Bestowal$bestowals, array<int, CourtAgendaSegment$segments, array<string|int, mixed> $eligibleBySegment) : array<int, array<string, mixed>>
Parameters
$bestowals : array<int, Bestowal>

Unscheduled bestowals.

$segments : array<int, CourtAgendaSegment>

Court segments.

$eligibleBySegment : array<string|int, mixed>
Return values
array<int, array<string, mixed>>

unscheduledBestowals()

private unscheduledBestowals(CourtAgenda $agenda, array<string|int, int> $placedBestowalIds) : array<int, Bestowal>
Parameters
$agenda : CourtAgenda

Agenda.

$placedBestowalIds : array<string|int, int>

Bestowal IDs already on the agenda.

Return values
array<int, Bestowal>
On this page

Search results