show dates/times in user's timezone
This commit is contained in:
@@ -55,7 +55,7 @@ class DatabaseService extends BaseService
|
||||
|
||||
# if any time fields are == to "now", then insert the right time
|
||||
foreach($this->time_fields as $tf) {
|
||||
if(array_key_exists($tf, $row) && $row[$tf] === 'now') {
|
||||
if(array_key_exists($tf, $row) && strtolower($row[$tf]) === 'now') {
|
||||
$row[$tf] = $this->time();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,13 +178,26 @@ class GeoService extends BaseService
|
||||
* @param Pirep $pirep
|
||||
* @return array
|
||||
*/
|
||||
public function pirepGeoJson(Pirep $pirep)
|
||||
public function pirepGeoJson($pirep)
|
||||
{
|
||||
$coords = [];
|
||||
$coords[] = [$pirep->dpt_airport->lon, $pirep->dpt_airport->lat];
|
||||
|
||||
// TODO: Add markers for the start/end airports
|
||||
// TODO: Read from the ACARS data table
|
||||
|
||||
// TODO: Check if there's data in the ACARS table
|
||||
if (!empty($pirep->route)) {
|
||||
$route_coords = $this->getCoordsFromRoute(
|
||||
$pirep->dpt_airport->icao,
|
||||
$pirep->arr_airport->icao,
|
||||
[$pirep->dpt_airport->lat, $pirep->dpt_airport->lon],
|
||||
$pirep->route);
|
||||
|
||||
// lat, lon needs to be reversed for GeoJSON
|
||||
foreach ($route_coords as $rc) {
|
||||
$coords[] = [$rc[1], $rc[0]];
|
||||
}
|
||||
}
|
||||
|
||||
$coords[] = [$pirep->arr_airport->lon, $pirep->arr_airport->lat];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user