Compare commits
52 Commits
1204c89ca3
...
main
Author | SHA1 | Date | |
---|---|---|---|
e426926692 | |||
07a56b31a6 | |||
3dc185b667 | |||
8cebf35c6d | |||
e5637d4929 | |||
c8499aa9d5 | |||
509c685d80 | |||
96e569c66d | |||
aa20731efc | |||
0ff636c20a | |||
a2b66de0be | |||
cee9220f6a | |||
633f8eb1e2 | |||
4e243976db | |||
af6f6238ae | |||
6fd7b8d918 | |||
3964f90a30 | |||
2c044b2498 | |||
3d0fcc42c4 | |||
449dd10302 | |||
7ce389d179 | |||
![]() |
b5118a699f | ||
2eadf75557 | |||
bc8ddbff4c | |||
ae554ab0a6 | |||
ae3a653de4 | |||
942dc3808e | |||
a0416cdefe | |||
6c431faa21 | |||
b0c1ddae2a | |||
c94c7f9b45 | |||
c46e3ddb58 | |||
f9a35a2b49 | |||
bdc491fbfa | |||
fdb02b051c | |||
582db52aa6 | |||
a0f2edd4c6 | |||
742c2b0160 | |||
e915b114f5 | |||
625cf0f30e | |||
430d1b38c0 | |||
e7b3a062b7 | |||
cfc0e99f63 | |||
5fb1133617 | |||
b038312ae3 | |||
538cae0094 | |||
ef28b26a19 | |||
a354556b58 | |||
4e88e4c571 | |||
e659535923 | |||
5155284226 | |||
074b2a99b5 |
@@ -1,3 +1,5 @@
|
||||
footer{
|
||||
background: var(--fullblock);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 24px 42px 24px 42px;
|
||||
}
|
@@ -1,38 +1,13 @@
|
||||
header {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding-top: 10px;
|
||||
background: var(--fullblock);
|
||||
background-color: var(--brand-background);
|
||||
}
|
||||
|
||||
nav ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
nav li {
|
||||
float: left;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
|
||||
nav li a {
|
||||
display: block;
|
||||
width: 100px;
|
||||
height: 30px;
|
||||
border: 1px solid #4d4d4d;
|
||||
background-color: #4d4d4d;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
margin: 5px;
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
nav li a:hover {
|
||||
background-color: orange;
|
||||
nav {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 24px 42px 24px 42px;
|
||||
}
|
@@ -1,11 +1,38 @@
|
||||
.buttons-container{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.btn{
|
||||
background: var(--brand-primary);
|
||||
color: var(--brand-white);
|
||||
padding: 5px 10px;
|
||||
font-weight: var(--font-weight-semibold);
|
||||
font-size: var(--font-size-text);
|
||||
border-radius: 3px;
|
||||
text-decoration: none;
|
||||
color: var(--brand-white);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-link {
|
||||
text-decoration: underline;
|
||||
background-color: transparent;
|
||||
color: var(--brand-white);
|
||||
border: none;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--brand-primary);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.btn-secondary{
|
||||
background: var(--fullblock);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.btn-user {
|
||||
@@ -21,6 +48,44 @@
|
||||
aspect-ratio: 1/1;
|
||||
}
|
||||
|
||||
.btn-form{
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.btn-login{
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.btn-user > span {
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-logout{
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.btn-userchange{
|
||||
background-color: var(--brand-white);
|
||||
color: var(--brand-background);
|
||||
}
|
||||
|
||||
/* Hovers */
|
||||
.btn-primary:hover {
|
||||
background-color: var(--brand-primary-hover);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background-color: var(--bg-muted-hover);
|
||||
}
|
||||
|
||||
.btn-accent:hover {
|
||||
background-color: var(--fullblock-hover);
|
||||
}
|
||||
|
||||
.btn-danger:hover {
|
||||
background-color: var(--error-hover);
|
||||
}
|
||||
|
||||
.btn-userchange:hover, .btn-logout:hover{
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
108
CSS/Element/card.css
Normal file
108
CSS/Element/card.css
Normal file
@@ -0,0 +1,108 @@
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: var(--font-family-main);
|
||||
background-color: var(--brand-background);
|
||||
color: var(--brand-white);
|
||||
}
|
||||
|
||||
.welcome-header {
|
||||
text-align: center;
|
||||
margin: 60px 20px 40px 20px;
|
||||
}
|
||||
|
||||
.welcome-heading {
|
||||
font-size: 50px;
|
||||
font-weight: 500;
|
||||
color: var(--brand-primary);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.welcome-subheading {
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
text-align: left;
|
||||
max-width: 1000px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.course-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 40px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 765px) {
|
||||
.course-grid{
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.course-card {
|
||||
background: var(--brand-white);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
||||
min-height: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.course-image {
|
||||
background-color: #ddd;
|
||||
height: 180px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.course-content {
|
||||
background-color: var(--brand-primary);
|
||||
color: var(--brand-white);
|
||||
padding: 20px;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.course-left,
|
||||
.course-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 14px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.course-left div:first-child,
|
||||
.course-right div:first-child {
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.course-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
.course-card {
|
||||
flex: 0 0 calc(50% - 20px);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 640px) {
|
||||
.course-card {
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
|
||||
.welcome-heading {
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
.welcome-subheading {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
32
CSS/Element/filter_box.css
Normal file
32
CSS/Element/filter_box.css
Normal file
@@ -0,0 +1,32 @@
|
||||
.filter-box {
|
||||
background: #EB8202;
|
||||
color: #fff;
|
||||
padding: 1em;
|
||||
border-radius: 8px;
|
||||
font-family: sans-serif;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.filter-box label {
|
||||
display: block;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
.filter-box select,
|
||||
.filter-box input[type="text"],
|
||||
.filter-box input[type="range"] {
|
||||
width: 100%;
|
||||
margin-top: 0.25em;
|
||||
}
|
||||
|
||||
.filter-box button {
|
||||
margin-top: 1em;
|
||||
width: 100%;
|
||||
background: white;
|
||||
color: #000;
|
||||
border: none;
|
||||
padding: 0.5em;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
}
|
@@ -1,66 +1,127 @@
|
||||
main a{
|
||||
color: var(--brand-white)
|
||||
main a {
|
||||
color: var(--brand-white);
|
||||
}
|
||||
|
||||
.form-flex {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: 8px;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: 8px;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
form label {
|
||||
width: fit-content;
|
||||
width: fit-content;
|
||||
color: var(--brand-white);
|
||||
}
|
||||
|
||||
form input {
|
||||
border: var(--border-primary);
|
||||
height: var(--h-md);
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
height: var(--h-md);
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
form input,
|
||||
textarea {
|
||||
border: var(--border-primary);
|
||||
padding: 8px;
|
||||
font-size: 1rem;
|
||||
margin-top: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.input {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: 2px;
|
||||
align-items: start;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: 2px;
|
||||
align-items: start;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.input-short {
|
||||
max-width: 240px;
|
||||
max-width: 240px;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
display: grid;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20px;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
.form-grid {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.form-grid-3 {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
.form-grid-3 {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 20px;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 640px) {
|
||||
.form-grid-3 {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.form-grid label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.form-grid textarea {
|
||||
min-height: 100px;
|
||||
width: 100%;
|
||||
min-height: 100px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form-grid input:last-child, div:nth-last-child(4) {
|
||||
grid-column: 1 / -1;
|
||||
column-span: 2;
|
||||
form .error {
|
||||
color: var(--error);
|
||||
border-color: var(--error);
|
||||
margin-block-start: 4px;
|
||||
margin-block-end: 0;
|
||||
outline-color: var(--error);
|
||||
}
|
||||
.form-user {
|
||||
/*justify-content: center !important;*/
|
||||
grid-template-columns: auto !important;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
padding: 8px;
|
||||
font-size: 1rem;
|
||||
margin-top: 5px;
|
||||
.radio {
|
||||
flex-direction: row;
|
||||
max-width: 290px;
|
||||
align-items: center;
|
||||
gap: 24px;
|
||||
|
||||
}
|
||||
|
||||
.radio input {
|
||||
margin-top: 0;
|
||||
height: var(--h-sm);
|
||||
width: var(--h-sm);
|
||||
}
|
||||
|
||||
.input-transparent{
|
||||
background: transparent!important;
|
||||
border: transparent!important;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 500px) {
|
||||
.input-transparent{
|
||||
display: none;
|
||||
}
|
||||
}
|
@@ -1,7 +1,13 @@
|
||||
.logo{
|
||||
#logo{
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
color: var(--brand-white);
|
||||
font-size: var(--font-size-logo);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
#logo span {
|
||||
color: var(--brand-primary);
|
||||
font-size: var(--font-size-logo);
|
||||
span{
|
||||
color: var(--brand-primary);
|
||||
font-size: var(--font-size-logo);
|
||||
}
|
||||
}
|
34
CSS/Element/modal.css
Normal file
34
CSS/Element/modal.css
Normal file
@@ -0,0 +1,34 @@
|
||||
.modal-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.modal-overlay.is-visible {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.modal {
|
||||
background: var(--brand-background);
|
||||
padding: 1.5rem;
|
||||
border-radius: 6px;
|
||||
text-align: center;
|
||||
max-width: 320px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 900px) {
|
||||
.modal nav {
|
||||
padding: 24px 42px 24px 42px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px) {
|
||||
.modal nav {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
32
CSS/Element/sidebar.css
Normal file
32
CSS/Element/sidebar.css
Normal file
@@ -0,0 +1,32 @@
|
||||
.sidebar {
|
||||
width: 200px;
|
||||
background-color: transparent;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sidebar nav ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.sidebar nav ul li {
|
||||
margin-bottom: 0.5rem;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.sidebar nav ul li a {
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
display: block;
|
||||
padding: 0.5rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.sidebar nav ul li a:hover {
|
||||
background-color: #e2e6ea;
|
||||
}
|
||||
|
||||
.sidebar button{
|
||||
width: 100%;
|
||||
padding: 10px 10px;
|
||||
}
|
118
CSS/style.css
118
CSS/style.css
@@ -1,11 +1,18 @@
|
||||
@import url(variables.css);
|
||||
@import url(style_columns.css);
|
||||
@import url(Block/header.css);
|
||||
@import url(Block/footer.css);
|
||||
@import url(Element/logo.css);
|
||||
@import url(Element/form.css);
|
||||
@import url(Element/button.css);
|
||||
@import url(Element/card.css);
|
||||
@import url(Element/sidebar.css);
|
||||
@import url(Element/filter_box.css);
|
||||
@import url(Element/modal.css);
|
||||
|
||||
*, *:before, *:after {
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
@@ -13,101 +20,118 @@
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--brand-background);
|
||||
color: #666;
|
||||
font-size: 15px;
|
||||
margin: 0;
|
||||
background-color: var(--brand-background);
|
||||
color: var(--brand-white);
|
||||
font-size: 15px;
|
||||
margin: 0;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: var(--brand-white);
|
||||
font-size: var(--font-size-title-h1);
|
||||
color: var(--brand-white);
|
||||
font-size: var(--font-size-title-h1);
|
||||
}
|
||||
|
||||
h1 span {
|
||||
color: orange;
|
||||
font-size: 40px;
|
||||
color: orange;
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: orange;
|
||||
color: orange;
|
||||
}
|
||||
|
||||
*, button, a {
|
||||
transition: background-color 0.2s, color 0.2s;
|
||||
}
|
||||
|
||||
main {
|
||||
margin-top: 190px;
|
||||
padding: 10px;
|
||||
margin-top: 190px;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
max-width: 90%;
|
||||
margin: 0 auto
|
||||
@media screen and (max-width: 1024px) {
|
||||
main{
|
||||
margin-top: 50px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.msg {
|
||||
text-align: center;
|
||||
font-size: 17px;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
font-size: 17px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.msg a {
|
||||
text-decoration: none;
|
||||
color: #09add0;
|
||||
|
||||
text-decoration: none;
|
||||
color: #09add0;
|
||||
}
|
||||
|
||||
.msg a:hover {
|
||||
color: orange;
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.articleImg {
|
||||
width: 100%;
|
||||
border: 2px solid lightskyblue;
|
||||
padding: 5px;
|
||||
margin: 0 0 15px 0;
|
||||
width: 100%;
|
||||
border: 2px solid lightskyblue;
|
||||
padding: 5px;
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
|
||||
.welcomeImg {
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.articleInfo {
|
||||
font-weight: bold;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*** Loesung Workshop-Seite ***/
|
||||
|
||||
.textContent {
|
||||
padding: 0 10px 0 30px;
|
||||
padding: 0 10px 0 30px;
|
||||
}
|
||||
|
||||
@media (max-width: 529px) {
|
||||
.textContent {
|
||||
padding: 15px 0 0 0;
|
||||
}
|
||||
.textContent {
|
||||
padding: 15px 0 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.event h3 {
|
||||
margin: 15px 0 5px 0;
|
||||
font-size: 20px;
|
||||
text-align: left;
|
||||
margin: 15px 0 5px 0;
|
||||
font-size: 20px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.orange {
|
||||
color: orange;
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
margin: 0 0 5px 0;
|
||||
color: orange;
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
margin: 0 0 5px 0;
|
||||
}
|
||||
|
||||
.d-flex-between{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
.d-flex-between {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.hover:hover{
|
||||
opacity: .75;
|
||||
text-decoration: none;
|
||||
@media only screen and (max-width: 500px) {
|
||||
.d-flex-between{
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.hover:hover {
|
||||
opacity: 0.75;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.paragraph {
|
||||
font-size: var(--font-size-smalltext);
|
||||
color: var(--brand-white);
|
||||
}
|
||||
|
@@ -6,18 +6,38 @@
|
||||
/*** 12 spaltiges Grid mit Flexboxen ***/
|
||||
|
||||
/*** Container ***/
|
||||
|
||||
.container {
|
||||
max-width: 90%;
|
||||
/* padding: 24px 42px 24px 42px; */
|
||||
margin: 0 auto;
|
||||
color: var(--brand-white);
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 500px) {
|
||||
.container {
|
||||
padding: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@media (max-width: 800px) {
|
||||
.row {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
/*** Spaltendefinitionen Smartphone Ansicht ***/
|
||||
@media (max-width: 529px) {
|
||||
.col-s-12 {
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
|
||||
|
||||
/*** Loesung Workshop-Seite ***/
|
||||
.textContent {
|
||||
padding: 15px 0 0 0;
|
||||
@@ -25,19 +45,22 @@
|
||||
}
|
||||
|
||||
/*** Spaltendefinitionen Tablet Ansicht ***/
|
||||
@media (min-width: 530px) {
|
||||
@media (min-width: 750px) {
|
||||
.col-m-1 {
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
|
||||
.col-m-4 {
|
||||
flex: 0 0 33.3333333%;
|
||||
}
|
||||
|
||||
.col-m-6 {
|
||||
flex: 0 0 50%;
|
||||
}
|
||||
|
||||
.col-m-12 {
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*** Spaltendefinitionen Desktop Ansicht ***/
|
||||
@@ -45,21 +68,35 @@
|
||||
.col-1 {
|
||||
flex: 0 0 8.3333333%;
|
||||
}
|
||||
|
||||
.col-3 {
|
||||
flex: 0 0 25%;
|
||||
}
|
||||
|
||||
.col-4 {
|
||||
flex: 0 0 33.3333333%;
|
||||
}
|
||||
|
||||
.col-card-4{
|
||||
flex: 1 1 calc((100% - (3 - 1) * 40px) / 3);
|
||||
}
|
||||
|
||||
.col-5 {
|
||||
flex: 0 0 41.6666667%;
|
||||
}
|
||||
|
||||
.col-6 {
|
||||
flex: 0 0 50%;
|
||||
}
|
||||
|
||||
.col-8 {
|
||||
flex: 0 0 66.66666667%;
|
||||
}
|
||||
|
||||
.col-9{
|
||||
flex: 0 0 75%;
|
||||
}
|
||||
|
||||
.col-12 {
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@
|
||||
--brand-white: #ffffff;
|
||||
--fullblock: darkblue;
|
||||
--input-placeholder: #998E82;
|
||||
|
||||
--error: #FF0000;
|
||||
|
||||
/*Fonts*/
|
||||
--font-family-main: "Inter", sans-serif;
|
||||
@@ -15,12 +15,20 @@
|
||||
/* Font-size*/
|
||||
--font-size-title-h1: 62px;
|
||||
--font-size-logo: 36px;
|
||||
--font-size-text: 24px;
|
||||
--font-size-text: 20px;
|
||||
--font-size-smalltext: 18px;
|
||||
|
||||
/*Font-Weight*/
|
||||
--font-weight-semibold: 600;
|
||||
|
||||
--h-sm: 24px;
|
||||
--h-md: 48px;
|
||||
--border-primary: 1px solid #998E82;
|
||||
|
||||
/* Hover Variants */
|
||||
--brand-primary-hover: #FF9E33;
|
||||
--brand-background-hover: #2A231F;
|
||||
--bg-muted-hover: #6A6A6A;
|
||||
--fullblock-hover: #00008B;
|
||||
--error-hover: #CC0000;
|
||||
}
|
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Blog\Controller;
|
||||
|
||||
use Blog\Model\AdminModel;
|
||||
|
||||
class AdminController
|
||||
{
|
||||
protected $view;
|
||||
private $db;
|
||||
private $validData = array();
|
||||
private $errors = array();
|
||||
private $labels = array("name" => "Name*", "preis" => "€ Preis*", "dauer" => "Dauer* (Stunden)", "rabatt" => "Rabatt", "kategorie" => "Kategorie", "beschreibung" => "Beschreibung");
|
||||
|
||||
|
||||
public function __construct($view)
|
||||
{
|
||||
$this->db = new AdminModel();
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
public function showForm()
|
||||
{
|
||||
$this->view->setVars([
|
||||
'labels' => $this->labels,
|
||||
'validData' => $this->validData,
|
||||
'errors' => $this->errors
|
||||
]);
|
||||
}
|
||||
|
||||
public function showConfirmation()
|
||||
{
|
||||
echo "<p>Erfolgreich erstellt!</p>";
|
||||
}
|
||||
|
||||
public function validateForm(){
|
||||
foreach ($this->labels as $index => $value) {
|
||||
if (!isset($_POST[$index]) || empty($_POST[$index])) {
|
||||
$this->errors[$index] = "Bitte " . $value . " angeben";
|
||||
} else {
|
||||
$this->validData[$index] = $_POST[$index];
|
||||
}
|
||||
}
|
||||
if (count($this->errors) > 0) {
|
||||
$this->view->setDoMethodName("showForm");
|
||||
$this->showForm();
|
||||
} else {
|
||||
if ($this->db->writeContactData($this->validData)) {
|
||||
$this->view->setDoMethodName("showConfirmation");
|
||||
$this->showConfirmation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@@ -28,10 +28,7 @@ class ContactController
|
||||
]);
|
||||
}
|
||||
|
||||
public function showConfirmation()
|
||||
{
|
||||
|
||||
}
|
||||
public function showConfirmation() {}
|
||||
|
||||
public function validateForm(){
|
||||
foreach ($this->labels as $index => $value) {
|
||||
@@ -41,7 +38,6 @@ class ContactController
|
||||
$this->validData[$index] = $_POST[$index];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($this->errors) > 0) {
|
||||
$this->view->setDoMethodName("showContactForm");
|
||||
$this->showContactForm();
|
||||
|
35
Controller/CourseController.php
Normal file
35
Controller/CourseController.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Blog\Controller;
|
||||
|
||||
use Blog\Model\CourseModel;
|
||||
|
||||
class CourseController{
|
||||
private $view;
|
||||
private $db;
|
||||
|
||||
public function __construct($view){
|
||||
$this->db = new CourseModel();
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
public function showCourse(){
|
||||
$id = $_GET["courseId"] ?? null;
|
||||
if(!$id){
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$kurs = $this->db->getCourseById($id);
|
||||
if(!$kurs){
|
||||
new \Blog\Library\ErrorMsg("Kurs nicht gefunden");
|
||||
}
|
||||
|
||||
$this->view->setVars([
|
||||
"kurs" => $kurs
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -10,13 +10,62 @@ class UserController{
|
||||
private $validData = array();
|
||||
private $errors = array();
|
||||
|
||||
private $labels = [
|
||||
"name" => "Vorname*",
|
||||
"lastname" => "Nachname*",
|
||||
"email" => "E-Mail*",
|
||||
"password" => "Passwort*",
|
||||
"role" => "Rolle*"
|
||||
];
|
||||
|
||||
private $validLoginData = array();
|
||||
private $loginErrors = array();
|
||||
private $loginLabels = [
|
||||
"email" => "E-Mail*",
|
||||
"password" => "Passwort*",
|
||||
];
|
||||
|
||||
private $changeUserLabels = [
|
||||
'vorname' => 'Vorname',
|
||||
'name' => 'Nachname',
|
||||
'email' => 'E-Mail',
|
||||
'password' => 'Passwort',
|
||||
];
|
||||
|
||||
private $kursValidData = array();
|
||||
private $kursErrors = array();
|
||||
private $kursLabels = array(
|
||||
"name" => "Name*",
|
||||
"preis" => "€ Preis*",
|
||||
"dauer" => "Dauer* (Stunden)",
|
||||
"rabatt" => "Rabatt",
|
||||
"kategorie" => "Kategorie",
|
||||
"1" => "|",
|
||||
"stadt" => "Stadt*",
|
||||
"strasse" => "Straße und Nummer*",
|
||||
"plz" => "PLZ*",
|
||||
"2" => "|",
|
||||
"beschreibung" => "Beschreibung");
|
||||
|
||||
public function __construct($view){
|
||||
$this->db = new UserModel();
|
||||
$this->view = $view;
|
||||
}
|
||||
|
||||
public function showUserRegisterForm(){
|
||||
if (!isset($this->errors)) {
|
||||
$this->errors = [];
|
||||
}
|
||||
if (!isset($this->validData)) {
|
||||
$this->validData = [];
|
||||
}
|
||||
|
||||
$this->view->setVars([
|
||||
'labels' => $this->labels,
|
||||
'errors' => $this->errors,
|
||||
'validData' => $this->validData
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function showUserRegisterConfirmation(){
|
||||
@@ -24,30 +73,124 @@ class UserController{
|
||||
}
|
||||
|
||||
public function showUserLoginForm(){
|
||||
|
||||
$this->view->setVars([
|
||||
'labels' => $this->loginLabels,
|
||||
'errors' => $this->loginErrors,
|
||||
'validData' => $this->validLoginData
|
||||
]);
|
||||
}
|
||||
|
||||
private function validateForm() {
|
||||
foreach ($this->labels as $key => $label) {
|
||||
if (!isset($_POST[$key]) || trim($_POST[$key]) === '') {
|
||||
$this->errors[$key] = "Bitte $label angeben";
|
||||
} else {
|
||||
$this->validData[$key] = trim($_POST[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->validData['password'])) {
|
||||
if (strlen($this->validData['password']) < 6) {
|
||||
$this->errors['password'] = "Das Passwort muss mindestens 6 Zeichen lang sein.";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->validData['email']) && !filter_var($this->validData['email'], FILTER_VALIDATE_EMAIL)) {
|
||||
$this->errors['email'] = "Bitte eine gültige E-Mail-Adresse eingeben.";
|
||||
}
|
||||
}
|
||||
|
||||
public function validateLoginForm(){
|
||||
foreach ($this->loginLabels as $key => $label) {
|
||||
if (isset($this->validData['password'])) {
|
||||
if (strlen($this->validData['password']) < 6) {
|
||||
$this->errors['password'] = "Das Passwort muss mindestens 6 Zeichen lang sein.";
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->validData['email']) && !filter_var($this->validData['email'], FILTER_VALIDATE_EMAIL)) {
|
||||
$this->errors['email'] = "Bitte eine gültige E-Mail-Adresse eingeben.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function validateKursForm(){
|
||||
foreach ($this->kursLabels as $index => $value) {
|
||||
if($value === "|") continue;
|
||||
if (strpos($value, "*") !== false && (!isset($_POST[$index]) || empty($_POST[$index]))) {
|
||||
$this->kursErrors[$index] = "Bitte " . $value . " eingeben";
|
||||
} else {
|
||||
$this->kursValidData[$index] = $_POST[$index] === '' ? null : $_POST[$index];
|
||||
}
|
||||
}
|
||||
if (count($this->errors) > 0) {
|
||||
$this->view->setDoMethodName("showUserAccountPage");
|
||||
$this->showUserAccountPage();
|
||||
} else {
|
||||
if ($this->db->writeNewCourse($this->kursValidData, $_SESSION["user_id"])) {
|
||||
$this->view->setDoMethodName("showNewKursConfirmation");
|
||||
$this->showConfirmation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function validateEditKursForm(){
|
||||
foreach ($this->kursLabels as $index => $value) {
|
||||
if($value === "|") continue;
|
||||
if (strpos($value, "*") !== false && (!isset($_POST[$index]) || empty($_POST[$index]))) {
|
||||
$this->kursErrors[$index] = "Bitte " . $value . " eingeben";
|
||||
} else {
|
||||
$this->kursValidData[$index] = $_POST[$index] === '' ? null : $_POST[$index];
|
||||
}
|
||||
}
|
||||
if (count($this->errors) > 0) {
|
||||
$this->view->setDoMethodName("showUserAccountPage");
|
||||
$this->showUserAccountPage();
|
||||
} else {
|
||||
if ($this->db->writeNewCourse($this->kursValidData, $_SESSION["user_id"])) {
|
||||
$this->view->setDoMethodName("showKursEditedConfirmation");
|
||||
$this->showConfirmation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function showConfirmation(){}
|
||||
|
||||
public function showUserLoginConfirmation(){
|
||||
$userId = $this->getCurrentUserId();
|
||||
$user = null;
|
||||
var_dump($user . "user");
|
||||
if($userId){
|
||||
$user = $this->db->getUserById($userId);
|
||||
}
|
||||
include 'Views/User/showUserLoginConfirmation.phtml';
|
||||
|
||||
$path = "Views/User/showUserLoginConfirmation.phtml";
|
||||
if(file_exists($path)){
|
||||
include $path;
|
||||
}
|
||||
}
|
||||
|
||||
public function register(){
|
||||
$this->db->createUser($_POST);
|
||||
$this->view->setDoMethodName("showUserRegisterConfirmation");
|
||||
$this->showUserRegisterConfirmation();
|
||||
$this->validateForm();
|
||||
|
||||
if(count($this->errors) > 0){
|
||||
$this->view->setDoMethodName("showUserRegisterForm");
|
||||
$this->showUserRegisterForm();
|
||||
} else{
|
||||
$this->db->createUser($_POST);
|
||||
$this->login();
|
||||
}
|
||||
}
|
||||
|
||||
public function login(){
|
||||
$user = $this->db->getUserByEmail($_POST["email"]);
|
||||
|
||||
$this->validateLoginForm();
|
||||
|
||||
if(!$user){
|
||||
echo "Benutzer nicht gefunden";
|
||||
$this->loginErrors['email'] = "Email oder Passwort ist falsch";
|
||||
$this->view->setDoMethodName("showUserLoginForm");
|
||||
$this->showUserLoginForm();
|
||||
return;
|
||||
}
|
||||
|
||||
$hash = hash('sha256', $_POST["password"] . $user["salt"]);
|
||||
@@ -63,22 +206,202 @@ class UserController{
|
||||
public function setUserSession(array $user){
|
||||
$_SESSION["user_id"] = $user["id"];
|
||||
$_SESSION["user_role"] = $user["role"];
|
||||
$_SESSION["vorname"] = $user["vorname"];
|
||||
$_SESSION["name"] = $user["name"];
|
||||
}
|
||||
|
||||
public function clearUserSession(){
|
||||
unset($_SESSION["user_id"], $_SESSION["user_role"]);
|
||||
unset($_SESSION["user_id"], $_SESSION["user_role"], $_SESSION["vorname"], $_SESSION["name"]);
|
||||
}
|
||||
|
||||
public function logout(){
|
||||
$this->clearUserSession();
|
||||
echo "Erfolgreich ausgeloggt";
|
||||
header("Location: index.php?controller=user&do=showUserLoginForm");
|
||||
exit();
|
||||
}
|
||||
|
||||
public function isUserLoggenIn(){
|
||||
return isset($_SESSION["user_id"]);
|
||||
return isset($_SESSION["user_id"]) && $_SESSION["user_id"] != null;
|
||||
}
|
||||
|
||||
public function getCurrentUserId(){
|
||||
return $_SESSION["user_id"] ?? null;
|
||||
}
|
||||
|
||||
public function showUserAccountPage (){
|
||||
$this->view->setVars([
|
||||
'labels' => $this->kursLabels,
|
||||
'errors' => $this->kursErrors,
|
||||
'validData' => $this->kursValidData
|
||||
]);
|
||||
}
|
||||
|
||||
public function showUserDeleteConfirmation(){
|
||||
|
||||
}
|
||||
|
||||
public function deleteAccount(){
|
||||
$userId = $this->getCurrentUserId();
|
||||
if($userId){
|
||||
$this->db->deleteUser($userId);
|
||||
$this->clearUserSession();
|
||||
$this->view->setDoMethodName("showUserDeleteConfirmation");
|
||||
$this->showUserDeleteConfirmation();
|
||||
}
|
||||
}
|
||||
|
||||
public function changeAccountDataRedirect(){
|
||||
$userId = $this->getCurrentUserId();
|
||||
if($userId){
|
||||
$this->view->setDoMethodName("showUserChangeAccountSettings");
|
||||
$this->showUserChangeAccountSettings();
|
||||
}
|
||||
}
|
||||
|
||||
public function showUserChangeAccountSettings(){
|
||||
$userId = $this->getCurrentUserId();
|
||||
if(!$userId){
|
||||
header("Location: index.php?controller=user&do=showUserLoginForm");
|
||||
exit();
|
||||
}
|
||||
|
||||
$currentUser = $this->db->getUserById($userId);
|
||||
if(!$currentUser){
|
||||
new \Blog\Library\ErrorMsg("User nicht gefunden");
|
||||
}
|
||||
|
||||
$validData = [
|
||||
'vorname' => $currentUser["vorname"],
|
||||
'name' => $currentUser["name"],
|
||||
'email' => $currentUser["email"],
|
||||
];
|
||||
|
||||
$this->view->setVars([
|
||||
'changeUserLabels' => $this->changeUserLabels,
|
||||
'validData' => $validData,
|
||||
'errors' => $this->errors,
|
||||
]);
|
||||
|
||||
//$this->view->render('User/showUserChangeAccountSettings');
|
||||
return;
|
||||
}
|
||||
|
||||
public function updateAccountData()
|
||||
{
|
||||
$userId = $this->getCurrentUserId();
|
||||
if (!$userId) {
|
||||
header('Location: index.php?controller=user&do=showUserLoginForm');
|
||||
exit;
|
||||
}
|
||||
|
||||
$currentUser = $this->db->getUserById($userId);
|
||||
if (!$currentUser) {
|
||||
new \Blog\Library\ErrorMsg('User nicht gefunden');
|
||||
}
|
||||
|
||||
$submitted = [
|
||||
'vorname' => trim($_POST['vorname'] ?? ''),
|
||||
'name' => trim($_POST['name'] ?? ''),
|
||||
'email' => trim($_POST['email'] ?? ''),
|
||||
'password' => trim($_POST['password'] ?? ''),
|
||||
];
|
||||
|
||||
$this->errors = [];
|
||||
if (strlen($submitted['vorname']) < 2) {
|
||||
$this->errors['vorname'] = 'Vorname muss mindestens 2 Zeichen haben.';
|
||||
}
|
||||
if (strlen($submitted['name']) < 2) {
|
||||
$this->errors['name'] = 'Nachname muss mindestens 2 Zeichen haben.';
|
||||
}
|
||||
if (!filter_var($submitted['email'], FILTER_VALIDATE_EMAIL)) {
|
||||
$this->errors['email'] = 'Ungültige E-Mail-Adresse.';
|
||||
}
|
||||
if ($submitted['password'] !== '' && strlen($submitted['password']) < 6) {
|
||||
$this->errors['password'] = 'Passwort muss mindestens 6 Zeichen haben.';
|
||||
}
|
||||
|
||||
|
||||
if (count($this->errors) > 0) {
|
||||
$this->view->setVars([
|
||||
'changeUserLabels' => $this->changeUserLabels,
|
||||
'validData' => $submitted,
|
||||
'errors' => $this->errors,
|
||||
]);
|
||||
$this->view->render('User/showUserChangeAccountSettings');
|
||||
return;
|
||||
}
|
||||
|
||||
$updateData = [];
|
||||
if ($submitted['vorname'] !== $currentUser['vorname']) {
|
||||
$updateData['vorname'] = $submitted['vorname'];
|
||||
}
|
||||
if ($submitted['name'] !== $currentUser['name']) {
|
||||
$updateData['name'] = $submitted['name'];
|
||||
}
|
||||
if ($submitted['email'] !== $currentUser['email']) {
|
||||
$updateData['email'] = $submitted['email'];
|
||||
}
|
||||
if ($submitted['password'] !== '') {
|
||||
// Passwort und Salt auf neu setzen
|
||||
$salt = bin2hex(random_bytes(16));
|
||||
$hash = hash('sha256', $submitted['password'] . $salt);
|
||||
$updateData['passwort'] = $hash;
|
||||
$updateData['salt'] = $salt;
|
||||
}
|
||||
|
||||
|
||||
if ($submitted['password'] !== '') {
|
||||
$salt = bin2hex(random_bytes(16));
|
||||
$hash = hash('sha256', $submitted['password'] . $salt);
|
||||
$updateData['passwort'] = $hash;
|
||||
$updateData['salt'] = $salt;
|
||||
}
|
||||
|
||||
if (empty($updateData)) {
|
||||
$this->message = 'Keine Änderungen festgestellt.';
|
||||
$this->view->render('User/showUserChangeAccountSettings');
|
||||
return;
|
||||
}
|
||||
|
||||
$ok = $this->db->updateUserData($userId, $updateData);
|
||||
|
||||
if ($ok) {
|
||||
$_SESSION['vorname'] = $updateData['name'] ?? $_SESSION['vorname'];
|
||||
$_SESSION['name'] = $updateData['lastname'] ?? $_SESSION['name'];
|
||||
$_SESSION['email'] = $updateData['email'] ?? $_SESSION['email'];
|
||||
$this->message = 'Änderungen erfolgreich gespeichert.';
|
||||
|
||||
echo "ok";
|
||||
|
||||
header("Location: index.php?controller=user&do=showUserAccountPage");
|
||||
exit();
|
||||
} else {
|
||||
$this->errors['general'] = 'Beim Speichern ist ein Fehler aufgetreten.';
|
||||
$this->view->setVars([
|
||||
'changeUserLabels' => $this->changeUserLabels,
|
||||
'validData' => $submitted,
|
||||
'errors' => $this->errors,
|
||||
]);
|
||||
$this->view->setDoMethodName('showUserChangeAccountSettings');
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function enroll() {
|
||||
$courseId = $_POST['id'] ?? null;
|
||||
$userId = $_SESSION['user_id'] ?? null;
|
||||
|
||||
if ($userId === null) {
|
||||
new \Blog\Library\ErrorMsg("Nicht eingeloggt.");
|
||||
}
|
||||
|
||||
if ($courseId === null) {
|
||||
new \Blog\Library\ErrorMsg("Kein Kurs ausgewählt");
|
||||
}
|
||||
|
||||
$this->db->enroll($courseId, $userId);
|
||||
|
||||
$this->view->setDoMethodName("showEnrollmentConfirmation");
|
||||
}
|
||||
}
|
34
JS/modal.js
Normal file
34
JS/modal.js
Normal file
@@ -0,0 +1,34 @@
|
||||
document.addEventListener('DOMContentLoaded', () =>{
|
||||
const deleteForm = document.getElementById("deleteForm")
|
||||
const confirmModal = document.getElementById("confirmModal");
|
||||
const btnCancel = document.getElementById("btnCancel");
|
||||
console.log(btnCancel);
|
||||
const btnConfirm = document.getElementById("btnConfirm");
|
||||
|
||||
deleteForm.addEventListener('submit',e => {
|
||||
e.preventDefault();
|
||||
confirmModal.classList.add('is-visible');
|
||||
})
|
||||
|
||||
btnCancel.addEventListener('click', e => {
|
||||
confirmModal.classList.remove('is-visible');
|
||||
})
|
||||
|
||||
btnConfirm.addEventListener('click', e => {
|
||||
confirmModal.classList.remove('is-visible');
|
||||
deleteForm.submit();
|
||||
});
|
||||
|
||||
deleteForm.addEventListener('click', e => {
|
||||
if (e.target === deleteForm) {
|
||||
confirmModal.classList.remove('is-visible');
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', e => {
|
||||
if (e.key === 'Escape' && deleteForm.classList.contains('is-visible')) {
|
||||
confirmModal.classList.remove('is-visible');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Blog\Model;
|
||||
|
||||
use PDOException;
|
||||
|
||||
class AdminModel extends Database
|
||||
{
|
||||
public function writeNewCourse($values)
|
||||
{
|
||||
$guid = $this->createUUID();
|
||||
|
||||
$sql = "INSERT INTO kurs (`id`, `name`, `preis`, `dauer`, `rabatt`, `kategorie`, `beschreibung`) VALUES (
|
||||
:guid, :name, :preis, :dauer, :rabatt, :kategorie, :beschreibung);";
|
||||
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute(array(":guid" => $guid,
|
||||
":name" => $values["name"],
|
||||
":preis" => $values["preis"],
|
||||
":dauer" => $values["dauer"],
|
||||
":rabatt" => $values["rabatt"],
|
||||
":kategorie" => $values["kategorie"],
|
||||
":beschreibung" => $values["beschreibung"],
|
||||
));
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Schreiben der Daten.", $e);
|
||||
die;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
24
Model/CourseModel.php
Normal file
24
Model/CourseModel.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Blog\Model;
|
||||
|
||||
use Blog\Model\Database;
|
||||
use PDOException;
|
||||
use Random\RandomException;
|
||||
|
||||
class CourseModel extends Database
|
||||
{
|
||||
public function getCourseById(string $id){
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "SELECT k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, k.ort_id,
|
||||
o.stadt, o.strasse, o.plz, b.note, b.kommentar
|
||||
FROM kurs k
|
||||
JOIN ort o ON k.ort_id = o.id
|
||||
LEFT JOIN bewertungen AS b ON b.kurs_id = k.id
|
||||
WHERE k.id = :id";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([':id' => $id]);
|
||||
$result = $sth->fetch(\PDO::FETCH_ASSOC);
|
||||
return $result ?? null;
|
||||
}
|
||||
}
|
@@ -17,7 +17,7 @@ class UserModel extends Database
|
||||
|
||||
$hash = hash('sha256', $values["password"] . $salt);
|
||||
|
||||
$guid = rand(0, 500);
|
||||
$guid = $this->createUUID();
|
||||
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
@@ -59,4 +59,270 @@ class UserModel extends Database
|
||||
return $sth->fetch();
|
||||
}
|
||||
|
||||
public function deleteUser($id){
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "DELETE FROM user WHERE id = :id";
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->bindParam(":id", $id);
|
||||
$sth->execute();
|
||||
}
|
||||
|
||||
public function updateUserData($id, $values){
|
||||
$pdo = $this->linkDB();
|
||||
$fields = [];
|
||||
$params = [':id' => $id];
|
||||
|
||||
if(!empty($values["password"])){
|
||||
$salt = bin2hex(random_bytes(16));
|
||||
$hash = hash('sha256', $values["password"] . $salt);
|
||||
$fields["password"] = "´passwort´ = :password";
|
||||
$fields["salt"] = "´salt´ = :salt";
|
||||
$params[":password"] = $hash;
|
||||
$params[":salt"] = $salt;
|
||||
}
|
||||
|
||||
foreach (['name','vorname','email'] as $col) {
|
||||
if (isset($values[$col])) {
|
||||
$fields[] = "`{$col}` = :{$col}";
|
||||
$params[":{$col}"] = $values[$col];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE user
|
||||
SET " . implode(", ", $fields) . "
|
||||
where id = :id";
|
||||
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute($params);
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren der Daten.", $e);
|
||||
die;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function writeNewAddress($values) {
|
||||
$guid = $this->createUUID();
|
||||
|
||||
$sql = "INSERT INTO ort (`id`, `stadt`, `strasse`, `plz`) VALUES (
|
||||
:guid, :stadt, :strasse, :plz);";
|
||||
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute(array(":guid" => $guid,
|
||||
":stadt" => $values["stadt"],
|
||||
":strasse" => $values["strasse"],
|
||||
":plz" => $values["plz"],
|
||||
));
|
||||
return $guid;
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Schreiben der Daten.", $e);
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
public function writeNewCourse($values, $kursleiterId)
|
||||
{
|
||||
// Bleibt übrig wenn Adresse erstellt wird aber Kurs nicht weil Error
|
||||
$addressId = $this->writeNewAddress($values);
|
||||
|
||||
$guid = $this->createUUID();
|
||||
|
||||
$sql = "INSERT INTO kurs (`id`, `name`, `preis`, `dauer`, `rabatt`, `kategorie`, `beschreibung`, `kurseleiter`, `ort_id`) VALUES (
|
||||
:guid, :name, :preis, :dauer, :rabatt, :kategorie, :beschreibung, :kurseleiter, :ort_id);";
|
||||
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute(array(":guid" => $guid,
|
||||
":name" => $values["name"],
|
||||
":preis" => $values["preis"],
|
||||
":dauer" => $values["dauer"],
|
||||
":rabatt" => $values["rabatt"],
|
||||
":kategorie" => $values["kategorie"],
|
||||
":beschreibung" => $values["beschreibung"],
|
||||
":kurseleiter" => $kursleiterId,
|
||||
"ort_id" => $addressId
|
||||
));
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Schreiben der Daten.", $e);
|
||||
die;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getMyCourses() {
|
||||
$personId = $_SESSION["user_id"];
|
||||
$isKursleiter = $_SESSION["user_role"] === "leiter";
|
||||
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
if ($isKursleiter) {
|
||||
$sql = "SELECT k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, k.ort_id,
|
||||
o.stadt, o.strasse, o.plz, b.note, b.kommentar
|
||||
FROM kurs AS k
|
||||
JOIN ort AS o ON o.id = k.ort_id
|
||||
LEFT JOIN bewertungen AS b ON b.kurs_id = k.id
|
||||
WHERE k.kursleiter = :personId
|
||||
ORDER BY k.name";
|
||||
} else {
|
||||
$sql = "SELECT k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, k.ort_id,
|
||||
o.stadt, o.strasse, o.plz, b.note, b.kommentar
|
||||
FROM kurs_user AS ku
|
||||
JOIN kurs AS k ON k.id = ku.kurs_id
|
||||
JOIN ort AS o ON o.id = k.ort_id
|
||||
LEFT JOIN bewertungen AS b ON b.kurs_id = k.id
|
||||
WHERE ku.user_id = :personId
|
||||
ORDER BY k.name";
|
||||
}
|
||||
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([':personId' => $personId]);
|
||||
return $sth->fetchAll(\PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Daten.", $e);
|
||||
die;
|
||||
}
|
||||
}
|
||||
public function getAllCourses() {
|
||||
$pdo = $this->linkDB();
|
||||
$userId = $_SESSION['user_id'] ?? null;
|
||||
|
||||
if ($userId === null) {
|
||||
$sql = "SELECT
|
||||
k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, k.ort_id,
|
||||
o.stadt, o.strasse, o.plz, b.note, b.kommentar,
|
||||
0 AS isTeilnehmer
|
||||
FROM kurs AS k
|
||||
JOIN ort AS o ON o.id = k.ort_id
|
||||
LEFT JOIN bewertungen AS b ON b.kurs_id = k.id";
|
||||
$params = [];
|
||||
} else {
|
||||
$sql = "SELECT
|
||||
k.id, k.name, k.preis, k.dauer, k.rabatt, k.kategorie, k.beschreibung, k.ort_id,
|
||||
o.stadt, o.strasse, o.plz, b.note, b.kommentar,
|
||||
CASE WHEN ku.user_id IS NULL THEN 0 ELSE 1 END AS isTeilnehmer
|
||||
FROM kurs AS k
|
||||
JOIN ort AS o ON o.id = k.ort_id
|
||||
LEFT JOIN bewertungen AS b ON b.kurs_id = k.id
|
||||
LEFT JOIN kurs_user AS ku ON ku.kurs_id = k.id AND ku.user_id = :userId";
|
||||
$params = ['userId' => $userId];
|
||||
}
|
||||
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute($params);
|
||||
return $sth->fetchAll(\PDO::FETCH_ASSOC);
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Lesen der Daten.", $e);
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateCourse($course) {
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
try {
|
||||
if (isset($course['ort_id'])) {
|
||||
$this->updateAddress($course);
|
||||
$addressId = $course['ort_id'];
|
||||
} else {
|
||||
$addressId = $this->writeNewAddress($course);
|
||||
}
|
||||
|
||||
$sql = "UPDATE kurs SET
|
||||
`name` = :name,
|
||||
`preis` = :preis,
|
||||
`dauer` = :dauer,
|
||||
`rabatt` = :rabatt,
|
||||
`kategorie` = :kategorie,
|
||||
`beschreibung` = :beschreibung,
|
||||
`ort_id` = :ort_id
|
||||
WHERE `id` = :id";
|
||||
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([
|
||||
':id' => $course['id'],
|
||||
':name' => $course['name'],
|
||||
':preis' => $course['preis'],
|
||||
':dauer' => $course['dauer'],
|
||||
':rabatt' => $course['rabatt'],
|
||||
':kategorie' => $course['kategorie'],
|
||||
':beschreibung' => $course['beschreibung'],
|
||||
':ort_id' => $addressId
|
||||
]);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren des Kurses.", $e);
|
||||
die;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function updateAddress($data) {
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
if (!isset($data['ort_id'])) {
|
||||
throw new \Exception("Keine Adress-ID vorhanden zum Aktualisieren.");
|
||||
}
|
||||
|
||||
$sql = "UPDATE ort SET
|
||||
`strasse` = :strasse,
|
||||
`stadt` = :stadt,
|
||||
`plz` = :plz
|
||||
WHERE `id` = :id";
|
||||
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute([
|
||||
':id' => $data['ort_id'],
|
||||
':strasse' => $data['strasse'],
|
||||
':stadt' => $data['stadt'],
|
||||
':plz' => $data['plz']
|
||||
]);
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Aktualisieren der Adresse.", $e);
|
||||
die;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function enroll($courseId, $userId) {
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
try {
|
||||
$checkSql = "SELECT COUNT(*) FROM kurs_user WHERE user_id = :user_id AND kurs_id = :kurs_id";
|
||||
$checkStmt = $pdo->prepare($checkSql);
|
||||
$checkStmt->execute([
|
||||
':user_id' => $userId,
|
||||
':kurs_id' => $courseId
|
||||
]);
|
||||
|
||||
if ($checkStmt->fetchColumn() > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$insertSql = "INSERT INTO kurs_user (user_id, kurs_id) VALUES (:user_id, :kurs_id)";
|
||||
$insertStmt = $pdo->prepare($insertSql);
|
||||
$insertStmt->execute([
|
||||
':user_id' => $userId,
|
||||
':kurs_id' => $courseId
|
||||
]);
|
||||
|
||||
} catch (PDOException $e) {
|
||||
new \Blog\Library\ErrorMsg("Fehler beim Einschreiben in den Kurs.", $e);
|
||||
die;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<h2>Neuer Kurs</h2>
|
||||
<form method="post" class="form-grid">
|
||||
|
||||
<?php
|
||||
$index = 0;
|
||||
|
||||
foreach ($labels as $key => $value) {
|
||||
echo '<div class="input"><label for="' . $key . '">' . $value . '</label>';
|
||||
if ($key == "beschreibung") {
|
||||
echo "<textarea id=\"$key\" name=\"$key\" >";
|
||||
if (isset($validData[$key])) { echo $validData[$key]; }
|
||||
echo "</textarea><br>";
|
||||
} else {
|
||||
echo '<input class="input" type="text" name="' . $key . '" value="' . (isset($validData[$key]) ? $validData[$key] : '') . '"><br>';
|
||||
}
|
||||
if (isset($errors[$key])) {
|
||||
echo '<label class="errorMsg">' . $errors[$key] . '</label><br>';
|
||||
}
|
||||
echo '</div>';
|
||||
$index++;
|
||||
}
|
||||
?>
|
||||
|
||||
<input type="hidden" name="controller" value="admin">
|
||||
<input type="hidden" name="do" value="showForm">
|
||||
<input type="submit" name="submit" value="Absenden"></form>
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
20
Views/Course/showCourse.phtml
Normal file
20
Views/Course/showCourse.phtml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h1><?= htmlspecialchars($kurs['name']) ?></h1>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<p><strong>Bewertung:</strong> <?= $kurs['note'] ?> ★</p>
|
||||
<p><strong>Preis:</strong> <?= htmlspecialchars($kurs['preis']) ?>€</p>
|
||||
<p><strong>Adresse:</strong> <?= htmlspecialchars($kurs['strasse']) ?>, <?= htmlspecialchars($kurs['plz']) ?> <?= htmlspecialchars($kurs['stadt']) ?></p>
|
||||
<p><?= nl2br(htmlspecialchars($kurs['beschreibung'] ?? '')) ?></p>
|
||||
<a href="index.php">‹ Zurück zur Kursübersicht</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
116
Views/User/showAdminForm.phtml
Normal file
116
Views/User/showAdminForm.phtml
Normal file
@@ -0,0 +1,116 @@
|
||||
<h2>Neuer Kurs</h2>
|
||||
<form method="post">
|
||||
<?php
|
||||
$userModel = new \Blog\Model\UserModel();
|
||||
$courses = $userModel->getMyCourses();
|
||||
$id = $_GET["id"] ?? null;
|
||||
|
||||
$selectedCourse = null;
|
||||
foreach ($courses as $course) {
|
||||
if ($course['id'] === $id) {
|
||||
$selectedCourse = $course;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$validData = $selectedCourse ?? null;
|
||||
$isEditing = $validData != null;
|
||||
$saveLabel = $isEditing ? "Speichern" : "Erstellen";
|
||||
|
||||
function createInputField($label, $name, $errors, $validData, $type = 'input') {
|
||||
$errorClass = isset($errors[$name]) ? 'error' : '';
|
||||
$value = htmlspecialchars($validData[$name] ?? '');
|
||||
$errorMessage = isset($errors[$name]) ? '<p class="error">' . htmlspecialchars($errors[$name]) . '</p>' : '';
|
||||
|
||||
if($type === 'textarea') {
|
||||
return <<<HTML
|
||||
<div style="grid-column: 1 / -1;" class="input">
|
||||
<label for="{$name}">{$label}</label>
|
||||
<textarea class="{$errorClass}" name="{$name}">{$value}</textarea>
|
||||
{$errorMessage}
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
return <<<HTML
|
||||
<div class="input">
|
||||
<label for="{$name}">{$label}</label>
|
||||
<input class="{$errorClass}" type="text" name="{$name}" value="{$value}">
|
||||
{$errorMessage}
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
echo '<div style="margin-top: 32px;" class="form-grid-3">';
|
||||
foreach ($labels as $name => $label) {
|
||||
if($label === "|") {
|
||||
echo '</div>';
|
||||
echo '<div style="margin-top: 32px;" class="form-grid-3">';
|
||||
} else {
|
||||
echo createInputField($label, $name, $errors, $validData, $type = $name === 'beschreibung' ? 'textarea' : 'input');
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
?>
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<?php
|
||||
$action = $isEditing ? 'validateEditKursForm' : 'validateKursForm';
|
||||
echo <<<HTML
|
||||
<input type="hidden" name="do" value="{$action}">
|
||||
<div class="form-grid-3" style="margin-top: 16px;">
|
||||
<input style="grid-column: 3;" type="submit" name="submit" value="{$saveLabel}">
|
||||
</div>
|
||||
HTML;
|
||||
?>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
$doc = new DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
if (!empty($courses)) {
|
||||
echo '<div class="courses-view">';
|
||||
foreach ($courses as $kurs) {
|
||||
$courseCard = $doc->createElement('div');
|
||||
$courseCard->setAttribute('class', 'course-card');
|
||||
|
||||
$courseImage = $doc->createElement('div');
|
||||
$courseImage->setAttribute('class', 'course-image');
|
||||
$courseCard->appendChild($courseImage);
|
||||
|
||||
$courseContent = $doc->createElement('div');
|
||||
$courseContent->setAttribute('class', 'course-content');
|
||||
$courseCard->appendChild($courseContent);
|
||||
|
||||
$courseLeft = $doc->createElement('div');
|
||||
$courseLeft->setAttribute('class', 'course-left');
|
||||
$courseContent->appendChild($courseLeft);
|
||||
|
||||
$note = $doc->createElement('div', htmlspecialchars($kurs['note'] ?? 'Keine Bewertung') . ' ★');
|
||||
$courseLeft->appendChild($note);
|
||||
|
||||
$name = $doc->createElement('div', htmlspecialchars($kurs['name']));
|
||||
$courseLeft->appendChild($name);
|
||||
|
||||
$address = $doc->createElement('div', htmlspecialchars($kurs['strasse'] . ', ' . $kurs['stadt'] . ' ' . $kurs['plz']));
|
||||
$courseLeft->appendChild($address);
|
||||
|
||||
$courseRight = $doc->createElement('div');
|
||||
$courseRight->setAttribute('class', 'course-right');
|
||||
$courseContent->appendChild($courseRight);
|
||||
|
||||
$price = $doc->createElement('div', htmlspecialchars($kurs['preis']) . ' €');
|
||||
$courseRight->appendChild($price);
|
||||
|
||||
$category = $doc->createElement('div', htmlspecialchars($kurs['kategorie'] ?? 'Keine Kategorie'));
|
||||
$courseRight->appendChild($category);
|
||||
|
||||
$editLink = $doc->createElement('a', "Bearbeiten");
|
||||
$editLink->setAttribute('href', '?controller=User&do=showUserAccountPage&id=' . $kurs['id']);
|
||||
$editLink->setAttribute('class', 'course-card-link');
|
||||
$courseRight->appendChild($editLink);
|
||||
|
||||
echo $doc->saveHTML($courseCard);
|
||||
}
|
||||
echo '</div>';
|
||||
} else {
|
||||
echo '<p>Keine Kurse gefunden.</p>';
|
||||
}
|
||||
?>
|
12
Views/User/showEnrollmentConfirmation.phtml
Normal file
12
Views/User/showEnrollmentConfirmation.phtml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<div class="msg">
|
||||
<p>Erfolgreich aufgenommen!</p>
|
||||
<a href="?controller=welcome">Weiter</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
12
Views/User/showKursEditedConfirmation.phtml
Normal file
12
Views/User/showKursEditedConfirmation.phtml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<div class="msg">
|
||||
<p>Kurs erfolgreich bearbeitet.</p>
|
||||
<a href="?controller=User&do=showUserAccountPage">Weiter</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
12
Views/User/showNewKursConfirmation.phtml
Normal file
12
Views/User/showNewKursConfirmation.phtml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<div class="msg">
|
||||
<p>Kurs erfolgreich erstellt.</p>
|
||||
<a href="?controller=User&do=showUserAccountPage">Weiter</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
64
Views/User/showUserAccountPage.phtml
Normal file
64
Views/User/showUserAccountPage.phtml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<article>
|
||||
<div id="confirmModal" class="modal-overlay">
|
||||
<div class="modal">
|
||||
<p>Sind Sie sicher, dass Sie Ihren Account löschen möchten?</p>
|
||||
<div class="row" style="flex-wrap: nowrap">
|
||||
<button id="btnCancel" class="btn btn-secondary">Abbrechen</button>
|
||||
<button id="btnConfirm" class="btn btn-logout">Ja, Account löschen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<h1>Hallo,
|
||||
<?php echo ($_SESSION['vorname'] ?? "") . " " . ($_SESSION['name'] ?? "") ?>
|
||||
</br>
|
||||
Hier können Sie ihren Account verwalten.
|
||||
</h1>
|
||||
</div>
|
||||
<div class="col-4 sidebar">
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<form method="post">
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<input type="hidden" name="do" value="logout">
|
||||
<button type="submit" class="btn btn-primary">Ausloggen</button>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<form method="post">
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<input type="hidden" name="do" value="changeAccountDataRedirect">
|
||||
<button type="submit" class="btn btn-userchange">Meine Kontodaten ändern</button>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<form method="post" id="deleteForm">
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<input type="hidden" name="do" value="deleteAccount">
|
||||
<button type="submit" class="btn btn-logout">Meinen Account löschen</button>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if(isset($_SESSION["user_id"]) && $_SESSION["user_id"] != null && $_SESSION["user_role"] == "leiter") {
|
||||
include dirname(__DIR__).'/User/showAdminForm.phtml';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
36
Views/User/showUserChangeAccountSettings.phtml
Normal file
36
Views/User/showUserChangeAccountSettings.phtml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h1>Meine Daten ändern</h1>
|
||||
|
||||
<form method="post" class="form-grid form-user">
|
||||
<?php foreach ($changeUserLabels as $key => $label): ?>
|
||||
<div class="input">
|
||||
<label for="reg_<?= $key ?>"><?= $label ?></label>
|
||||
<?php if ($key === 'password'): ?>
|
||||
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>">
|
||||
<?php elseif($key === 'email'): ?>
|
||||
<input type="email" name="<?= $key ?>" id="reg_<?= $key ?>" value="<?= htmlspecialchars($validData[$key] ?? '') ?>">
|
||||
<?php else: ?>
|
||||
<input type="text" name="<?= $key ?>" id="reg_<?= $key ?>" value="<?= htmlspecialchars($validData[$key] ?? $_SESSION['vorname']) ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($errors[$key])): ?>
|
||||
<div class="error"><?= $errors[$key] ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<input type="hidden" name="do" value="updateAccountData">
|
||||
<button type="submit" class="btn btn-primary btn-form" style="display: block">Meine Info ändern</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
16
Views/User/showUserDeleteConfirmation.phtml
Normal file
16
Views/User/showUserDeleteConfirmation.phtml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h1>Der Account wurde erfolgreich gelöscht</h1>
|
||||
<div class="row">
|
||||
<a class="btn btn-primary" href="index.php">Unsere Kurse ansehen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
@@ -2,16 +2,25 @@
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<?php if ($user): ?>
|
||||
<p>Hallo, <?= htmlspecialchars($user['vorname']) ?> <?= htmlspecialchars($user['name']) ?>!</p>
|
||||
<?php else: ?>
|
||||
<p>Benutzerdaten konnten nicht geladen werden.</p>
|
||||
<?php endif; ?>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h1>Erfolgreiche Anmeldung!</h1>
|
||||
|
||||
<h1>Sie haben sich erfolgreich angemeldet</h1>
|
||||
<?php if ($user): ?>
|
||||
<p class="paragraph">Hallo, <?= htmlspecialchars($user['vorname']) ?> <?= htmlspecialchars($user['name']) ?>!</p>
|
||||
|
||||
<div class="row" style="gap: 10px">
|
||||
<a class="btn btn-primary" href="index.php">Unsere Kurse ansehen</a>
|
||||
<a class="btn btn-secondaty" href="?controller=User&do=showUserAccountPage">Zu meinem Account</a>
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<p>Benutzerdaten konnten nicht geladen werden.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
include dirname(__DIR__).'/footer.phtml';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
||||
|
@@ -2,22 +2,35 @@
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<h1>Als Benutzer anmelden</h1>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h1>Anmeldung</h1>
|
||||
|
||||
<form method="post">
|
||||
<form method="post" class="form-grid form-user">
|
||||
<?php foreach ($labels as $key => $label): ?>
|
||||
<div class="input">
|
||||
<label for="reg_<?= $key ?>"><?= $label ?></label>
|
||||
<?php if ($key === 'password'): ?>
|
||||
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
|
||||
<?php elseif($key === 'email'): ?>
|
||||
<input type="email" name="<?= $key ?>" id="reg_<?= $key ?>" required>
|
||||
<?php else: ?>
|
||||
<input type="text" name="<?= $key ?>" id="reg_<?= $key ?>" value="<?= htmlspecialchars($validData[$key] ?? '') ?>" required>
|
||||
<?php endif; ?>
|
||||
|
||||
<label for="reg_email">Email:</label>
|
||||
<input type="email" name="email" id="reg_email" required>
|
||||
<?php if (!empty($errors[$key])): ?>
|
||||
<div class="error"><?= $errors[$key] ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<label for="reg_password">Passwort:</label>
|
||||
<input type="password" name="password" id="reg_password" required>
|
||||
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<input type="hidden" name="do" value="login">
|
||||
<button type="submit" class="btn" style="display: block">Login</button>
|
||||
</form>
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<input type="hidden" name="do" value="login">
|
||||
<button type="submit" class="btn btn-primary btn-form" style="display: block">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
include dirname(__DIR__).'/footer.phtml';
|
||||
?>
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
@@ -9,3 +9,5 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/footer.phtml';
|
||||
?>
|
||||
|
||||
|
||||
|
@@ -2,38 +2,37 @@
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
|
||||
<h1>Benutzer erstellen</h1>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h1>Registration</h1>
|
||||
<form method="post" class="form-grid">
|
||||
<?php foreach ($labels as $key => $label): ?>
|
||||
<div class="input <?= $key === 'role' ? "radio" : "" ?>">
|
||||
<label for="reg_<?= $key ?>"><?= $label ?></label>
|
||||
<?php if ($key === 'password'): ?>
|
||||
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
|
||||
<?php elseif ($key === 'role'): ?>
|
||||
<label><input type="radio" name="role" value="user" required<?= (isset($validData['role']) && $validData['role'] === 'user') ? 'checked' : '' ?>> User</label>
|
||||
<label><input type="radio" name="role" value="leiter" <?= (isset($validData['role']) && $validData['role'] === 'leiter') ? 'checked' : '' ?>> Leiter</label>
|
||||
<?php else: ?>
|
||||
<input type="text" name="<?= $key ?>" id="reg_<?= $key ?>" value="<?= htmlspecialchars($validData[$key] ?? '') ?>" required>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post">
|
||||
<h2>Registrieren</h2>
|
||||
<?php if (!empty($errors[$key])): ?>
|
||||
<div class="error"><?= $errors[$key] ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<label for="reg_name">Vorname:</label>
|
||||
<input type="text" name="name" id="reg_name" required>
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<input type="hidden" name="do" value="register">
|
||||
|
||||
<label for="reg_lastname">Nachname:</label>
|
||||
<input type="text" name="lastname" id="reg_lastname" required>
|
||||
<input type="text" class="input-transparent">
|
||||
<button type="submit" class="btn btn-primary btn-form">Registrieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label for="reg_email">Email:</label>
|
||||
<input type="email" name="email" id="reg_email" required>
|
||||
|
||||
<label for="reg_password">Passwort:</label>
|
||||
<input type="password" name="password" id="reg_password" required>
|
||||
|
||||
<p>Wähle deine Rolle:</p>
|
||||
<label>
|
||||
<input type="radio" name="role" value="user" required> User
|
||||
</label>
|
||||
<label>
|
||||
<input type="radio" name="role" value="leiter"> Leiter
|
||||
</label>
|
||||
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<input type="hidden" name="do" value="register">
|
||||
<button type="submit" class="btn" style="display: block">Registrieren</button>
|
||||
</form>
|
||||
|
||||
<a href="?controller=User&do=showUserLoginForm">Haben Sie schon ein Benutzer Konto?</a>
|
||||
|
||||
<?php
|
||||
include dirname(__DIR__).'/footer.phtml';
|
||||
?>
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
||||
|
@@ -1,23 +1,107 @@
|
||||
<?php
|
||||
include dirname(__DIR__).'/header.phtml';
|
||||
?>
|
||||
include dirname(__DIR__) . '/header.phtml';
|
||||
|
||||
<!-- <a href="?controller=guestbook&do=showGuestbookForm">Neuen Eintrag schreiben</a> -->
|
||||
<article>
|
||||
<h2>Willkommen</h2>
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
</p>
|
||||
<p>
|
||||
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
|
||||
</p>
|
||||
<p>
|
||||
Fusce convallis, mauris imperdiet gravida bibendum, nisl turpis suscipit mauris, sed placerat ipsum urna sed risus. In convallis tellus a mauris. Curabitur non elit ut libero tristique sodales. Mauris a lacus. Donec mattis semper leo. In hac habitasse platea dictumst. Vivamus facilisis diam at odio. Mauris dictum, nisi eget consequat elementum, lacus ligula molestie metus, non feugiat orci magna ac sem. Donec turpis. Donec vitae metus. Morbi tristique neque eu mauris. Quisque gravida ipsum non sapien. Proin turpis lacus, scelerisque vitae, elementum at, lobortis ac, quam. Aliquam dictum eleifend risus. In hac habitasse platea dictumst. Etiam sit amet diam. Suspendisse odio. Suspendisse nunc. In semper bibendum libero.
|
||||
</p>
|
||||
<p>
|
||||
Proin nonummy, lacus eget pulvinar lacinia, pede felis dignissim leo, vitae tristique magna lacus sit amet eros. Nullam ornare. Praesent odio ligula, dapibus sed, tincidunt eget, dictum ac, nibh. Nam quis lacus. Nunc eleifend molestie velit. Morbi lobortis quam eu velit. Donec euismod vestibulum massa. Donec non lectus. Aliquam commodo lacus sit amet nulla. Cras dignissim elit et augue. Nullam non diam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In hac habitasse platea dictumst. Aenean vestibulum. Sed lobortis elit quis lectus.
|
||||
Nunc sed lacus at augue bibendum dapibus.
|
||||
</p>
|
||||
</article>
|
||||
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
||||
$rating = $_GET['rating'] ?? '';
|
||||
$price = $_GET['price'] ?? '';
|
||||
$location = $_GET['location'] ?? '';
|
||||
?>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h1 class="welcome-heading">KURSE & ERLEBNISSE JEDER ART</h1>
|
||||
<p class="welcome-subheading">Alle Kurse in deiner Nähe – auf einen Blick</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 col-m-12">
|
||||
<div class="filter-box">
|
||||
<form method="get">
|
||||
<label for="rating">Bewertung:</label>
|
||||
<select name="rating" id="rating">
|
||||
<option value="">Alle</option>
|
||||
<option value="5" <?= $rating == '5' ? 'selected' : '' ?>>5 Sterne</option>
|
||||
<option value="4" <?= $rating == '4' ? 'selected' : '' ?>>4 Sterne+</option>
|
||||
<option value="3" <?= $rating == '3' ? 'selected' : '' ?>>3 Sterne+</option>
|
||||
</select>
|
||||
|
||||
<label for="price">Preis:</label>
|
||||
<select name="price" id="price">
|
||||
<option value="">Alle</option>
|
||||
<option value="asc" <?= $price == 'asc' ? 'selected' : '' ?>>Aufsteigend</option>
|
||||
<option value="desc" <?= $price == 'desc' ? 'selected' : '' ?>>Absteigend</option>
|
||||
</select>
|
||||
<button type="submit">Anwenden</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-9">
|
||||
<div class="course-grid row">
|
||||
<?php
|
||||
$userModel = new \Blog\Model\UserModel();
|
||||
$kurse = $userModel->getAllCourses();
|
||||
|
||||
$filteredKurse = array_filter($kurse, function($kurs) use ($rating, $location) {
|
||||
if ($rating && $kurs['note'] < $rating) return false;
|
||||
if ($location && stripos($kurs['ort'], $location) === false) return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
if ($price) {
|
||||
usort($filteredKurse, function($a, $b) use ($price) {
|
||||
$priceA = floatval(str_replace(',', '.', str_replace('€', '', $a['preis'])));
|
||||
$priceB = floatval(str_replace(',', '.', str_replace('€', '', $b['preis'])));
|
||||
return $price === 'asc' ? $priceA <=> $priceB : $priceB <=> $priceA;
|
||||
});
|
||||
}
|
||||
|
||||
$doc = new DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
if (!empty($filteredKurse)) {
|
||||
foreach ($filteredKurse as $kurs) {
|
||||
foreach ($filteredKurse as $kurs) {
|
||||
$id = htmlspecialchars($kurs['id']);
|
||||
$note = htmlspecialchars($kurs['note'] ?? 'Keine Bewertung') . ' ★';
|
||||
$name = htmlspecialchars($kurs['name']);
|
||||
$address = htmlspecialchars($kurs['strasse'] . ', ' . $kurs['stadt'] . ' ' . $kurs['plz']);
|
||||
$preis = htmlspecialchars($kurs['preis']) . ' €';
|
||||
$kategorie = htmlspecialchars($kurs['kategorie'] ?? 'Keine Kategorie');
|
||||
|
||||
echo <<<HTML
|
||||
<a style="flex: 0 0 calc(50% - 20px);" href="?controller=course&do=showCourse&courseId=$id">
|
||||
<div class="course-card">
|
||||
<div class="course-image"></div>
|
||||
<div class="course-content">
|
||||
<div class="course-left">
|
||||
<div>$note</div>
|
||||
<div>$name</div>
|
||||
<div>$address</div>
|
||||
</div>
|
||||
<div class="course-right">
|
||||
<div>$preis</div>
|
||||
<div>$kategorie</div>
|
||||
<form method="POST" class="course-card-form">
|
||||
<input type="hidden" name="do" value="enroll">
|
||||
<input type="hidden" name="controller" value="user">
|
||||
<input type="hidden" name="id" value="$id">
|
||||
<button type="submit" class="btn-link">Teilnehmen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo '<p>Keine Kurse gefunden.</p>';
|
||||
}
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,11 +1,6 @@
|
||||
</main>
|
||||
</div>
|
||||
<footer>
|
||||
<div id="wrapper">
|
||||
<div class="d-flex-between">
|
||||
<h3 class="logo">bib<span>course</span></h3>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<footer>
|
||||
</footer>
|
||||
<script src="JS/modal.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -14,24 +14,31 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<div id="wrapper">
|
||||
<div class="d-flex-between">
|
||||
<h3 class="logo">bib<span>course</span></h3>
|
||||
<div id="metanavi">
|
||||
<a class="btn btn-user" href="?controller=Admin&do=showForm"><span class="material-icons">person</span></a>
|
||||
<a class="btn btn-register" href="?controller=User&do=showUserRegisterForm">Registration</a>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<header>
|
||||
<nav class="d-flex-between">
|
||||
<a id="logo" href="index.php">bib<span>course</span></a>
|
||||
<div style="column-gap: 8px;" class="d-flex-between">
|
||||
<div style="column-gap: 8px;" class="d-flex-between">
|
||||
<?php if (isset($_SESSION['user_id']) && $_SESSION['user_id'] !== null): ?>
|
||||
<a style="column-gap: 16px;" class="btn" href="?controller=User&do=showUserAccountPage">
|
||||
<?php echo ($_SESSION['vorname'] ?? "") . " " . ($_SESSION['name'] ?? "") . ", " . ($_SESSION['user_role']) ?>
|
||||
<span class="btn btn-user">
|
||||
<span class="material-icons">person</span>
|
||||
</span>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a class="btn" href="?controller=User&do=showUserLoginForm">Anmeldung</a>
|
||||
<a class="btn btn-primary" href="?controller=User&do=showUserRegisterForm">Registration</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
</div>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="?controller=Welcome&do=showWelcome">Willkommen</a></li>
|
||||
<li><a href="#">Projekte</a></li>
|
||||
<li><a href="#">Workshops</a></li>
|
||||
<li><a href="?controller=Contact&do=showContactForm">Kontakt</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
<div id="wrapper">
|
||||
<main>
|
||||
</div>
|
||||
<!-- TODO Transparent mit Fehleranzeige bei der Anmeldung -->
|
||||
<main>
|
30
contact.sql
30
contact.sql
@@ -1,30 +0,0 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.5.1
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: 127.0.0.1
|
||||
-- Erstellungszeit: 24. Nov 2017 um 17:01
|
||||
-- Server-Version: 10.1.16-MariaDB
|
||||
-- PHP-Version: 7.0.9
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
--
|
||||
-- Datenbank: `blog`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
CREATE TABLE `contact` (
|
||||
`id` varchar(36) NOT NULL,
|
||||
`topicCode` tinyint(2) NULL,
|
||||
`name` varchar(200) NOT NULL,
|
||||
`email` varchar(300) NOT NULL,
|
||||
`phone` varchar(16) NULL,
|
||||
`content` varchar(500) NOT NULL,
|
||||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `contact`
|
||||
ADD PRIMARY KEY (`id`)
|
56
db.sql
Normal file
56
db.sql
Normal file
@@ -0,0 +1,56 @@
|
||||
DROP TABLE IF EXISTS kurs_user;
|
||||
DROP TABLE IF EXISTS bewertungen;
|
||||
DROP TABLE IF EXISTS kurs;
|
||||
DROP TABLE IF EXISTS ort;
|
||||
DROP TABLE IF EXISTS `user`;
|
||||
|
||||
-- Tabelle: user
|
||||
CREATE TABLE `user`(
|
||||
id VARCHAR(36) NOT NULL UNIQUE,
|
||||
vorname VARCHAR(50) NOT NULL,
|
||||
`name` VARCHAR(50) NOT NULL,
|
||||
email VARCHAR(100) NOT NULL UNIQUE,
|
||||
passwort VARCHAR(255) NOT NULL,
|
||||
salt VARCHAR(255) NOT NULL,
|
||||
role ENUM('user', 'leiter') NOT NULL
|
||||
);
|
||||
-- Tabelle: ort
|
||||
CREATE TABLE ort(
|
||||
id VARCHAR(36) NOT NULL UNIQUE,
|
||||
stadt VARCHAR(100) NOT NULL,
|
||||
plz VARCHAR(10) NOT NULL,
|
||||
strasse VARCHAR(100) NOT NULL
|
||||
);
|
||||
-- Tabelle: kurs
|
||||
CREATE TABLE kurs(
|
||||
id VARCHAR(36) NOT NULL UNIQUE,
|
||||
`name` VARCHAR(100) NOT NULL,
|
||||
kategorie VARCHAR(100),
|
||||
preis DECIMAL(10, 2) NOT NULL,
|
||||
kurseleiter VARCHAR(36) NOT NULL,
|
||||
ort_id VARCHAR(36) NOT NULL,
|
||||
rabatt DECIMAL(5, 2) DEFAULT 0,
|
||||
dauer INT NOT NULL,
|
||||
beschreibung TEXT,
|
||||
FOREIGN KEY(kurseleiter) REFERENCES `user`(id),
|
||||
FOREIGN KEY(ort_id) REFERENCES ort(id)
|
||||
);
|
||||
-- Tabelle: kurs_user (Viele-zu-Viele-Verknüpfung)
|
||||
CREATE TABLE kurs_user(
|
||||
user_id VARCHAR(36) NOT NULL,
|
||||
kurs_id VARCHAR(36) NOT NULL,
|
||||
PRIMARY KEY(user_id, kurs_id),
|
||||
FOREIGN KEY(user_id) REFERENCES `user`(id),
|
||||
FOREIGN KEY(kurs_id) REFERENCES kurs(id)
|
||||
);
|
||||
-- Tabelle: bewertungen
|
||||
CREATE TABLE bewertungen(
|
||||
id VARCHAR(36) NOT NULL UNIQUE,
|
||||
kurs_id VARCHAR(36) NOT NULL,
|
||||
user_id VARCHAR(36) NOT NULL,
|
||||
note INT CHECK
|
||||
(note BETWEEN 1 AND 5),
|
||||
kommentar TEXT,
|
||||
FOREIGN KEY(kurs_id) REFERENCES kurs(id),
|
||||
FOREIGN KEY(user_id) REFERENCES `user`(id)
|
||||
);
|
@@ -26,6 +26,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$doMethodName = isset($_GET['do']) && $_GET['do'] ? $_GET['do'] : "showWelcome";
|
||||
}
|
||||
|
||||
// if(isset($_SESSION['user_id']) && $_SESSION['user_id'] !== null && $controllerName == "Welcome") {
|
||||
// TODO: Hier noch direkt kurse öffnen falls der User angemeldet ist.
|
||||
// }
|
||||
|
||||
$controllerClassName = 'Blog\\Controller\\'.ucfirst($controllerName).'Controller';
|
||||
|
||||
if (method_exists($controllerClassName, $doMethodName)) {
|
||||
|
Reference in New Issue
Block a user