Compare commits
3 Commits
dev/m6_saf
...
dev/m6_rob
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcba35dc00 | ||
|
|
91856073e1 | ||
|
|
15d9287b47 |
21
.idea/workspace.xml
generated
21
.idea/workspace.xml
generated
@@ -4,12 +4,10 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="6dcbe3e4-9d68-41d8-8c39-5cfbe5cd4a21" name="Changes" comment="Bewertungs model">
|
||||
<list default="true" id="6dcbe3e4-9d68-41d8-8c39-5cfbe5cd4a21" name="Changes" comment="Alles bis auf paar sachen">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M6/emensamobile/app/Http/Controllers/MainController.php" beforeDir="false" afterPath="$PROJECT_DIR$/M6/emensamobile/app/Http/Controllers/MainController.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M6/emensamobile/app/Models/benutzer.php" beforeDir="false" afterPath="$PROJECT_DIR$/M6/emensamobile/app/Models/benutzer.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M6/emensamobile/app/Models/bewertungen.php" beforeDir="false" afterPath="$PROJECT_DIR$/M6/emensamobile/app/Models/bewertungen.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M6/emensamobile/resources/views/layouts/main_layout.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/M6/emensamobile/resources/views/layouts/main_layout.blade.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M6/emensamobile/public/css/style.css" beforeDir="false" afterPath="$PROJECT_DIR$/M6/emensamobile/public/css/style.css" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M6/emensamobile/resources/views/main/bewertung.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/M6/emensamobile/resources/views/main/bewertung.blade.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M6/emensamobile/resources/views/main/index.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/M6/emensamobile/resources/views/main/index.blade.php" afterDir="false" />
|
||||
</list>
|
||||
@@ -116,7 +114,7 @@
|
||||
<workItem from="1705492444098" duration="553000" />
|
||||
<workItem from="1705493014644" duration="21207000" />
|
||||
<workItem from="1705627589042" duration="2719000" />
|
||||
<workItem from="1705630465063" duration="10294000" />
|
||||
<workItem from="1705630465063" duration="13023000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Webseite ohne Anmeldung läuft auf laravel">
|
||||
<option name="closed" value="true" />
|
||||
@@ -174,7 +172,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1705675225498</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="8" />
|
||||
<task id="LOCAL-00008" summary="Alles bis auf paar sachen">
|
||||
<option name="closed" value="true" />
|
||||
<created>1705679416721</created>
|
||||
<option name="number" value="00008" />
|
||||
<option name="presentableId" value="LOCAL-00008" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1705679416721</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="9" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@@ -187,6 +193,7 @@
|
||||
<MESSAGE value="Aufgabe 1 ca 80%" />
|
||||
<MESSAGE value="Aufgabe 1" />
|
||||
<MESSAGE value="Bewertungs model" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Bewertungs model" />
|
||||
<MESSAGE value="Alles bis auf paar sachen" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Alles bis auf paar sachen" />
|
||||
</component>
|
||||
</project>
|
||||
114
M6/Dossier/ED 1 a).drawio
Normal file
114
M6/Dossier/ED 1 a).drawio
Normal file
@@ -0,0 +1,114 @@
|
||||
<mxfile host="app.diagrams.net" modified="2024-01-17T16:40:46.603Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0" etag="yOiPrTY5I7Bd3XpJF8Jn" version="22.1.21" type="device">
|
||||
<diagram name="Seite-1" id="uZLJn0IZBSqR1Bpxcyc-">
|
||||
<mxGraphModel dx="988" dy="540" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-2" target="CqnDATPZ74Ucb4dWbnLU-4">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-2" target="CqnDATPZ74Ucb4dWbnLU-17">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-2" target="CqnDATPZ74Ucb4dWbnLU-31">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-2" value="Benutzer" style="whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="150" y="530" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-4" target="CqnDATPZ74Ucb4dWbnLU-5">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-4" value="erstellt" style="shape=rhombus;perimeter=rhombusPerimeter;whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="360" y="520" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-5" target="CqnDATPZ74Ucb4dWbnLU-18">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-5" target="CqnDATPZ74Ucb4dWbnLU-13">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-5" target="CqnDATPZ74Ucb4dWbnLU-15">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-5" target="CqnDATPZ74Ucb4dWbnLU-27">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-5" target="CqnDATPZ74Ucb4dWbnLU-25">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-5" target="CqnDATPZ74Ucb4dWbnLU-26">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-5" target="CqnDATPZ74Ucb4dWbnLU-38">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-5" value="Bewertung" style="whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="590" y="530" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-9" value="" style="endArrow=none;html=1;rounded=0;" edge="1" parent="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="500" y="550" as="sourcePoint" />
|
||||
<mxPoint x="590" y="549.5" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-10" value="N" style="resizable=0;html=1;whiteSpace=wrap;align=right;verticalAlign=bottom;" connectable="0" vertex="1" parent="CqnDATPZ74Ucb4dWbnLU-9">
|
||||
<mxGeometry x="1" relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-11" value="" style="endArrow=none;html=1;rounded=0;" edge="1" parent="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="340" y="549.76" as="sourcePoint" />
|
||||
<mxPoint x="260" y="549.76" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="320" y="549.76" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-12" value="1" style="resizable=0;html=1;whiteSpace=wrap;align=right;verticalAlign=bottom;" connectable="0" vertex="1" parent="CqnDATPZ74Ucb4dWbnLU-11">
|
||||
<mxGeometry x="1" relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-13" value="Sterne" style="ellipse;whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="630" y="420" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-15" value="<div>Erstellungs</div><div>zeitpunkt</div>" style="ellipse;whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="500" y="420" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-17" value="Benutzer ID" style="ellipse;whiteSpace=wrap;html=1;align=center;fontStyle=4;" vertex="1" parent="1">
|
||||
<mxGeometry x="150" y="440" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-18" value="Hervorgehoben" style="ellipse;whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="690" y="610" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-25" value="<div>Gericht ID</div>" style="ellipse;whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="500" y="610" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-26" value="Benutzer ID" style="ellipse;whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="727" y="530" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-27" value="Bemerkung" style="ellipse;whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="600" y="670" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-31">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="480" y="790" as="targetPoint" />
|
||||
<Array as="points">
|
||||
<mxPoint x="200" y="790" />
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-31" value="admin" style="ellipse;whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="150" y="620" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="CqnDATPZ74Ucb4dWbnLU-35" target="CqnDATPZ74Ucb4dWbnLU-18">
|
||||
<mxGeometry relative="1" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-35" value="hervorheben" style="shape=rhombus;perimeter=rhombusPerimeter;whiteSpace=wrap;html=1;align=center;" vertex="1" parent="1">
|
||||
<mxGeometry x="480" y="760" width="120" height="60" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="CqnDATPZ74Ucb4dWbnLU-38" value="Bewertungs ID" style="ellipse;whiteSpace=wrap;html=1;align=center;fontStyle=4;" vertex="1" parent="1">
|
||||
<mxGeometry x="727" y="470" width="100" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
BIN
M6/Dossier/ED 1a).drawio.png
Normal file
BIN
M6/Dossier/ED 1a).drawio.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
@@ -2,7 +2,7 @@
|
||||
return [
|
||||
'host' => 'localhost', // 'localhost' or '127.0.0.1'
|
||||
'user' => 'root', // '<yourusername>'
|
||||
'password' => 'admin', // '<yourpassword>'
|
||||
'password' => 'wm#32', // '<yourpassword>'
|
||||
'database' => 'emensawerbeseite',
|
||||
// optionally: set port below if it differs from the default 3306
|
||||
// 'port' => 13306 // !! this is not your webserver port, but the mariadb port
|
||||
|
||||
@@ -54,6 +54,20 @@ class MainController extends BaseController
|
||||
|
||||
if ($data["gerichtid"] != null) {
|
||||
|
||||
$gericht = Gerichte::query()->find($data["gerichtid"]);
|
||||
$gerichtName = $gericht->getGerichtName();
|
||||
$bildname = $gericht->getBildname();
|
||||
|
||||
|
||||
return view('main.bewertung', [
|
||||
"gerichtName" => $gerichtName,
|
||||
"bildname" => $bildname,
|
||||
"data" => $data,
|
||||
'url' => 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"
|
||||
]);
|
||||
|
||||
|
||||
/*
|
||||
$gericht = new Gerichte();
|
||||
$g = $gericht->db_gericht_bewertung($data["gerichtid"]);
|
||||
|
||||
@@ -62,6 +76,7 @@ class MainController extends BaseController
|
||||
"data" => $data,
|
||||
'url' => 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"
|
||||
]);
|
||||
*/
|
||||
}
|
||||
|
||||
if($data["hervorheben"]!=null){
|
||||
@@ -97,10 +112,16 @@ class MainController extends BaseController
|
||||
$bemerkung = $data["bemerkung"] ?? NULL;
|
||||
$benutzer = session("benutzer_id",0);
|
||||
|
||||
bewertungen::query()->firstOrCreate(
|
||||
[
|
||||
'ersteller_id' => $benutzer,
|
||||
'gericht_id' => $id,
|
||||
'bemerkung' => $bemerkung,
|
||||
'sterne' => $sterne
|
||||
]
|
||||
);
|
||||
|
||||
$b = new bewertungen();
|
||||
$check = $b->bewerten($benutzer,$id,$sterne, $bemerkung);
|
||||
|
||||
$bewertungen = $b->bewertungen();
|
||||
return redirect('/bewertung');
|
||||
}
|
||||
@@ -117,20 +138,20 @@ class MainController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
$b = new bewertungen();
|
||||
|
||||
if($rd->isMethod("get")) {
|
||||
$data = $rd;
|
||||
|
||||
if ($data["loschen"] != null) {
|
||||
$check = $b->loschen($data["loschen"]);
|
||||
|
||||
bewertungen::destroy($data["loschen"]);
|
||||
//$b->delete();
|
||||
return redirect('/meinebewertungen');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$b = new bewertungen();
|
||||
$meine = $b->meine_bewertungen($benutzer_id);
|
||||
|
||||
return view('main.meine_bewertungen', [
|
||||
|
||||
@@ -11,9 +11,67 @@ use Illuminate\Support\Facades\Session;
|
||||
|
||||
class Gerichte extends Model
|
||||
{
|
||||
protected $table = 'gericht';
|
||||
protected $primaryKey = 'id';
|
||||
public $incrementing = true;
|
||||
use HasFactory;
|
||||
|
||||
|
||||
function getPreisIntern(){
|
||||
return $this->formatPreis($this->attributes['preisintern']);
|
||||
}
|
||||
|
||||
function getPreisExtern(){
|
||||
return $this->formatPreis($this->attributes['preisextern']);
|
||||
}
|
||||
|
||||
private function formatPreis($unformatted){
|
||||
return number_format($unformatted, 2, ',');
|
||||
}
|
||||
|
||||
function getBildname(){
|
||||
return $this->attributes['bildname'];
|
||||
}
|
||||
|
||||
function getGerichtName(){
|
||||
return $this->attributes['name'];
|
||||
}
|
||||
|
||||
function setVegetarischAttribut($value){
|
||||
if ($value == 1 || $value == 0){
|
||||
$this->attributes['vegetarisch'] = $value;
|
||||
return;
|
||||
}
|
||||
|
||||
$parsed = $this->parse_wahrheitswert($value) ;
|
||||
$this->attributes['vegetarisch'] = $parsed;
|
||||
}
|
||||
|
||||
function setVeganAttribut($value){
|
||||
if ($value == 1 || $value == 0){
|
||||
$this->attributes['vegan'] = $value;
|
||||
return;
|
||||
}
|
||||
|
||||
$parsed = $this->parse_wahrheitswert($value) ;
|
||||
$this->attributes['vegetarisch'] = $parsed;
|
||||
}
|
||||
|
||||
private function parse_wahrheitswert($value){
|
||||
$value = strtolower(str_replace(" ", "", $value));
|
||||
|
||||
if ($value == "yes" || $value == "ja"){
|
||||
return 1;
|
||||
}
|
||||
elseif ($value == "no" || $value == "nein"){
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
trigger_error("Could not parse value");
|
||||
}
|
||||
// Wenn versucht wird das in die Datenbank zu schreiben sollte es eine Fehlermeldung geben
|
||||
}
|
||||
|
||||
|
||||
function db_gericht_select_karte()
|
||||
{
|
||||
|
||||
@@ -10,10 +10,29 @@ use Illuminate\Support\Facades\Session;
|
||||
|
||||
class bewertungen extends Model
|
||||
{
|
||||
protected $table = 'bewertungen';
|
||||
protected $primaryKey = 'id';
|
||||
public $incrementing = true;
|
||||
protected $attributes = [
|
||||
'hervorgehoben' => 0
|
||||
];
|
||||
public $fillable = [
|
||||
'ersteller_id',
|
||||
'gericht_id',
|
||||
'bemerkung',
|
||||
'sterne',
|
||||
'hervorgehoben'
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
use HasFactory;
|
||||
|
||||
function bewerten(int $ersteller, int $gericht, int $sterne, string $bemerkung){
|
||||
$sql = "INSERT INTO bewertungen (ersteller_id,gericht_id,bemerkung,sterne,hervorgehoben) VALUES (".$ersteller. ",". $gericht.",\"". $bemerkung."\",".$sterne.",0);";
|
||||
if($ersteller != session("benutzerid",0)||$sterne <0||$sterne>4||strlen($bemerkung)<4||strlen($bemerkung)>100){
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO bewertungen (ersteller_id,gericht_id,bemerkung,sterne,hervorgehoben) VALUES (".mysqli_real_escape_string($ersteller). ",". mysqli_real_escape_string($gericht).",\"". mysqli_real_escape_string($bemerkung)."\",".mysqli_real_escape_string($sterne).",0);";
|
||||
|
||||
DB::insert($sql);
|
||||
|
||||
@@ -73,8 +92,13 @@ class bewertungen extends Model
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = "UPDATE bewertungen SET hervorgehoben =1 WHERE id =" .$id;
|
||||
DB::update($sql);
|
||||
$this->query()->updateOrCreate(
|
||||
['id'=>$id],
|
||||
['hervorgehoben' => 1]
|
||||
);
|
||||
|
||||
// $sql = "UPDATE bewertungen SET hervorgehoben =1 WHERE id =" .$id;
|
||||
// DB::update($sql);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -86,8 +110,13 @@ class bewertungen extends Model
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = "UPDATE bewertungen SET hervorgehoben =0 WHERE id =" .$id;
|
||||
DB::update($sql);
|
||||
$this->query()->updateOrCreate(
|
||||
['id'=>$id],
|
||||
['hervorgehoben' => 0]
|
||||
);
|
||||
|
||||
// $sql = "UPDATE bewertungen SET hervorgehoben =0 WHERE id =" .$id;
|
||||
// DB::update($sql);
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
@@ -2,6 +2,20 @@
|
||||
font-family: Arial;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.bewertungen_mobile::after {
|
||||
content: '\A';
|
||||
white-space: pre;
|
||||
}
|
||||
body{
|
||||
background-color: #0a3622;
|
||||
}
|
||||
.grid_bewertung {
|
||||
display: grid;
|
||||
grid-template-columns: 0px 300px auto 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 200px auto 200px;
|
||||
@@ -107,4 +121,11 @@ footer {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.bewertung_hervorgehoben{
|
||||
border-color: black;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,11 +39,8 @@
|
||||
@if(isset($admin))
|
||||
@endif
|
||||
|
||||
@if(isset($gericht))
|
||||
@if(isset($gerichtName, $bildname))
|
||||
<?php
|
||||
$gericht = $gericht[0];
|
||||
|
||||
$bildname = $gericht->bildname;
|
||||
|
||||
if ($bildname == Null) {
|
||||
$bildname = "00_image_missing.jpg";
|
||||
@@ -53,17 +50,17 @@
|
||||
|
||||
?>
|
||||
|
||||
<div class="grid_bewertung">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<img class="bewertung" src="{{$bildname}}" alt="Bild vom Gericht" width= "10" height="10">
|
||||
</div>
|
||||
<div>
|
||||
<h1>{{$gericht->name}}</h1>
|
||||
<div class="grid_bewertung">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<img class="bewertung" src="{{$bildname}}" alt="Bild vom Gericht" width= "10" height="10">
|
||||
</div>
|
||||
<div>
|
||||
<h1>{{$gerichtName}}</h1>
|
||||
|
||||
<div class="bewertungen_mobile">
|
||||
<form action="/bewertung_abschicken" method="post">
|
||||
@method("post")
|
||||
@csrf <!-- {{ csrf_field() }} -->
|
||||
@@ -77,6 +74,7 @@
|
||||
|
||||
<button type="submit" >Bewerten</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -95,7 +93,13 @@
|
||||
$bewertungs_id = $row[3];
|
||||
$hervorgehoben = $row[4];
|
||||
|
||||
$echo = "<h1>".$name."</h1> Sterne: ". $bewertungen." Bemerkung: ".$bemerkung;
|
||||
$echo = "";
|
||||
|
||||
if($hervorgehoben){
|
||||
$echo = "<div class=\"bewertung_hervorgehoben\"> ";
|
||||
}
|
||||
|
||||
$echo .= "<h1>".$name."</h1> Sterne: ". $bewertungen." Bemerkung: ".$bemerkung;
|
||||
|
||||
if($admin){
|
||||
if($hervorgehoben){
|
||||
@@ -105,6 +109,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
if($hervorgehoben){
|
||||
$echo .= "</div>";
|
||||
}
|
||||
|
||||
echo $echo;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -76,10 +76,11 @@
|
||||
|
||||
foreach ($result_sql_gerichte as $row_gerichte) {
|
||||
|
||||
$preisintern = number_format($row_gerichte->preisintern, 2, ',', '.');
|
||||
$preisextern = number_format($row_gerichte->preisextern, 2, ',', '.');
|
||||
$gericht = App\Models\Gerichte::query()->find($row_gerichte->id);
|
||||
$preisintern = $gericht->getPreisIntern();
|
||||
$preisextern = $gericht->getPreisExtern();
|
||||
|
||||
$bildname = $row_gerichte->bildname;
|
||||
$bildname = $gericht->getBildname();
|
||||
|
||||
if ($bildname == Null) {
|
||||
$bildname = "00_image_missing.jpg";
|
||||
@@ -118,6 +119,8 @@
|
||||
@endsection
|
||||
|
||||
@section("bewertungen")
|
||||
<h1>Meinungen unserer Gäste</h1>
|
||||
|
||||
@if(isset($bewertungen))
|
||||
<?php
|
||||
|
||||
@@ -126,7 +129,7 @@
|
||||
$bewertungen = $row[1];
|
||||
$bemerkung = $row[2];
|
||||
|
||||
$echo = "<h1>".$name."</h1> Sterne: ". $bewertungen." Bemerkung: ".$bemerkung;
|
||||
$echo = "<h3>".$name."</h3> Sterne: ". $bewertungen." Bemerkung: ".$bemerkung;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user