Exemple #1
0
 public static function renderRecipePage($oRecipe)
 {
     $bCanLike = false;
     if (isset($_SESSION["UserID"]) == true) {
         $oLike = new Like();
         $bLoadStatus = $oLike->loadByUserRecipe($_SESSION["UserID"], $oRecipe->recipeID);
         if ($bLoadStatus == false) {
             $bCanLike = true;
         }
     }
     $oAuthor = new User();
     $oAuthor->load($oRecipe->userID);
     $sOutput = '<h1 class="textAlignCenter marginBottom10">' . htmlentities($oRecipe->title) . '</h1>' . "\n";
     $sOutput .= '<span class="displayBlock positionRelative recipeCaption captionLine textAlignCenter marginBottom10">Submitted by <span class="authorLine colourPink">' . htmlentities($oAuthor->firstName) . ' ' . htmlentities($oAuthor->lastName) . '</span></span>' . "\n";
     $sOutput .= '<h2 class="textAlignCenter marginTop20">Authors Notes</h2>' . "\n";
     $sOutput .= '<p class="marginBottom50 textAlignCenter">' . htmlentities($oRecipe->authorNotes) . '</p>' . "\n";
     $sOutput .= '<div class="eight columns floatLeft marginBottom20">' . "\n";
     $sOutput .= '<img class="mainImage" src="images/' . $oRecipe->imagePath . '" alt="' . $oRecipe->title . ' .image" />' . "\n";
     $sOutput .= '</div>' . "\n";
     $sOutput .= '<div class="eight columns floatLeft mainImage marginBottom20">' . "\n";
     if ($bCanLike == true) {
         $sOutput .= '<div class="likeButton marginTop10"><a href="likeRecipe.php?RecipeID=' . $oRecipe->recipeID . '"><i class="fa fa-heart marginRight10"></i>' . count($oRecipe->likes) . '</a></div>' . "\n";
     } else {
         if (isset($_SESSION["UserID"]) && $bCanLike == false) {
             $sOutput .= '<div class="likeButton bgPink marginTop10"><span><i class="fa fa-heart marginRight10"></i>' . count($oRecipe->likes) . '</span></div>' . "\n";
         } else {
             $sOutput .= '<div class="likeButton marginTop10"><a href="likeRecipe.php?RecipeID=' . $oRecipe->recipeID . '"><i class="fa fa-heart marginRight10"></i>' . count($oRecipe->likes) . '</a></div>' . "\n";
         }
     }
     $sOutput .= '<h3>Ingredients</h3>' . "\n";
     $sOutput .= $oRecipe->ingredients . "\n";
     $sOutput .= '</div>' . "\n";
     $sOutput .= '<div class="clearBoth sixteen columns marginTop20">' . "\n";
     $sOutput .= '<h3>Directions</h3>' . "\n";
     $sOutput .= $oRecipe->directions . "\n";
     $sOutput .= '</div>' . "\n";
     return $sOutput;
 }