Compare commits
33 Commits
bdc491fbfa
...
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 |
@@ -3,6 +3,7 @@ header {
|
|||||||
top: 0px;
|
top: 0px;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
background-color: var(--brand-background);
|
||||||
}
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
|
@@ -18,6 +18,13 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-link {
|
||||||
|
text-decoration: underline;
|
||||||
|
background-color: transparent;
|
||||||
|
color: var(--brand-white);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
background: var(--brand-primary);
|
background: var(--brand-primary);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
@@ -56,3 +63,29 @@
|
|||||||
.btn-logout{
|
.btn-logout{
|
||||||
background-color: red;
|
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;
|
||||||
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* === Grundlayout === */
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: var(--font-family-main);
|
font-family: var(--font-family-main);
|
||||||
@@ -6,7 +6,6 @@ body {
|
|||||||
color: var(--brand-white);
|
color: var(--brand-white);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Header-Bereich === */
|
|
||||||
.welcome-header {
|
.welcome-header {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 60px 20px 40px 20px;
|
margin: 60px 20px 40px 20px;
|
||||||
@@ -25,22 +24,24 @@ body {
|
|||||||
color: white;
|
color: white;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
margin: 0 auto;
|
margin-bottom: 30px;
|
||||||
padding-left: 230px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Kurs-Grid === */
|
|
||||||
.course-grid {
|
.course-grid {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
gap: 40px;
|
||||||
gap: 30px;
|
margin-left: 20px;
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Kurs-Karte === */
|
@media screen and (max-width: 765px) {
|
||||||
|
.course-grid{
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.course-card {
|
.course-card {
|
||||||
flex: 0 0 calc(33.333% - 20px); /* Drei nebeneinander */
|
|
||||||
background: var(--brand-white);
|
background: var(--brand-white);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -48,19 +49,16 @@ body {
|
|||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-top: 30px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Optional: Kurs-Bildbereich */
|
|
||||||
.course-image {
|
.course-image {
|
||||||
background-color: #ddd; /* Platzhalter – kannst du durch echte Bilder ersetzen */
|
background-color: #ddd;
|
||||||
height: 180px;
|
height: 180px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Kurs-Inhalt === */
|
|
||||||
.course-content {
|
.course-content {
|
||||||
background-color: var(--brand-primary); /* Orange */
|
background-color: var(--brand-primary);
|
||||||
color: var(--brand-white);
|
color: var(--brand-white);
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
@@ -88,7 +86,6 @@ body {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Responsive Anpassung === */
|
|
||||||
@media screen and (max-width: 1024px) {
|
@media screen and (max-width: 1024px) {
|
||||||
.course-card {
|
.course-card {
|
||||||
flex: 0 0 calc(50% - 20px);
|
flex: 0 0 calc(50% - 20px);
|
||||||
|
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,97 +1,127 @@
|
|||||||
main a{
|
main a {
|
||||||
color: var(--brand-white)
|
color: var(--brand-white);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-flex {
|
.form-flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
row-gap: 8px;
|
row-gap: 8px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
form label {
|
form label {
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
|
color: var(--brand-white);
|
||||||
}
|
}
|
||||||
|
|
||||||
form input {
|
form input {
|
||||||
height: var(--h-md);
|
height: var(--h-md);
|
||||||
padding-left: 8px;
|
padding-left: 8px;
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
form input, textarea {
|
form input,
|
||||||
border: var(--border-primary);
|
textarea {
|
||||||
padding: 8px;
|
border: var(--border-primary);
|
||||||
font-size: 1rem;
|
padding: 8px;
|
||||||
margin-top: 5px;
|
font-size: 1rem;
|
||||||
width: 100%;
|
margin-top: 5px;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
row-gap: 2px;
|
row-gap: 2px;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-short {
|
.input-short {
|
||||||
max-width: 240px;
|
max-width: 240px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-grid {
|
.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);
|
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 {
|
.form-grid label {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-grid textarea {
|
.form-grid textarea {
|
||||||
min-height: 100px;
|
min-height: 100px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
|
||||||
|
|
||||||
.form-grid input:last-child, div:nth-last-child(4) {
|
|
||||||
grid-column: 1 / -1;
|
|
||||||
column-span: 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
form .error {
|
form .error {
|
||||||
color: var(--error);
|
color: var(--error);
|
||||||
border-color: var(--error);
|
border-color: var(--error);
|
||||||
margin-block-start: 4px;
|
margin-block-start: 4px;
|
||||||
margin-block-end: 0;
|
margin-block-end: 0;
|
||||||
outline-color: var(--error);
|
outline-color: var(--error);
|
||||||
}
|
}
|
||||||
.form-user{
|
.form-user {
|
||||||
justify-content: center!important;
|
/*justify-content: center !important;*/
|
||||||
grid-template-columns: auto!important;
|
grid-template-columns: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fix radio buttons registration */
|
.radio {
|
||||||
.input:nth-child(5){
|
flex-direction: row;
|
||||||
flex-direction: row;
|
max-width: 290px;
|
||||||
justify-content: space-between;
|
align-items: center;
|
||||||
max-width: 290px;
|
gap: 24px;
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.input:nth-child(5) label{
|
.radio input {
|
||||||
display: flex;
|
margin-top: 0;
|
||||||
flex-direction: row;
|
height: var(--h-sm);
|
||||||
align-items: center;
|
width: var(--h-sm);
|
||||||
gap: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.input:nth-child(5) label input{
|
.input-transparent{
|
||||||
margin-top: 0;
|
background: transparent!important;
|
||||||
|
border: transparent!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 500px) {
|
||||||
|
.input-transparent{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
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;
|
||||||
|
}
|
116
CSS/style.css
116
CSS/style.css
@@ -6,8 +6,13 @@
|
|||||||
@import url(Element/form.css);
|
@import url(Element/form.css);
|
||||||
@import url(Element/button.css);
|
@import url(Element/button.css);
|
||||||
@import url(Element/card.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;
|
-moz-box-sizing: border-box;
|
||||||
-webkit-box-sizing: border-box;
|
-webkit-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -15,99 +20,118 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: var(--brand-background);
|
background-color: var(--brand-background);
|
||||||
color: #666;
|
color: var(--brand-white);
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
color: var(--brand-white);
|
color: var(--brand-white);
|
||||||
font-size: var(--font-size-title-h1);
|
font-size: var(--font-size-title-h1);
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 span {
|
h1 span {
|
||||||
color: orange;
|
color: orange;
|
||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
color: orange;
|
color: orange;
|
||||||
|
}
|
||||||
|
|
||||||
|
*, button, a {
|
||||||
|
transition: background-color 0.2s, color 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
margin-top: 190px;
|
margin-top: 190px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 1024px) {
|
||||||
|
main{
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.msg {
|
.msg {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg a {
|
.msg a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #09add0;
|
color: #09add0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg a:hover {
|
.msg a:hover {
|
||||||
color: orange;
|
color: orange;
|
||||||
}
|
}
|
||||||
|
|
||||||
.articleImg {
|
.articleImg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 2px solid lightskyblue;
|
border: 2px solid lightskyblue;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin: 0 0 15px 0;
|
margin: 0 0 15px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcomeImg {
|
.welcomeImg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.articleInfo {
|
.articleInfo {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Loesung Workshop-Seite ***/
|
/*** Loesung Workshop-Seite ***/
|
||||||
|
|
||||||
.textContent {
|
.textContent {
|
||||||
padding: 0 10px 0 30px;
|
padding: 0 10px 0 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 529px) {
|
@media (max-width: 529px) {
|
||||||
.textContent {
|
.textContent {
|
||||||
padding: 15px 0 0 0;
|
padding: 15px 0 0 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.event h3 {
|
.event h3 {
|
||||||
margin: 15px 0 5px 0;
|
margin: 15px 0 5px 0;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.orange {
|
.orange {
|
||||||
color: orange;
|
color: orange;
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
margin: 0 0 5px 0;
|
margin: 0 0 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.d-flex-between{
|
.d-flex-between {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hover:hover{
|
@media only screen and (max-width: 500px) {
|
||||||
opacity: .75;
|
.d-flex-between{
|
||||||
text-decoration: none;
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.paragraph{
|
.hover:hover {
|
||||||
font-size: var(--font-size-smalltext);
|
opacity: 0.75;
|
||||||
color: var(--brand-white);
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paragraph {
|
||||||
|
font-size: var(--font-size-smalltext);
|
||||||
|
color: var(--brand-white);
|
||||||
}
|
}
|
||||||
|
@@ -7,10 +7,17 @@
|
|||||||
|
|
||||||
/*** Container ***/
|
/*** Container ***/
|
||||||
|
|
||||||
.container{
|
.container {
|
||||||
max-width: 90%;
|
max-width: 90%;
|
||||||
padding: 24px 42px 24px 42px;
|
/* padding: 24px 42px 24px 42px; */
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
color: var(--brand-white);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 500px) {
|
||||||
|
.container {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.row {
|
.row {
|
||||||
@@ -19,12 +26,18 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
.row {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*** Spaltendefinitionen Smartphone Ansicht ***/
|
/*** Spaltendefinitionen Smartphone Ansicht ***/
|
||||||
@media (max-width: 529px) {
|
@media (max-width: 529px) {
|
||||||
.col-s-12 {
|
.col-s-12 {
|
||||||
flex: 0 0 100%;
|
flex: 0 0 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Loesung Workshop-Seite ***/
|
/*** Loesung Workshop-Seite ***/
|
||||||
.textContent {
|
.textContent {
|
||||||
padding: 15px 0 0 0;
|
padding: 15px 0 0 0;
|
||||||
@@ -32,19 +45,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*** Spaltendefinitionen Tablet Ansicht ***/
|
/*** Spaltendefinitionen Tablet Ansicht ***/
|
||||||
@media (min-width: 530px) {
|
@media (min-width: 750px) {
|
||||||
.col-m-1 {
|
.col-m-1 {
|
||||||
flex: 0 0 100%;
|
flex: 0 0 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-m-4 {
|
.col-m-4 {
|
||||||
flex: 0 0 33.3333333%;
|
flex: 0 0 33.3333333%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-m-6 {
|
.col-m-6 {
|
||||||
flex: 0 0 50%;
|
flex: 0 0 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-m-12 {
|
.col-m-12 {
|
||||||
flex: 0 0 100%;
|
flex: 0 0 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Spaltendefinitionen Desktop Ansicht ***/
|
/*** Spaltendefinitionen Desktop Ansicht ***/
|
||||||
@@ -52,21 +68,35 @@
|
|||||||
.col-1 {
|
.col-1 {
|
||||||
flex: 0 0 8.3333333%;
|
flex: 0 0 8.3333333%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-3 {
|
.col-3 {
|
||||||
flex: 0 0 25%;
|
flex: 0 0 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-4 {
|
.col-4 {
|
||||||
flex: 0 0 33.3333333%;
|
flex: 0 0 33.3333333%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.col-card-4{
|
||||||
|
flex: 1 1 calc((100% - (3 - 1) * 40px) / 3);
|
||||||
|
}
|
||||||
|
|
||||||
.col-5 {
|
.col-5 {
|
||||||
flex: 0 0 41.6666667%;
|
flex: 0 0 41.6666667%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-6 {
|
.col-6 {
|
||||||
flex: 0 0 50%;
|
flex: 0 0 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col-8 {
|
.col-8 {
|
||||||
flex: 0 0 66.66666667%;
|
flex: 0 0 66.66666667%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.col-9{
|
||||||
|
flex: 0 0 75%;
|
||||||
|
}
|
||||||
|
|
||||||
.col-12 {
|
.col-12 {
|
||||||
flex: 0 0 100%;
|
flex: 0 0 100%;
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
--input-placeholder: #998E82;
|
--input-placeholder: #998E82;
|
||||||
--error: #FF0000;
|
--error: #FF0000;
|
||||||
|
|
||||||
|
|
||||||
/*Fonts*/
|
/*Fonts*/
|
||||||
--font-family-main: "Inter", sans-serif;
|
--font-family-main: "Inter", sans-serif;
|
||||||
--font-family-headline: "Source Serif 4", serif;
|
--font-family-headline: "Source Serif 4", serif;
|
||||||
@@ -22,6 +21,14 @@
|
|||||||
/*Font-Weight*/
|
/*Font-Weight*/
|
||||||
--font-weight-semibold: 600;
|
--font-weight-semibold: 600;
|
||||||
|
|
||||||
|
--h-sm: 24px;
|
||||||
--h-md: 48px;
|
--h-md: 48px;
|
||||||
--border-primary: 1px solid #998E82;
|
--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", "stadt" => "Stadt*", "strasse" => "Straße und Nummer*", "plz" => "PLZ*" ,"beschreibung" => "Beschreibung");
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct($view)
|
|
||||||
{
|
|
||||||
$this->db = new AdminModel();
|
|
||||||
$this->view = $view;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function showAdminForm()
|
|
||||||
{
|
|
||||||
$this->view->setVars([
|
|
||||||
'labels' => $this->labels,
|
|
||||||
'validData' => $this->validData,
|
|
||||||
'errors' => $this->errors
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function showConfirmation()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function validateForm(){
|
|
||||||
foreach ($this->labels as $index => $value) {
|
|
||||||
if (strpos($value, "*") !== false && (!isset($_POST[$index]) || empty($_POST[$index]))) {
|
|
||||||
$this->errors[$index] = "Bitte " . $value . " eingeben";
|
|
||||||
} else {
|
|
||||||
$this->validData[$index] = $_POST[$index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (count($this->errors) > 0) {
|
|
||||||
$this->view->setDoMethodName("showAdminForm");
|
|
||||||
$this->showAdminForm();
|
|
||||||
} else {
|
|
||||||
if ($this->db->writeNewCourse($this->validData, $_SESSION["user_id"])) {
|
|
||||||
$this->view->setDoMethodName("showConfirmation");
|
|
||||||
$this->showConfirmation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
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
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -25,6 +25,28 @@ class UserController{
|
|||||||
"password" => "Passwort*",
|
"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){
|
public function __construct($view){
|
||||||
$this->db = new UserModel();
|
$this->db = new UserModel();
|
||||||
$this->view = $view;
|
$this->view = $view;
|
||||||
@@ -92,6 +114,48 @@ class UserController{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(){
|
public function showUserLoginConfirmation(){
|
||||||
$userId = $this->getCurrentUserId();
|
$userId = $this->getCurrentUserId();
|
||||||
$user = null;
|
$user = null;
|
||||||
@@ -147,7 +211,7 @@ class UserController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function clearUserSession(){
|
public function clearUserSession(){
|
||||||
unset($_SESSION["user_id"], $_SESSION["user_role"]);
|
unset($_SESSION["user_id"], $_SESSION["user_role"], $_SESSION["vorname"], $_SESSION["name"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logout(){
|
public function logout(){
|
||||||
@@ -165,6 +229,179 @@ class UserController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function showUserAccountPage (){
|
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,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Blog\Model;
|
|
||||||
|
|
||||||
use PDOException;
|
|
||||||
|
|
||||||
class AdminModel extends Database
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
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);
|
$hash = hash('sha256', $values["password"] . $salt);
|
||||||
|
|
||||||
$guid = rand(0, 500);
|
$guid = $this->createUUID();
|
||||||
|
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
|
|
||||||
@@ -59,4 +59,270 @@ class UserModel extends Database
|
|||||||
return $sth->fetch();
|
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,43 +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) {
|
|
||||||
$hasError = isset($errors[$key]);
|
|
||||||
$errorClass = $hasError ? ' error' : '';
|
|
||||||
|
|
||||||
echo '<div class="input">';
|
|
||||||
echo '<label for="' . $key . '">' . $value . '</label>';
|
|
||||||
|
|
||||||
if ($key == "beschreibung") {
|
|
||||||
echo '<textarea id="' . $key . '" name="' . $key . '" class="' . $errorClass . '">';
|
|
||||||
if (isset($validData[$key])) {
|
|
||||||
echo $validData[$key];
|
|
||||||
}
|
|
||||||
echo '</textarea>';
|
|
||||||
} else {
|
|
||||||
echo '<input class="' . $errorClass . '" type="text" name="' . $key . '" value="' . (isset($validData[$key]) ? $validData[$key] : '') . '">';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($hasError) {
|
|
||||||
echo '<p class="error">' . $errors[$key] . '</p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
$index++;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<input type="hidden" name="controller" value="admin">
|
|
||||||
<input type="hidden" name="do" value="validateForm">
|
|
||||||
<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'; ?>
|
@@ -4,7 +4,7 @@ include dirname(__DIR__).'/header.phtml';
|
|||||||
|
|
||||||
<div class="msg">
|
<div class="msg">
|
||||||
<p>Kurs erfolgreich erstellt.</p>
|
<p>Kurs erfolgreich erstellt.</p>
|
||||||
<a href="?controller=Welcome&do=showWelcome">Weiter</a>
|
<a href="?controller=User&do=showUserAccountPage">Weiter</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@@ -3,15 +3,62 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<div class="container">
|
<div id="confirmModal" class="modal-overlay">
|
||||||
<div class="row">
|
<div class="modal">
|
||||||
<div class="col-12">
|
<p>Sind Sie sicher, dass Sie Ihren Account löschen möchten?</p>
|
||||||
<form method="post">
|
<div class="row" style="flex-wrap: nowrap">
|
||||||
<input type="hidden" name="controller" value="user">
|
<button id="btnCancel" class="btn btn-secondary">Abbrechen</button>
|
||||||
<input type="hidden" name="do" value="logout">
|
<button id="btnConfirm" class="btn btn-logout">Ja, Account löschen</button>
|
||||||
<button type="submit" class="btn btn-logout">Ausloggen</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
<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'; ?>
|
@@ -22,3 +22,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h1>Als Benutzer anmelden</h1>
|
<h1>Anmeldung</h1>
|
||||||
|
|
||||||
<form method="post" class="form-grid form-user">
|
<form method="post" class="form-grid form-user">
|
||||||
<?php foreach ($labels as $key => $label): ?>
|
<?php foreach ($labels as $key => $label): ?>
|
||||||
@@ -31,4 +31,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
@@ -9,3 +9,5 @@
|
|||||||
<?php
|
<?php
|
||||||
include dirname(__DIR__).'/footer.phtml';
|
include dirname(__DIR__).'/footer.phtml';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -5,12 +5,10 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h1>Benutzer erstellen</h1>
|
<h1>Registration</h1>
|
||||||
|
|
||||||
<form method="post" class="form-grid">
|
<form method="post" class="form-grid">
|
||||||
|
|
||||||
<?php foreach ($labels as $key => $label): ?>
|
<?php foreach ($labels as $key => $label): ?>
|
||||||
<div class="input">
|
<div class="input <?= $key === 'role' ? "radio" : "" ?>">
|
||||||
<label for="reg_<?= $key ?>"><?= $label ?></label>
|
<label for="reg_<?= $key ?>"><?= $label ?></label>
|
||||||
<?php if ($key === 'password'): ?>
|
<?php if ($key === 'password'): ?>
|
||||||
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
|
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
|
||||||
@@ -30,8 +28,11 @@
|
|||||||
<input type="hidden" name="controller" value="user">
|
<input type="hidden" name="controller" value="user">
|
||||||
<input type="hidden" name="do" value="register">
|
<input type="hidden" name="do" value="register">
|
||||||
|
|
||||||
|
<input type="text" class="input-transparent">
|
||||||
<button type="submit" class="btn btn-primary btn-form">Registrieren</button>
|
<button type="submit" class="btn btn-primary btn-form">Registrieren</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php include dirname(__DIR__).'/footer.phtml'; ?>
|
||||||
|
@@ -1,60 +1,107 @@
|
|||||||
<?php
|
<?php
|
||||||
include dirname(__DIR__) . '/header.phtml';
|
include dirname(__DIR__) . '/header.phtml';
|
||||||
?>
|
|
||||||
|
$rating = $_GET['rating'] ?? '';
|
||||||
|
$price = $_GET['price'] ?? '';
|
||||||
|
$location = $_GET['location'] ?? '';
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h1 class="welcome-heading">KURSE & ERLEBNISSE JEDER ART</h1>
|
<h1 class="welcome-heading">KURSE & ERLEBNISSE JEDER ART</h1>
|
||||||
<p class="welcome-subheading">Alle Kurse in deiner Nähe – auf einen Blick</p>
|
<p class="welcome-subheading">Alle Kurse in deiner Nähe – auf einen Blick</p>
|
||||||
<div class="course-grid">
|
|
||||||
<?php
|
|
||||||
// Beispiel-Kurse
|
|
||||||
$kurse = [
|
|
||||||
[
|
|
||||||
'bewertung' => 5,
|
|
||||||
'titel' => 'Marketing Pro',
|
|
||||||
'adresse' => 'Bulu ulu Straße 17',
|
|
||||||
'preis' => '59,99€',
|
|
||||||
'ort' => '33333 Frankfurt',
|
|
||||||
'leiter' => 'Max Mustermann'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'bewertung' => 4,
|
|
||||||
'titel' => 'Design Basics',
|
|
||||||
'adresse' => 'Musterstraße 10',
|
|
||||||
'preis' => '39,99€',
|
|
||||||
'ort' => '10115 Berlin',
|
|
||||||
'leiter' => 'Lisa Beispiel'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'bewertung' => 5,
|
|
||||||
'titel' => 'Excel Masterclass',
|
|
||||||
'adresse' => 'Tabellenweg 5',
|
|
||||||
'preis' => '49,99€',
|
|
||||||
'ort' => '20457 Hamburg',
|
|
||||||
'leiter' => 'Thomas Tabelle'
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($kurse as $kurs): ?>
|
<div class="row">
|
||||||
<div class="course-card col-4">
|
<div class="col-3 col-m-12">
|
||||||
<div class="course-image"></div>
|
<div class="filter-box">
|
||||||
<div class="course-content">
|
<form method="get">
|
||||||
<div class="course-left">
|
<label for="rating">Bewertung:</label>
|
||||||
<div><?= $kurs['bewertung'] ?> ★</div>
|
<select name="rating" id="rating">
|
||||||
<div><?= $kurs['titel'] ?></div>
|
<option value="">Alle</option>
|
||||||
<div>Kursleiter: <?= $kurs['leiter'] ?></div>
|
<option value="5" <?= $rating == '5' ? 'selected' : '' ?>>5 Sterne</option>
|
||||||
<div><?= $kurs['adresse'] ?></div>
|
<option value="4" <?= $rating == '4' ? 'selected' : '' ?>>4 Sterne+</option>
|
||||||
</div>
|
<option value="3" <?= $rating == '3' ? 'selected' : '' ?>>3 Sterne+</option>
|
||||||
<div class="course-right">
|
</select>
|
||||||
<div><?= $kurs['preis'] ?></div>
|
|
||||||
<div><?= $kurs['ort'] ?></div>
|
<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>
|
</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>
|
||||||
<?php endforeach; ?>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
footer
|
|
||||||
</footer>
|
</footer>
|
||||||
|
<script src="JS/modal.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -14,33 +14,31 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<div class="container">
|
||||||
<nav class="d-flex-between">
|
<div class="row">
|
||||||
<a id="logo" href="index.php">bib<span>course</span></a>
|
<div class="col-12">
|
||||||
<div style="column-gap: 8px;" class="d-flex-between">
|
<header>
|
||||||
<div style="column-gap: 8px;" class="d-flex-between">
|
<nav class="d-flex-between">
|
||||||
<?php if (isset($_SESSION['user_id']) && $_SESSION['user_id'] !== null): ?>
|
<a id="logo" href="index.php">bib<span>course</span></a>
|
||||||
<?php if($_SESSION['user_role'] == 'admin'): ?>
|
<div style="column-gap: 8px;" class="d-flex-between">
|
||||||
<a style="column-gap: 16px;" class="btn" href="?controller=Admin&do=showAdminForm">
|
<div style="column-gap: 8px;" class="d-flex-between">
|
||||||
<?php echo ($_SESSION['vorname'] ?? "") . " " . ($_SESSION['name'] ?? "") . ", " . ($_SESSION['user_role']) ?>
|
<?php if (isset($_SESSION['user_id']) && $_SESSION['user_id'] !== null): ?>
|
||||||
<span class="btn btn-user">
|
<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 class="material-icons">person</span>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a style="column-gap: 16px;" class="btn" href="?controller=User&do=showUserAccountPage">
|
<a class="btn" href="?controller=User&do=showUserLoginForm">Anmeldung</a>
|
||||||
<?php echo ($_SESSION['vorname'] ?? "") . " " . ($_SESSION['name'] ?? "") . ", " . ($_SESSION['user_role']) ?>
|
<a class="btn btn-primary" href="?controller=User&do=showUserRegisterForm">Registration</a>
|
||||||
<span class="btn btn-user">
|
<?php endif; ?>
|
||||||
<span class="material-icons">person</span>
|
</div>
|
||||||
</span>
|
</div>
|
||||||
</a>
|
</nav>
|
||||||
<?php endif; ?>
|
</header>
|
||||||
<?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>
|
</div>
|
||||||
</nav>
|
</div>
|
||||||
</header>
|
</div>
|
||||||
|
<!-- TODO Transparent mit Fehleranzeige bei der Anmeldung -->
|
||||||
<main>
|
<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)
|
||||||
|
);
|
Reference in New Issue
Block a user