RecipeList.php 2.18 KB
Newer Older
ALGLAVE Ivan's avatar
d    
ALGLAVE Ivan committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!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";
16

17
        include "scripts/Functions.php";
ALGLAVE Ivan's avatar
d    
ALGLAVE Ivan committed
18

19
        if ($_GET['ids'] == '') echo '<h1>No recipe found</h1>';
ALGLAVE Ivan's avatar
d    
ALGLAVE Ivan committed
20

21
        else{
ALGLAVE Ivan's avatar
d    
ALGLAVE Ivan committed
22

23
24
25
26
27
28
29
30
            $recipesIds = explode('|', $_GET['ids']);
    
            $count = count($recipesIds);
    
            for($i = 0; $i < $count; $i++)
            {
                $re = explode(':', $recipesIds[$i]);
    
31
32
                echo '<li><div class="container">';

ALGLAVE Ivan's avatar
ALGLAVE Ivan committed
33
                echo '<div class="extra">';
34
                echo '<img class="toggleFavourite" src="images/favourite.png" >';
ALGLAVE Ivan's avatar
ALGLAVE Ivan committed
35
36
37
                echo '<p class="unsatisfied">Non satisfiés : ' . $re[1] . '</p>';
                echo '</div>';

38
39
40
41
42
43
                echo '<div class="listElement" onclick="showRecipe(' . intval($re[0]) . ');">';
    
                $recipe = $Recettes[intval($re[0])];
                
                $image_url = getRecipeImage($recipe['titre']);
                $image_url = '' . 'Photos/' . $image_url;
44
45
                if(file_exists($image_url)) echo '<img class="cocktailImg" src="' . $image_url . '"></img>';
                else echo '<img class="cocktailImg" src="images/missing.jfif"></img>';
46
47
    
                echo '<h1>' . $recipe['titre'] . '</h1>';
48
            
49
                echo '</div>';
50
                echo '</div></li>';
51
            }
ALGLAVE Ivan's avatar
d    
ALGLAVE Ivan committed
52
53
54
55
56
        }

    ?>

    </ul>
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    
    <script>
        document.addEventListener('keyup', function (e)
            {
                if(e.keyCode == 27)
                {
                    var data = {
                        event: 'keyup',
                        value: e.keyCode
                    };
                    window.top.postMessage(data, [data.event, data.value]);
                }
            });

            function showRecipe(id)
            {
                var data = {
                        event: 'recipeselect',
                        value: id
                    };
                    window.top.postMessage(data, [data.event, data.value]);
            }
    </script>
ALGLAVE Ivan's avatar
d    
ALGLAVE Ivan committed
80
81
82
83

</body>

</html>