Skip to content
Snippets Groups Projects
Commit 81751df1 authored by ALGLAVE Ivan's avatar ALGLAVE Ivan
Browse files

d

parent 1d78f30e
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@
<div class="topnav">
<button id="tabBtnI" class="active" value="Hierarchy.php" onclick="tabButtonClicked(this)">Hiérarchie</button>
<button id="tabBtnA" value="AdvancedSearch.php" onclick="tabButtonClicked(this)">Avancé</button>
<button id="tabBtnC" value="Cocktails.php" onclick="tabButtonClicked(this)">Cocktails</button>
<button id="tabBtnR" value="Recipes.php" onclick="tabButtonClicked(this)">Recettes</button>
<button id="tabBtnMA" class="right" value="MyAccount.php" onclick="tabButtonClicked(this)">Mon Compte</button>
<button id="tabBtnF" class="right" value="MyFavouriteRecipes.php" onclick="tabButtonClicked(this)">Favoris</button>
</div>
......@@ -52,6 +52,10 @@
{
showRecipe(m_value);
}
else if(m_event == 'hierarchyDisplay')
{
switchView('Hierarchy.php?element="' + m_value + '"');
}
}
function hideRecipe()
......
<!DOCTYPE html>
<html>
<head>
<title>Drinkpedia</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/RecipeList.css">
</head>
<body>
<ul>
<?php
include "Donnees.inc.php";
$recipesIds = explode('|', $_GET['ids']);
foreach($recipesIds as $id)
{
echo '<li>';
echo '<div>';
$recipe = $Recettes[(int)$id];
echo $recipe['titre'];
echo '</div>';
echo '</li>';
}
?>
</ul>
</body>
</html>
\ No newline at end of file
table, td, tr, th {
border-width: 1px;
border-color: 1px;
}
\ No newline at end of file
var scripts_location = "scripts/DataQuery.php";
var arg_name_func = "functionname";
var arg_name_args = "arguments";
function query(func_name, args, callback)
{
$.post(scripts_location, {arg_name_func: func_name, arg_name_args: args}, callback);
}
function getRecipes(wanted_ingredients = [], unwanted_ingredients = [], max_unsatisfied = 0, allow_missing = true, allow_unwanted = true, callback)
{
$.post("scripts/DataQuery.php", {'functionname': 'getRecipe', 'arguments': [wanted_ingredients, unwanted_ingredients, max_unsatisfied, allow_missing, allow_unwanted]}, callback);
query('getRecipe', [wanted_ingredients, unwanted_ingredients, max_unsatisfied, allow_missing, allow_unwanted], callback);
}
function getIngredients(parent_category = 'Aliment', callback)
{
$.post("scripts/DataQuery.php", {'functionname': 'getIngredients', 'arguments': [parent_category]}, callback);
query('getIngredients', [parent_category], callback);
}
function getRecipeImage(id, callback)
{
query('getRecipeImage', [id], callback);
}
\ No newline at end of file
......@@ -16,6 +16,10 @@
{
echo getIngredients($_POST['arguments'][0]);
}
else if($funcName == 'getRecipeImage')
{
echo getRecipeImage($_POST['arguments'][0]);
}
else
{
echo 'error - unknown func';
......
......@@ -74,4 +74,16 @@ function getIngredients($parent_category)
return $res;
}
function getRecipeImage($id)
{
include "../Donnees.inc.php";
$name = $Recettes[$id];
$formatted_name = implode('_', explode(' ', $name)) . '.jpg';
if(file_exists('../Photos/' . $formatted_name)) return $formatted_name;
else return '';
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment