index.php
Main Event Listing Page
This script serves as the homepage for the application. It displays a paginated list of events, visualizes the user's registration status (joined/available/locked), and handles navigation.
Table of Contents
Constants
- EVENTS_PER_PAGE = 6
- Defines the number of event cards displayed per pagination page.
Functions
- eventIsLocked() : bool
- Checks if the registration period for an event has closed.
- userIsRegistered() : bool
- Determines if a specific user is already registered for a specific event.
Constants
EVENTS_PER_PAGE
Defines the number of event cards displayed per pagination page.
public
mixed
EVENTS_PER_PAGE
= 6
Functions
eventIsLocked()
Checks if the registration period for an event has closed.
eventIsLocked(Event $event) : bool
Compares the current server time against the event's registration deadline.
Parameters
- $event : Event
-
The event object containing the deadline.
Return values
bool —True if the deadline has passed (locked), false otherwise.
userIsRegistered()
Determines if a specific user is already registered for a specific event.
userIsRegistered(int $user_id, int $event_id) : bool
Acts as a safe wrapper around the Registration::existsByUserIdAndEventId method, handling potential database exceptions by redirecting to an error page.
Parameters
- $user_id : int
-
The unique ID of the user.
- $event_id : int
-
The unique ID of the event.
Return values
bool —True if a registration record exists, false otherwise.