mirror of
https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
synced 2024-12-22 23:25:03 +01:00
Added first draft Homepage
This commit is contained in:
parent
d1a29b6d70
commit
2cefb4187c
26
src/controller/AbstractController.php
Normal file
26
src/controller/AbstractController.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace controller;
|
||||
|
||||
use core\CoreInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
abstract class AbstractController
|
||||
{
|
||||
/**
|
||||
* @var CoreInterface
|
||||
*/
|
||||
protected $core;
|
||||
|
||||
public function __construct(CoreInterface $core){
|
||||
$this->core = $core;
|
||||
}
|
||||
|
||||
protected function render(string $template,array $variables=[]):void{
|
||||
echo $this->core->getTwig()->render($template,$variables);
|
||||
}
|
||||
}
|
||||
|
17
src/controller/standart/Standart.php
Normal file
17
src/controller/standart/Standart.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace controller\standart;
|
||||
|
||||
use controller\AbstractController;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author kevinfrantz
|
||||
*
|
||||
*/
|
||||
final class Standart extends AbstractController
|
||||
{
|
||||
public function homepage():void{
|
||||
$this->render('standart/homepage.html.twig');
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
namespace router;
|
||||
|
||||
use core\CoreInterface;
|
||||
use controller\standart\Standart;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -10,19 +11,58 @@ use core\CoreInterface;
|
||||
*/
|
||||
final class Router implements RouterInterface
|
||||
{
|
||||
public function route()
|
||||
/**
|
||||
* @var CoreInterface
|
||||
*/
|
||||
private $core;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $get;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $post;
|
||||
|
||||
public function route():void
|
||||
{
|
||||
echo "Hello World!";
|
||||
if($this->post['route']){
|
||||
$this->postRouting();
|
||||
}
|
||||
if($this->get['router']){
|
||||
$this->getRouting();
|
||||
}else{
|
||||
$standart = new Standart($this->core);
|
||||
$standart->homepage();
|
||||
}
|
||||
}
|
||||
|
||||
private function postRouting():void{
|
||||
|
||||
}
|
||||
|
||||
private function getRouting():void{
|
||||
|
||||
}
|
||||
|
||||
public function setGet(array $get)
|
||||
{}
|
||||
public function setGet(array $get):void
|
||||
{
|
||||
$this->get = $get;
|
||||
}
|
||||
|
||||
public function setCore(CoreInterface $core)
|
||||
{}
|
||||
public function setCore(CoreInterface $core):void
|
||||
{
|
||||
$this->core = $core;
|
||||
}
|
||||
|
||||
public function setPost(array $post): void
|
||||
{}
|
||||
{
|
||||
$this->post = $post;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ use core\CoreInterface;
|
||||
*/
|
||||
interface RouterInterface
|
||||
{
|
||||
public function setCore(CoreInterface $core);
|
||||
public function setCore(CoreInterface $core):void;
|
||||
|
||||
/**
|
||||
* Post parameters are used to save data
|
||||
@ -22,10 +22,10 @@ interface RouterInterface
|
||||
* Get Parameters are used to request Data
|
||||
* @param array $get
|
||||
*/
|
||||
public function setGet(array $get);
|
||||
public function setGet(array $get):void;
|
||||
|
||||
/**
|
||||
* Opens the controller
|
||||
*/
|
||||
public function route();
|
||||
public function route():void;
|
||||
}
|
||||
|
10
src/template/base.html.twig
Normal file
10
src/template/base.html.twig
Normal file
@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
{% block title %}Online Shop{% endblock %}
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
0
src/template/product/basket/basket.html.php
Normal file
0
src/template/product/basket/basket.html.php
Normal file
1
src/template/product/basket/list.html.php
Normal file
1
src/template/product/basket/list.html.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
1
src/template/product/basket/listItem.html.php
Normal file
1
src/template/product/basket/listItem.html.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
1
src/template/product/overview/list.html.php
Normal file
1
src/template/product/overview/list.html.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
1
src/template/product/overview/listItem.html.php
Normal file
1
src/template/product/overview/listItem.html.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
1
src/template/product/overview/overview.html.php
Normal file
1
src/template/product/overview/overview.html.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
3
src/template/standart/homepage.html.twig
Normal file
3
src/template/standart/homepage.html.twig
Normal file
@ -0,0 +1,3 @@
|
||||
{% extends "base.html.twig" %}
|
||||
{% block title %}Online Shop{% endblock %}
|
||||
{% block body %}Welcome to the online shop ;){% endblock %}
|
1
src/template/user/login.html.php
Normal file
1
src/template/user/login.html.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
1
src/template/user/registration.html.php
Normal file
1
src/template/user/registration.html.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
Loading…
Reference in New Issue
Block a user