Maintenance Gitlab - Jeudi 09 Décembre 2021 à partir de 10h - Mises à jour de sécurité

Commit 06654b0e authored by ALGLAVE Ivan's avatar ALGLAVE Ivan
Browse files

Cocktails.php displays a clickable list of all the cocktails

parent 92fb4095
......@@ -11,16 +11,30 @@
<ul>
<?php
include "scripts/Functions.php";
$ar = getRecipes(['Malibu'], [], 10, true, true);
include "Donnees.inc.php";
$ar = $Recettes;
foreach($ar as $r)
for($i = 0; $i < count($ar); $i++)
{
echo '<li>' . $r['recipe']['titre'] . ' (unsatisfied ingredients = ' . $r['score'] . ')' . '</li>';
echo '<li onclick="notifyParent(' . $i . ');">' . $ar[$i]['titre'] . '</li>';
}
?>
</ul>
<script>
function notifyParent(e) // Send a message to the parent window, asking to display the recipe #e
{
var data = {
event: 'recipeselect',
value: Number(e)
};
window.top.postMessage(data, [data.event, data.value]);
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -10,34 +10,17 @@
<body id="body">
<ul id="origin_list"></ul>
<!-- HTML -->
<!-- JAVASCRIPT -->
<script>
let n_list_origin = document.getElementById('origin_list');
//let ingredients = getIngredients();
<script>
function detailIngredients()
{
let d = document.getElementsByClassName('detailed');
let ud = document.getElementsByClassName('undetailed');
for(let el in ud)
{
while (el.firstChild) {
el.removeChild(el.firstChild);
}
}
for(let el in d)
{
let c = getIngredients(el.value, function (data, status)
{
});
}
}
function notifyParent(e)
function notifyParent(e) // Send a message to the parent window, asking to display the recipe #e
{
var data = {
event: 'recipeselect',
......
......@@ -60,12 +60,12 @@
wraper.disabled = false;
}
function showRecipe(id)
function showRecipe(id) // Show the Recipe with the id 'id' in the file 'Donnees.inc.php'
{
embed.setAttribute('src','RecipeView.php?id_recipe=' + id);
wrapper.classList.add('active');
content.classList.add('blur');
wrapper.classList.add('active'); // Set the RecipeView wrapper active
content.classList.add('blur'); // Blurs the original content of the page
wrapper.disabled = true;
embed.focus();
......
......@@ -59,13 +59,16 @@ function getRecipes($wanted_ingredients, $unwanted_ingredients, $max_unsatisfied
function getIngredients($parent_category)
{
include "../Donnees.inc.php";
$res = '';
$ingredients = $Hierarchie[$parent_category]['sous-categorie'];
foreach($ingredients as $i)
if(isset($Hierarchie[$parent_category]))
{
$res .= $i . '|';
$ingredients = $Hierarchie[$parent_category]['sous-categorie'];
foreach($ingredients as $i)
{
$res .= $i . '|';
}
}
return $res;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment