Added base page layout
This commit is contained in:
parent
014adeed65
commit
90201e85cd
0
public/assets/css/main.css
Normal file
0
public/assets/css/main.css
Normal file
41
src/Application/Helper/Klant.php
Normal file
41
src/Application/Helper/Klant.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?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;
|
||||
|
||||
class Klant
|
||||
{
|
||||
public function getCurrentUser()
|
||||
{
|
||||
$container = Application::getContainer();
|
||||
$user = $container->auth->getUserID();
|
||||
|
||||
$db = $container->db;
|
||||
|
||||
$klant = $db->klanten->where('id', $user)[$user];
|
||||
|
||||
return array(
|
||||
'voornaam' => $klant['voornaam'],
|
||||
'tussenvoegsel' => $klant['tussenvoegsel'],
|
||||
'achternaam' => $klant['achternaam'],
|
||||
'bedrijfsnaam' => $klant['bedrijfsnaam'],
|
||||
'straat' => $klant['straat'],
|
||||
'huisnummer' => $klant['huisnummer'],
|
||||
'postcode' => $klant['postcode'],
|
||||
'woonplaats' => $klant['woonplaats']
|
||||
);
|
||||
}
|
||||
}
|
@ -21,12 +21,12 @@ class Rekeningen
|
||||
public function getCurrentUserRekeningen()
|
||||
{
|
||||
$container = Application::getContainer();
|
||||
$user = $container->auth->getUser();
|
||||
$user = $container->auth->getUserID();
|
||||
|
||||
$db = $container->db;
|
||||
$ibanhelper = new IBAN;
|
||||
|
||||
$rekeningen = $db->rekeningen->where('klantid', $user['id']);
|
||||
$rekeningen = $db->rekeningen->where('klantid', $user);
|
||||
|
||||
$returnArray = array();
|
||||
|
||||
|
@ -15,6 +15,8 @@
|
||||
namespace Inforbank\Application;
|
||||
|
||||
use \Slim\App;
|
||||
use Inforbank\Application\Helper\Klant;
|
||||
use Inforbank\Application\Helper\Rekeningen;
|
||||
|
||||
class Main
|
||||
{
|
||||
@ -31,10 +33,16 @@ class Main
|
||||
*/
|
||||
public function __construct(App $app)
|
||||
{
|
||||
// Add the default view routes
|
||||
$app->get('/', function ($request, $response, $args) {
|
||||
// Ophalen klant
|
||||
$klant = Klant::getCurrentUser();
|
||||
$rekeningen = Rekeningen::getCurrentUserRekeningen();
|
||||
|
||||
// Render index view
|
||||
return $this->renderer->render($response, 'index.phtml', $args);
|
||||
return $this->renderer->render($response, 'index.phtml', [
|
||||
'klant' => $klant,
|
||||
'rekeningen' => $rekeningen
|
||||
]);
|
||||
})->add(new Auth\Middleware());
|
||||
}
|
||||
}
|
||||
|
2
templates/__footer.phtml
Normal file
2
templates/__footer.phtml
Normal file
@ -0,0 +1,2 @@
|
||||
</body>
|
||||
</html>
|
8
templates/__header.phtml
Normal file
8
templates/__header.phtml
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Inforbank</title>
|
||||
<link rel="stylesheet" href="assets/css/main.css">
|
||||
</head>
|
||||
<body>
|
@ -1,11 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Inforbank</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Welkom klant <?= $_SESSION['userid'] ?></p>
|
||||
<a href="/logout">Uitloggen</a>
|
||||
</body>
|
||||
</html>
|
||||
<?php include '__header.phtml'; ?>
|
||||
|
||||
<p>Welkom klant <?= $_SESSION['userid'] ?></p>
|
||||
<a href="/logout">Uitloggen</a>
|
||||
<br/>
|
||||
<pre><?php echo json_encode($klant); ?></pre>
|
||||
<pre><?php echo json_encode($rekeningen); ?></pre>
|
||||
|
||||
<?php include '__footer.phtml'; ?>
|
||||
|
Reference in New Issue
Block a user