RecipeList.php 2.27 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";
18
19
        
        $showScore = $_GET['showscore'] == 'true' ? true : false;
ALGLAVE Ivan's avatar
d  
ALGLAVE Ivan committed
20

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

23
        else{
ALGLAVE Ivan's avatar
d  
ALGLAVE Ivan committed
24

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

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

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

    ?>

    </ul>
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
    
    <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
82
83
84
85

</body>

</html>