Daniel 04298d4498 Smol updates | 2 年 前 | |
---|---|---|
EuroScope.ttf | 2 年 前 | |
FRAShuttle.jpg.php | 3 年 前 | |
README.md | 3 年 前 | |
Schedule.php | 2 年 前 | |
Tuesday.jpg.php | 2 年 前 | |
UbuntuMono-Bold.ttf | 2 年 前 | |
UbuntuMono-Regular.ttf | 3 年 前 | |
Woche.jpg.php | 3 年 前 | |
Woche2.jpg.php | 3 年 前 | |
config.php | 2 年 前 | |
darkmode.php | 3 年 前 | |
example.jpg | 3 年 前 | |
test.jpg.php | 3 年 前 |
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);