This commit is contained in:
2019-07-04 08:58:15 +02:00
parent 5ae9d7a90e
commit 7fa649ee13
2 changed files with 118 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
require_once(__DIR__ . '/Database.php'); require_once(__DIR__ . '/Database.php');
echo <<<END echo <<<END
<link rel="stylesheet" href="style.css">
<h1>Fragen anzeigen</h1> <h1>Fragen anzeigen</h1>
<table> <table>
<tr> <tr>
@@ -18,6 +19,8 @@ END;
$db = new Database(); $db = new Database();
$questions = $db->getQuestions(); $questions = $db->getQuestions();
//
//This is ugly but does the job (I'm used to the laravel collections)
$questionsobj = json_decode(json_encode($questions), false); $questionsobj = json_decode(json_encode($questions), false);
foreach($questionsobj as $question) { foreach($questionsobj as $question) {
@@ -30,6 +33,8 @@ foreach($questionsobj as $question) {
echo("</tr>"); echo("</tr>");
} }
echo <<<END echo <<<END
</table> </table>
<br><br> <br><br>

113
cgi-bin/uebung09/style.css Normal file
View File

@@ -0,0 +1,113 @@
body {
font-family: sans-serif;
color: #000;
text-align: center;
transition: background-color 250ms linear;
background-color: #fff;
}
a {
color: black;
}
.post, input, textarea {
max-width: 30em;
width: 100%;
padding: 1em;
margin: 1em auto;
background-color: #fff;
border: 1px solid black;
color: black;
text-align: justify;
box-sizing: border-box;
border-radius: 0.5em;
}
form {
max-width: 30em;
width: 100%;
margin: 0 auto;
}
input, textarea {
max-width: 100%;
box-sizing: border-box;
}
.post h1 {
margin: 0;
}
.post .meta {
font-size: 75%;
font-style: italic;
border-top: 1px dotted black;
border-bottom: 1px dotted black;
padding: 0.25em;
}
.post a {
color: red;
}
.post p {
margin: 0 0 0.5em;
}
.question, .answer {
max-width: 30em;
width: 100%;
margin: 1em auto;
background-color: #fff;
color: black;
text-align: justify;
box-sizing: border-box;
display: block;
}
.question {
/*background-color: #2e6da4;
color: white;*/
font-weight: bold;
}
.answer {
background-color: #eee;
cursor: pointer;
padding: 1em;
}
.answer:hover {
background-color: #ccc;
}
body {
font-family: sans-serif;
text-align: center;
}
table {
border-collapse: collapse;
max-width: 100%;
margin: 0 auto;
}
tr, td {
border: 1px solid black;
padding: 3px;
}
.form-box {
display: flex;
flex-direction: row;
}
.form-solution {
flex-grow: 0;
width: 0;
margin-right: 0.5em
}
.form-answer {
flex-grow: 1
}