diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/DBWT-Praktika.iml b/.idea/DBWT-Praktika.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/DBWT-Praktika.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..20be1f8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..e84699f --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/M2/Beispiele/erstesphp.php b/M2/Beispiele/erstesphp.php new file mode 100644 index 0000000..631ef83 --- /dev/null +++ b/M2/Beispiele/erstesphp.php @@ -0,0 +1,3 @@ +"; +phpinfo(); \ No newline at end of file diff --git a/M2/Beispiele/meal.php b/M2/Beispiele/meal.php new file mode 100644 index 0000000..31420ad --- /dev/null +++ b/M2/Beispiele/meal.php @@ -0,0 +1,113 @@ + 'Gluten', + 12 => 'Krebstiere', + 13 => 'Eier', + 14 => 'Fisch', + 17 => 'Milch' +]; + +$meal = [ + 'name' => 'Süßkartoffeltaschen mit Frischkäse und Kräutern gefüllt', + 'description' => 'Die Süßkartoffeln werden vorsichtig aufgeschnitten und der Frischkäse eingefüllt.', + 'price_intern' => 2.90, + 'price_extern' => 3.90, + 'allergens' => [11, 13], + 'amount' => 42 // Number of available meals +]; + +$ratings = [ + [ 'text' => 'Die Kartoffel ist einfach klasse. Nur die Fischstäbchen schmecken nach Käse. ', + 'author' => 'Ute U.', + 'stars' => 2 ], + [ 'text' => 'Sehr gut. Immer wieder gerne', + 'author' => 'Gustav G.', + 'stars' => 4 ], + [ 'text' => 'Der Klassiker für den Wochenstart. Frisch wie immer', + 'author' => 'Renate R.', + 'stars' => 4 ], + [ 'text' => 'Kartoffel ist gut. Das Grüne ist mir suspekt.', + 'author' => 'Marta M.', + 'stars' => 3 ] +]; + +$showRatings = []; +if (!empty($_GET[GET_PARAM_SEARCH_TEXT])) { + $searchTerm = $_GET[GET_PARAM_SEARCH_TEXT]; + foreach ($ratings as $rating) { + if (strpos($rating['text'], $searchTerm) !== false) { + $showRatings[] = $rating; + } + } +} else if (!empty($_GET[GET_PARAM_MIN_STARS])) { + $minStars = $_GET[GET_PARAM_MIN_STARS]; + foreach ($ratings as $rating) { + if ($rating['stars'] >= $minStars) { + $showRatings[] = $rating; + } + } +} else { + $showRatings = $ratings; +} + +function calcMeanStars (array $ratings) : float { + $sum = 1; + foreach ($ratings as $rating) { + $sum += $rating['stars'] / count($ratings); + } + return $sum; +} + +/** + * + */ + +?> + + + + + Gericht: <?php echo $meal['name']; ?> + + + +

Gericht:

+

+

Bewertungen (Insgesamt: )

+
+ + + +
+ + + + + + + + + + + "; + } + ?> + +
TextSterne
{$rating['text']}{$rating['stars']}
+ + diff --git a/M2/dossier.xlsx b/M2/dossier.xlsx new file mode 100644 index 0000000..733ba6a Binary files /dev/null and b/M2/dossier.xlsx differ