Documentation

WeeklyScheduleManager
in package

WeeklyScheduleManager - Weekly Schedule Manager

Generates weekly views with vertical timeline (08:00-20:00) and course blocks positioned according to their schedule.

Tags
author

BDELIVE - Groupe 8

version
1.0.0

Table of Contents

Constants

END_HOUR  = 20
End hour of the day (20:00)
START_HOUR  = 8
Start hour of the day (08:00)
WEEKDAYS  = [1 => 'Lundi', 2 => 'Mardi', 3 => 'Mercredi', 4 => 'Jeudi', 5 => 'Vendredi', 6 => 'Samedi', 7 => 'Dimanche']
Days of the week

Methods

calculateEventPosition()  : array{top: string, height: string}
Calculates the CSS position and height of an event
generateWeeklySchedule()  : array{year: int, week: int, weekDates: array, events: array>>, prevWeek: int, nextWeek: int, prevYear: int, nextYear: int, hours: array}
Generates the complete structure of a weekly schedule
getTimeRange()  : array{start: int, end: int}
Gets the timeline time range
getWeekdayName()  : string
Gets the weekday name
getWeekDates()  : array<int, array{day: int, date: string, dayName: string, formatted: string}>
Calculates the dates of the days of the week
groupEventsByDay()  : array<string, array<int, array<string, mixed>>>
Groups events by day of the week

Constants

WEEKDAYS

Days of the week

private mixed WEEKDAYS = [1 => 'Lundi', 2 => 'Mardi', 3 => 'Mercredi', 4 => 'Jeudi', 5 => 'Vendredi', 6 => 'Samedi', 7 => 'Dimanche']

Methods

calculateEventPosition()

Calculates the CSS position and height of an event

public calculateEventPosition(string $startTime, string $endTime) : array{top: string, height: string}
Parameters
$startTime : string

Start time (format: "YYYY-MM-DD HH:MM:SS" or "HH:MM")

$endTime : string

End time

Return values
array{top: string, height: string}

generateWeeklySchedule()

Generates the complete structure of a weekly schedule

public generateWeeklySchedule(int $year, int $week[, array<int, array<string, mixed>> $events = [] ]) : array{year: int, week: int, weekDates: array, events: array>>, prevWeek: int, nextWeek: int, prevYear: int, nextYear: int, hours: array}
Parameters
$year : int

The year

$week : int

The week number (1-53)

$events : array<int, array<string, mixed>> = []

List of events for the week

Return values
array{year: int, week: int, weekDates: array, events: array>>, prevWeek: int, nextWeek: int, prevYear: int, nextYear: int, hours: array}

getTimeRange()

Gets the timeline time range

public getTimeRange() : array{start: int, end: int}
Return values
array{start: int, end: int}

getWeekdayName()

Gets the weekday name

public getWeekdayName(int $day) : string
Parameters
$day : int

The day (1-7, 1=Monday)

Return values
string

The day name

getWeekDates()

Calculates the dates of the days of the week

private getWeekDates(int $year, int $week) : array<int, array{day: int, date: string, dayName: string, formatted: string}>
Parameters
$year : int

The year

$week : int

The week number

Return values
array<int, array{day: int, date: string, dayName: string, formatted: string}>

groupEventsByDay()

Groups events by day of the week

private groupEventsByDay(array<int, array<string, mixed>> $events, array<int, array{date: string}> $weekDates) : array<string, array<int, array<string, mixed>>>
Parameters
$events : array<int, array<string, mixed>>

List of events

$weekDates : array<int, array{date: string}>

Week dates

Return values
array<string, array<int, array<string, mixed>>>

Events grouped by date


        
On this page

Search results