1
0

Added base routing + moved rekeningen

This commit is contained in:
Christiaan Goossens 2017-03-30 18:56:01 +02:00
parent ffe56bcf9b
commit afc472e7d7
8 changed files with 99 additions and 36 deletions

View File

@ -0,0 +1,32 @@
<?php
/**
* Informatica Eindproject D4p
* 6in3, Stedelijk Gymnasium Nijmegen
* Docent: Hans de Wolf
*
* ==================
*
* Daniel Boutros,
* Christiaan Goossens,
* Jelmer Hinssen
*/
namespace Inforbank\Application\Helper;
use Inforbank\Application;
use Inforbank\Application\Helper\Klant;
use Inforbank\Proxy;
class Header
{
public static function getHeaderData()
{
$klant = Klant::getCurrentUser();
$base = Proxy::$route->getBaseUrl() . "/";
return array(
'klant' => $klant,
'base' => $base
);
}
}

View File

@ -15,8 +15,7 @@
namespace Inforbank\Application;
use \Slim\App;
use Inforbank\Application\Helper\Klant;
use Inforbank\Application\Helper\Rekeningen;
use Inforbank\Application\Helper\Redirect;
class Main
{
@ -34,15 +33,7 @@ class Main
public function __construct(App $app)
{
$app->get('/', function ($request, $response, $args) {
// Ophalen klant
$klant = Klant::getCurrentUser();
$rekeningen = Rekeningen::getCurrentUserRekeningen();
// Render index view
return $this->renderer->render($response, 'index.phtml', [
'klant' => $klant,
'rekeningen' => $rekeningen
]);
return Redirect::create($request, $response, '/rekeningen');
})->add(new Auth\Middleware());
}
}

View File

@ -16,19 +16,19 @@ namespace Inforbank\Application;
use Inforbank\Application;
use Inforbank\Application\Helper\IBAN;
use Inforbank\Application\Helper\Klant;
use Inforbank\Application\Helper\Header;
use Inforbank\Application\Helper\Redirect;
use Inforbank\Application\Helper\Rekeningen;
use Slim\App;
class Overboeking {
public function __construct(App $app) {
class Overboeking
{
public function __construct(App $app)
{
$app->get('/overboeking', function ($request, $response, $args) {
$klant = Klant::getCurrentUser();
$rekeningen = Rekeningen::getCurrentUserRekeningen();
return $this->renderer->render($response, 'overboeking.phtml', [
'klant' => $klant,
'header' => Header::getHeaderData(),
'rekeningen' => $rekeningen
]);
});
@ -89,5 +89,4 @@ class Overboeking {
return Redirect::create($request, $response, "/");
});
}
}

View File

@ -0,0 +1,36 @@
<?php
/**
* Informatica Eindproject D4p
* 6in3, Stedelijk Gymnasium Nijmegen
* Docent: Hans de Wolf
*
* ==================
*
* Daniel Boutros,
* Christiaan Goossens,
* Jelmer Hinssen
*/
namespace Inforbank\Application;
use \Slim\App;
use Inforbank\Application\Helper\Header;
use Inforbank\Application\Helper\Rekeningen as RekeningHelper;
class Rekeningen
{
public function __construct(App $app)
{
$app->get('/rekeningen', function ($request, $response, $args) {
// Ophalen klant
$rekeningen = RekeningHelper::getCurrentUserRekeningen();
// Render index view
return $this->renderer->render($response, 'index.phtml', [
'header' => Header::getHeaderData(),
'rekeningen' => $rekeningen
]);
})->add(new Auth\Middleware());
}
}

View File

@ -15,7 +15,7 @@
namespace Inforbank\Application;
use \Slim\App;
use Inforbank\Application\Helper\Klant;
use Inforbank\Application\Helper\Header;
use Inforbank\Application\Helper\Rekeningen;
use Inforbank\Application\Helper\IBAN;
use Inforbank\Application;
@ -25,7 +25,6 @@ class Transacties
public function __construct(App $app)
{
$app->get('/rekeningen/{rekeningnummer}', function ($request, $response, $args) {
$klant = Klant::getCurrentUser();
$rekeningen = Rekeningen::getCurrentUserRekeningen();
$ibanhelper = new IBAN;
@ -60,7 +59,7 @@ class Transacties
);
}
return $this->renderer->render($response, 'transacties.phtml', [
'klant' => $klant,
'header' => Header::getHeaderData(),
'rekening' => $rekening,
'transacties' => $returnArray
]);

View File

@ -16,9 +16,14 @@ namespace Inforbank;
class Proxy
{
public static $route;
public function __invoke($request, $response, $next)
{
$uri = $request->getUri();
self::$route = $uri;
$path = $uri->getPath();
$pa = explode('assets/', $path, 2);

View File

@ -118,6 +118,7 @@ new Inforbank\Application\Daniel($app);
new Inforbank\Application\Main($app);
new Inforbank\Application\Transacties($app);
new Inforbank\Application\Overboeking($app);
new Inforbank\Application\Rekeningen($app);
// Added API handler
new Inforbank\Application\API\Handler($app);

View File

@ -5,6 +5,7 @@
<title>Inforbank</title>
<link rel="stylesheet" href="assets/css/main.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<base href="<?= $header['base'] ?>">
</head>
<body>
<div class="header">
@ -12,11 +13,11 @@
<div class="container">
<img src="assets/logo.png" alt="Inforbank"></img>
<div class="user">
Welkom <?= $klant['voornaam'] ?> <?php
if ($klant['tussenvoegsel'] !== "") {
echo " " . $klant['tussenvoegsel'];
Welkom <?= $header['klant']['voornaam'] ?> <?php
if ($header['klant']['tussenvoegsel'] !== "") {
echo " " . $header['klant']['tussenvoegsel'];
}
?> <?= $klant['achternaam'] ?><br/>
?> <?= $header['klant']['achternaam'] ?><br/>
<a href="logout">Uitloggen</a>
</div>
</div>
@ -25,8 +26,7 @@
<div class="container">
<ul class="nv">
<li><a href="rekeningen">Rekeningen</a></li>
<li><a href="rekeningen">Transactie Beginnen</a></li>
<li><a href="rekeningen">Transacties</a></li>
<li><a href="berichten">Berichten</a></li>
</ul>
</div>
</div>