GatheringWaiversCell
extends Cell
in package
Gathering Waivers View Cell
Purpose: Displays comprehensive waiver information for a gathering, combining waiver requirements from activities with upload interface and management functionality. This is a merged view that consolidates what were previously separate "Required Waivers" and "Waivers" tabs into a single cohesive interface.
Core Responsibilities:
- Requirement Aggregation - Shows all waiver types required for the gathering
- Upload Statistics - Displays counts of uploaded waivers by type
- Upload Interface - Provides access to waiver upload functionality
- Waiver Management - Links to waiver listing and management interfaces
- Status Tracking - Shows collection status
Architecture: This view cell extends CakePHP Cell to provide reusable waiver management functionality for gathering views. It integrates with the Waivers plugin system and the ViewCellRegistry for automatic tab injection.
Display Features:
- Gathering-Level Table: Shows each required waiver type for the gathering
- Completion Status: Visual indicators (progress bars/badges) for each waiver type
- Upload Indicators: Color-coded badges showing which waivers have been uploaded
- Overall Summary: Top-level statistics showing complete vs pending waivers
- Upload Button: Quick access to waiver upload interface (when authorized)
- Waiver Management Links: Navigation to full waiver listing and management
- Empty States: Helpful guidance when no waivers required or uploaded
- Instructions: Step-by-step upload and configuration instructions
Gathering Context Support:
- Gathering View Integration: Embedded as tab in gathering detail pages
- Authorization: Respects user permissions for upload and management
Integration Points:
- GatheringsTable - Gathering entity data
- GatheringWaiversTable - Uploaded waiver statistics
- GatheringActivityWaiversTable - Required waiver types
- WaiverTypesTable - Waiver type details
- ViewCellRegistry - Automatic tab injection
Data Loading Logic:
- Load gathering with activities
- Check if any waivers have been uploaded
- Calculate statistics by waiver type
- Determine required waiver types from activities
- Prepare display data
Performance Considerations:
- Efficient queries with selective field loading
- Single query for statistics aggregation
- Cached waiver type lookups
Usage Examples:
// Gathering view integration (automatic via ViewCellRegistry)
echo $this->cell('Waivers.GatheringWaivers', [$gatheringId]);
Template Integration: Renders tab interface with:
- Upload button for authorized users
- Statistics cards for each required waiver type
- Links to waiver listing and management
- Status alerts and instructions
- Empty states for no requirements or uploads
Security Features:
- Authorization checks for upload and management actions
- Secure gathering identification
- User-specific permission handling
Error Handling:
- Graceful handling of missing gathering data
- Empty state for gatherings without activities
- Empty state for activities without waiver requirements
Troubleshooting:
- Verify gathering exists and has valid ID
- Check waiver table associations are correct
- Validate activity waiver requirements are configured
- Monitor query performance for gatherings with many waivers
Tags
Table of Contents
Methods
- display() : void
- Display Gathering Waivers Interface
- initialize() : void
- Initialization logic run at the end of object construction.
Methods
display()
Display Gathering Waivers Interface
public
display(int $gatheringId[, string|null $model = null ]) : void
Generates waiver-centric display for a gathering, showing each waiver requirement as a separate row with its upload status.
Display Components:
- Individual rows for each activity/waiver combination
- Upload status indicator (checkmark/count) per row
- Upload button for authorized users
- Summary statistics
- Links to waiver management
- Instructions for configuration and upload
Data Loading Process:
- Load gathering with activities
- Load all waiver requirements across the gathering
- Get uploaded waiver counts by type
- Calculate upload status per waiver requirement
- Prepare waiver-centric data structure
Waiver Row Structure: Creates an array where each element represents one waiver requirement:
- waiver_type: WaiverType entity
- uploaded_count: Number of waivers uploaded for this waiver type
- is_complete: Boolean indicating if at least one waiver has been uploaded or attested
Data Preparation: Sets template variables:
- gathering: Full gathering entity
- gatheringId: Gathering identifier
- waiverRows: Array of waiver requirement rows
- isEmpty: Boolean indicating if gathering has any waiver requirements
- hasWaivers: Boolean indicating if any waivers uploaded
- overallStats: Overall completion statistics across all requirements
Note: User is accessed in the template via $this->getRequest()->getAttribute('identity')
Parameters
- $gatheringId : int
-
Gathering ID
- $model : string|null = null
-
Optional model name (for compatibility with view cell pattern)
initialize()
Initialization logic run at the end of object construction.
public
initialize() : void