Skip to content

Commit

Permalink
add datahub
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhollmann committed Dec 9, 2023
1 parent dd4d5de commit fef37dd
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 60 deletions.
1 change: 0 additions & 1 deletion data/edff_allstations.csv

This file was deleted.

1 change: 0 additions & 1 deletion data/edff_minstations.csv

This file was deleted.

12 changes: 0 additions & 12 deletions data/edff_weekly.json

This file was deleted.

1 change: 0 additions & 1 deletion data/edll_allstations.csv

This file was deleted.

1 change: 0 additions & 1 deletion data/edll_minstations.csv

This file was deleted.

17 changes: 0 additions & 17 deletions data/edll_weekly.json

This file was deleted.

1 change: 1 addition & 0 deletions datahub.class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
include_once("conf.php");

class Datahub
{
Expand Down
8 changes: 5 additions & 3 deletions public/edff/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
$MASTER_DATE->add(new DateInterval('P7D'));
}

$weeklyBookings = Datahub::get_weekly_data('edff');
$key = 'edff';

$min_stations = Datahub::get_stations_data('edff', true);
$main_stations = Datahub::get_stations_data('edff', false);
$weeklyBookings = Datahub::get_weekly_data($key);

$min_stations = Datahub::get_stations_data($key, true);
$main_stations = Datahub::get_stations_data($key, false);


$booked_stations = DataManager::get_matched_station_array_bookings(clone $MASTER_DATE, 7, $main_stations);
Expand Down
19 changes: 7 additions & 12 deletions public/edll/index.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
<?php
require_once ("../../conf.php");
require_once("../../conf.php");
require_once(_BASE_PATH_ . "datamanager.class.php");
require_once(_BASE_PATH_ . "datahub.class.php");
require_once(_BASE_PATH_ . "imagerenderer.class.php");

$MASTER_DATE = new DateTime();
if (isset($_GET['nextWeek'])) {
$MASTER_DATE->add(new DateInterval('P7D'));
}

$key = 'edll';

$stationsFile = fopen(_DATA_PATH_ . "edll_allstations.csv", "r") or die("Unable to open allstations file!");
$minStationsFile = fopen(_DATA_PATH_ . "edll_minstations.csv", "r") or die("Unable to open minstations file!");
$allStationsString = fgets($stationsFile);
$minStationsString = fgets($minStationsFile);
$weeklyBookings = Datahub::get_weekly_data($key);

$min_stations = Datahub::get_stations_data($key, true);
$main_stations = Datahub::get_stations_data($key, false);

$bookingsString = file_get_contents(_DATA_PATH_ . "edll_weekly.json") or die("Unable to open weekly file!");
$weeklyBookings = json_decode($bookingsString);


$min_stations = explode(',',$minStationsString);
$main_stations = explode(',',$allStationsString);

$booked_stations = DataManager::get_matched_station_array_bookings(clone $MASTER_DATE,7 , $main_stations);
$booked_stations = DataManager::get_matched_station_array_bookings(clone $MASTER_DATE, 7, $main_stations);

$img = ImageRenderer::render($min_stations, $main_stations, $booked_stations, $MASTER_DATE, $weeklyBookings);

Expand Down
19 changes: 7 additions & 12 deletions public/edmm/index.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
<?php
require_once ("../../conf.php");
require_once("../../conf.php");
require_once(_BASE_PATH_ . "datamanager.class.php");
require_once(_BASE_PATH_ . "datahub.class.php");
require_once(_BASE_PATH_ . "imagerenderer.class.php");

$MASTER_DATE = new DateTime();
if (isset($_GET['nextWeek'])) {
$MASTER_DATE->add(new DateInterval('P7D'));
}

$key = 'edmm';

$stationsFile = fopen(_DATA_PATH_ . "edmm_allstations.csv", "r") or die("Unable to open allstations file!");
$minStationsFile = fopen(_DATA_PATH_ . "edmm_minstations.csv", "r") or die("Unable to open minstations file!");
$allStationsString = fgets($stationsFile);
$minStationsString = fgets($minStationsFile);
$weeklyBookings = Datahub::get_weekly_data($key);

$min_stations = Datahub::get_stations_data($key, true);
$main_stations = Datahub::get_stations_data($key, false);

$bookingsString = file_get_contents(_DATA_PATH_ . "edmm_weekly.json") or die("Unable to open weekly file!");
$weeklyBookings = json_decode($bookingsString);


$min_stations = explode(',',$minStationsString);
$main_stations = explode(',',$allStationsString);

$booked_stations = DataManager::get_matched_station_array_bookings(clone $MASTER_DATE,7 , $main_stations);
$booked_stations = DataManager::get_matched_station_array_bookings(clone $MASTER_DATE, 7, $main_stations);

$img = ImageRenderer::render($min_stations, $main_stations, $booked_stations, $MASTER_DATE, $weeklyBookings);

Expand Down

0 comments on commit fef37dd

Please sign in to comment.