-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinc.trip-ics.php
29 lines (27 loc) · 1.15 KB
/
inc.trip-ics.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
require_once 'autoload.php';
$description = "";
$description .= "Using ".$trip->vehicle->name.": ".$trip->vehiclePUOptions.' - '.$trip->vehicleDOOptions."\\n\\n";
$description .= "PU ".$trip->guests." at ".$trip->puLocation->name."\\n\\n";
$description .= "DO ".$trip->doLocation->name."\\n\\n";
if ($trip->flightNumber) {
$description .= "Flight ".$trip->airline->name." ".$trip->airline->flightNumberPrefix.$trip->flightNumber." ";
if ($trip->ETA) {
$description .= "ETA ".Date('g:ia', strtotime($trip->ETA))."\\n\\n";
} else {
$description .= "ETD ".Date('g:ia', strtotime($trip->ETD))."\\n\\n";
}
}
$description .= "Contact: ".$trip->guest->getName()." ".$trip->guest->phoneNumber."\\n\\n";
if ($trip->driverNotes) {
$description .= "Additional Driver Notes:\\n";
$description .= str_replace("\n", "\\n", $trip->driverNotes)."\\n";
}
$ics = new ICS([
'dtstart' => $trip->startDate,
'dtend' => $trip->endDate,
'description' => $description,
'summary' => $trip->summary,
'location' => str_replace("\n", "\\n", $trip->puLocation->mapAddress),
'url' => 'https://'.$_SERVER['HTTP_HOST'].'/print.trip-driver-sheet.php?id='.$trip->getId()
]);