diff options
| -rw-r--r-- | app/Resources/views/base.html.twig | 3 | ||||
| -rw-r--r-- | app/Resources/views/default/TrainSchedule.html.twig | 32 | ||||
| -rw-r--r-- | src/AppBundle/Controller/LastWeekDataController.php | 1 | ||||
| -rw-r--r-- | src/AppBundle/Controller/TrainScheduleController.php | 31 | 
4 files changed, 66 insertions, 1 deletions
| diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index 36b2851..f8d8374 100644 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -20,6 +20,9 @@              <a class="navbar-item" href="/LastWeekData">                  <span>Last Week Data</span>              </a> +            <a class="navbar-item" href="/TrainSchedule"> +                <span>Train Schedule</span> +            </a>          </div>      </nav>      <div class="container"> diff --git a/app/Resources/views/default/TrainSchedule.html.twig b/app/Resources/views/default/TrainSchedule.html.twig new file mode 100644 index 0000000..a2c8572 --- /dev/null +++ b/app/Resources/views/default/TrainSchedule.html.twig @@ -0,0 +1,32 @@ +{% extends 'base.html.twig' %} + +{% block body %} +<table class="table"> +    <thead class="thead"> +    <tr class="tr"> +        <th>Track</th> +        <th>Train type</th> +        <th>Train number</th> +        <th>Destination name</th> +        <th>Arrival</th> +        <th>Departure</th> +        <th>Delay</th> +    </tr> +    </thead> +    <tbody class="tbody"> +    <tr class="tr"> +        {% for table in data %} +        <td class="td">{{ table.Track }}</td> +        <td class="td">{{ table.TrainType }}</td> +        <td class="td">{{ table.TrainNumber }}</td> +        <td class="td">{{ table.DestinationName }}</td> +        <td class="td">{{ table.ScheduledArrival }}</td> +        <td class="td">{{ table.ScheduledDeparture }}</td> +        <td class="td">{{ table.DepartureDelay }}</td> +    </tr> +    </tbody> +    {% endfor %} +</table> +{% endblock %} +{% block javascripts %} +{% endblock %}
\ No newline at end of file diff --git a/src/AppBundle/Controller/LastWeekDataController.php b/src/AppBundle/Controller/LastWeekDataController.php index f77a751..7b5d993 100644 --- a/src/AppBundle/Controller/LastWeekDataController.php +++ b/src/AppBundle/Controller/LastWeekDataController.php @@ -38,6 +38,5 @@ class LastWeekDataController extends Controller          $parametersToTwig = array("data" => $data);          return $this->render('default/LastWeekData.html.twig',$parametersToTwig); -      }  }
\ No newline at end of file diff --git a/src/AppBundle/Controller/TrainScheduleController.php b/src/AppBundle/Controller/TrainScheduleController.php new file mode 100644 index 0000000..927be0c --- /dev/null +++ b/src/AppBundle/Controller/TrainScheduleController.php @@ -0,0 +1,31 @@ +<?php +/** + * Created by PhpStorm. + * User: marcin + * Date: 07/12/17 + * Time: 10:33 + */ + +namespace AppBundle\Controller; + +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; +use SoapClient; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +class TrainScheduleController extends Controller +{ +    /** +     * @Route("/TrainSchedule") +     */ + +    public function GetSchedule() +    { +        $client   = new SoapClient( "http://traindata.dsb.dk/stationdeparture/Service.asmx?WSDL" ); +        $params   = array( 'request' => array( 'UICNumber' => '8600617' ) ); +        $response = $client->GetStationQueue( $params ); +        $data = $response->GetStationQueueResult->Trains->Queue; +        $parametersToTwig = array("data" => $data); + +        return $this->render('default/TrainSchedule.html.twig',$parametersToTwig); +    } +}
\ No newline at end of file |