Daniel 04298d4498 Smol updates | %!s(int64=2) %!d(string=hai) anos | |
---|---|---|
EuroScope.ttf | %!s(int64=2) %!d(string=hai) anos | |
FRAShuttle.jpg.php | %!s(int64=3) %!d(string=hai) anos | |
README.md | %!s(int64=3) %!d(string=hai) anos | |
Schedule.php | %!s(int64=2) %!d(string=hai) anos | |
Tuesday.jpg.php | %!s(int64=2) %!d(string=hai) anos | |
UbuntuMono-Bold.ttf | %!s(int64=2) %!d(string=hai) anos | |
UbuntuMono-Regular.ttf | %!s(int64=3) %!d(string=hai) anos | |
Woche.jpg.php | %!s(int64=3) %!d(string=hai) anos | |
Woche2.jpg.php | %!s(int64=3) %!d(string=hai) anos | |
config.php | %!s(int64=2) %!d(string=hai) anos | |
darkmode.php | %!s(int64=3) %!d(string=hai) anos | |
example.jpg | %!s(int64=3) %!d(string=hai) anos | |
test.jpg.php | %!s(int64=3) %!d(string=hai) anos |
It is recommended to set up a separate PHP file for each overview you would like to create. Alternatively one file can be created that outputs images to files using a cronjob. If multiple overviews use the same stations, optional stations or wanted stations, a central config file might be useful.
A new Overview is created by making a new instance of the Schedule class:
$schedule = new Schedule($displaydates, $stations, $optstations, $wantedstations, $darkmode);
$displaydates
is an Array that should be created with one of the helper functions:
Schedule::EveryXDaysFromStartdate (String startdate, int x, int numberofdays = 1)
- Returns an array of DateTime objects. For regularly recurring events. Define a startdate and an interval in days for the event. numberofdays defines how many upcoming days will be returned.EveryXWeeksFromStartdate (String startdate, int x, int numberofdays = 1)
- Returns an array of DateTime objects. For regularly recurring events. Define a startdate and an interval in weeks for the event. numberofdays defines how many upcoming days will be returned. This is just an alias for EveryXDaysFromStardate with the input for x being x*7.EveryWeekday (String weekday, int numberofdays)
- Returns a list of datetime objects. This can be used for weekly events. Define a day of the week (such as "Wednesday") and the number of days to be displayed.WholeWeek (int shift = 0)
- Returns a list of 7 datetime objects for consecutive days. Will start with today + shift days.$stations
- an array of the stations that are to be displayed (including optional ones!). The String --
can be used to display a visual seperator.$optstations
- an array of the stations that are only to be displayed when there is a booking for that station. Defaults to []
.$wantedstations
- A 2-dimensional array of stations and dates that should show "Wanted!" instead of "Open" when no booking is made. Defaults to []
. A helper function to create this array is provided:
Schedule::processWantedDays(array stations, array dates, ...)
: In pairs of stations and dates each, provide as many pairs as needed. Stations should just be a plain array of stations, dates should once again be an array of DateTime objects, ideally using the helper functions described above.$darkmode
- Whether to display a dark or light background. Defaults to false
. The attached darkmode.php
provides a way to set a cookie for the darkmode which can be used to feed this value.The image will be creted calling the createImage
method.
$image = $schedule->createImage();
imagejpg($image);