Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drinkpedia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ALGLAVE Ivan
Drinkpedia
Commits
06654b0e
Commit
06654b0e
authored
4 years ago
by
ALGLAVE Ivan
Browse files
Options
Downloads
Patches
Plain Diff
Cocktails.php displays a clickable list of all the cocktails
parent
92fb4095
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Cocktails.php
+18
-4
18 additions, 4 deletions
Cocktails.php
Hierarchy.php
+6
-23
6 additions, 23 deletions
Hierarchy.php
Home.php
+3
-3
3 additions, 3 deletions
Home.php
scripts/Functions.php
+7
-4
7 additions, 4 deletions
scripts/Functions.php
with
34 additions
and
34 deletions
Cocktails.php
+
18
−
4
View file @
06654b0e
...
@@ -11,16 +11,30 @@
...
@@ -11,16 +11,30 @@
<ul>
<ul>
<?php
<?php
include
"
scripts/Functions
.php"
;
include
"
Donnees.inc
.php"
;
$ar
=
getRecipes
([
'Malibu'
],
[],
10
,
true
,
true
)
;
$ar
=
$Recettes
;
for
each
(
$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
.
');">
'
.
$
a
r
[
$i
][
'titre'
]
.
'</li>'
;
}
}
?>
?>
</ul>
</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>
</body>
</html>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Hierarchy.php
+
6
−
23
View file @
06654b0e
...
@@ -10,34 +10,17 @@
...
@@ -10,34 +10,17 @@
<body
id=
"body"
>
<body
id=
"body"
>
<ul
id=
"origin_list"
></ul>
<!-- HTML -->
<!-- JAVASCRIPT -->
<!-- JAVASCRIPT -->
<script>
let
n_list_origin
=
document
.
getElementById
(
'
origin_list
'
);
<script>
//let ingredients = getIngredients();
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
=
{
var
data
=
{
event
:
'
recipeselect
'
,
event
:
'
recipeselect
'
,
...
...
This diff is collapsed.
Click to expand it.
Home.php
+
3
−
3
View file @
06654b0e
...
@@ -60,12 +60,12 @@
...
@@ -60,12 +60,12 @@
wraper
.
disabled
=
false
;
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
);
embed
.
setAttribute
(
'
src
'
,
'
RecipeView.php?id_recipe=
'
+
id
);
wrapper
.
classList
.
add
(
'
active
'
);
wrapper
.
classList
.
add
(
'
active
'
);
// Set the RecipeView wrapper active
content
.
classList
.
add
(
'
blur
'
);
content
.
classList
.
add
(
'
blur
'
);
// Blurs the original content of the page
wrapper
.
disabled
=
true
;
wrapper
.
disabled
=
true
;
embed
.
focus
();
embed
.
focus
();
...
...
This diff is collapsed.
Click to expand it.
scripts/Functions.php
+
7
−
4
View file @
06654b0e
...
@@ -59,13 +59,16 @@ function getRecipes($wanted_ingredients, $unwanted_ingredients, $max_unsatisfied
...
@@ -59,13 +59,16 @@ function getRecipes($wanted_ingredients, $unwanted_ingredients, $max_unsatisfied
function
getIngredients
(
$parent_category
)
function
getIngredients
(
$parent_category
)
{
{
include
"../Donnees.inc.php"
;
include
"../Donnees.inc.php"
;
$res
=
''
;
$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
;
return
$res
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment