Commit 3d1038d4 authored by Julien Ait azzouzene's avatar Julien Ait azzouzene
Browse files

🐛 fix: correction de la vue du détail d'une recette pour fonctionner avec le nouveau modèle

parent e20fb314
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
// Le retour se chargera aussi de gérer les exceptions avec un try / catch

require_once 'src/controllers/accueil.php';
require_once 'src/controllers/pageRecette.php';

try{
    // Si 'action' n'est pas défini, on charge la page d'accueil
@@ -23,6 +24,11 @@ try{
            require 'test/tests.php';
            break;

        case 'detail-recette':
            $controleur = new PageRecetteControleur();
            $controleur->executer();
            break;
            
        default:
            throw new Exception("la page demandée n'a pas été trouvée");
    }
+16 −0
Original line number Diff line number Diff line
<?php

require_once 'src/controllers/controleur.php';

require_once 'src/model/recette.php';
require_once 'src/model/recetteManager.php';

require_once 'templates/pageRecette.php';

class PageRecetteControleur extends Controleur {
    public function executer() {
        $recette = (new RecetteManager)->getRecette('1');

        afficherPageRecette($recette);
    }
}
 No newline at end of file
+14 −3
Original line number Diff line number Diff line
<?php
require_once 'src/lib/Parsedown.php';
require_once 'src/model/recette.php';
function AfficherPageRecette(Recette $recette){
require_once 'src/model/ingredient.php';

function afficherPageRecette(Recette $recette){
    $titre = $recette->getTitre();

    $Parsedown=new Parsedown();
    $Parsedown->setSafeMode(true);

    ob_start();
    ?>
    <div data-bss-parallax-bg="true" style="height: 500px;padding-top: 100px;padding-right: 10px;padding-left: 10px;background: url(<?=$recette->getUrlImage()?>) center / cover;">

    <?php //TODO gérer les dimensions de l'image ?>
    <div data-bss-parallax-bg="true" style="height: 500px;padding-top: 100px;padding-right: 10px;padding-left: 10px;background: url(<?=$recette->getImage()?>)">
        <h1 style="width: 100%;margin-bottom: auto;text-align: center;height: auto;padding-top: 0;"><?=$recette->getTitre() ?></h1>
        <p style="margin-top: 50px;margin-bottom: 10%;padding: 0px;width: auto;text-align: center;"><?=$recette->getResume() ?></p>
    </div>
@@ -22,7 +30,7 @@ function AfficherPageRecette(Recette $recette){
                                    <!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. -->
                                    <path d="M171.7 191.1H404.3L322.7 35.07C316.6 23.31 321.2 8.821 332.9 2.706C344.7-3.409 359.2 1.167 365.3 12.93L458.4 191.1H544C561.7 191.1 576 206.3 576 223.1C576 241.7 561.7 255.1 544 255.1L492.1 463.5C484.1 492 459.4 512 430 512H145.1C116.6 512 91 492 83.88 463.5L32 255.1C14.33 255.1 0 241.7 0 223.1C0 206.3 14.33 191.1 32 191.1H117.6L210.7 12.93C216.8 1.167 231.3-3.409 243.1 2.706C254.8 8.821 259.4 23.31 253.3 35.07L171.7 191.1zM191.1 303.1C191.1 295.1 184.8 287.1 175.1 287.1C167.2 287.1 159.1 295.1 159.1 303.1V399.1C159.1 408.8 167.2 415.1 175.1 415.1C184.8 415.1 191.1 408.8 191.1 399.1V303.1zM271.1 303.1V399.1C271.1 408.8 279.2 415.1 287.1 415.1C296.8 415.1 304 408.8 304 399.1V303.1C304 295.1 296.8 287.1 287.1 287.1C279.2 287.1 271.1 295.1 271.1 303.1zM416 303.1C416 295.1 408.8 287.1 400 287.1C391.2 287.1 384 295.1 384 303.1V399.1C384 408.8 391.2 415.1 400 415.1C408.8 415.1 416 408.8 416 399.1V303.1z"></path>
                                </svg>
                                <p class="mt-2" style="font-size: 20px;color: rgb(102,99,99);width: auto;"><?=$ingredient?></p>
                                <p class="mt-2" style="font-size: 20px;color: rgb(102,99,99);width: auto;"><?=$ingredient->getIntitule()?></p>
                            </div>
                        </div>
                    </div>
@@ -39,5 +47,8 @@ function AfficherPageRecette(Recette $recette){
        </div>
    </div>
    <?php
    $contenu = ob_get_clean();

    require 'templates/layout.php';
}
?>
 No newline at end of file