rename some methods

This commit is contained in:
Thomas Rubini 2023-01-25 16:46:59 +01:00
parent 8272de705b
commit 7baf1bdcf3
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373
5 changed files with 7 additions and 7 deletions

View File

@ -85,8 +85,8 @@ final class RecipeController
$O_recipe = RecipeModel::getRecipeByID($A_urlParams[0]); $O_recipe = RecipeModel::getRecipeByID($A_urlParams[0]);
header("Content-Type: image"); header("Content-Type: image");
if (isset($O_recipe) && $O_recipe->getImage() !== null) { if (isset($O_recipe) && $O_recipe->queryImg() !== null) {
echo $O_recipe->getImage(); echo $O_recipe->queryImg();
} else { } else {
echo file_get_contents(Constants::rootDir()."/static/img/default_recipe.jpg"); echo file_get_contents(Constants::rootDir()."/static/img/default_recipe.jpg");
} }

View File

@ -81,7 +81,7 @@ final class RecipeModel
return self::createFromRow($row, $I_id); return self::createFromRow($row, $I_id);
} }
public function getImageLink(){ public function getImgLink(){
return '/static/img/recipes/'.$this->I_ID; return '/static/img/recipes/'.$this->I_ID;
} }
@ -89,7 +89,7 @@ final class RecipeModel
return '/recipe/view/'.$this->I_ID; return '/recipe/view/'.$this->I_ID;
} }
public function getImage(){ public function queryImg(){
$O_model = Model::get(); $O_model = Model::get();
$stmt = $O_model->prepare("SELECT IMG FROM RECIPE WHERE ID=:id"); $stmt = $O_model->prepare("SELECT IMG FROM RECIPE WHERE ID=:id");
$stmt->bindParam("id", $this->I_ID); $stmt->bindParam("id", $this->I_ID);

View File

@ -111,7 +111,7 @@ final class UserModel extends UserSessionModel
$stmt->execute(); $stmt->execute();
} }
public function getProfilePic(){ public function queryProfilePic(){
$O_model = Model::get(); $O_model = Model::get();
$stmt = $O_model->prepare("SELECT PROFILE_PIC FROM USER WHERE ID=:id"); $stmt = $O_model->prepare("SELECT PROFILE_PIC FROM USER WHERE ID=:id");
$stmt->bindParam("id", $this->I_ID); $stmt->bindParam("id", $this->I_ID);

View File

@ -2,7 +2,7 @@
$O_recipe = $A_view["RECIPE"]; $O_recipe = $A_view["RECIPE"];
?> ?>
<a href="<?= $O_recipe->getLink() ?>"> <a href="<?= $O_recipe->getLink() ?>">
<img src="<?= $O_recipe->getImageLink() ?>" alt="<?= $O_recipe->S_NAME ?>"> <img src="<?= $O_recipe->getImgLink() ?>" alt="<?= $O_recipe->S_NAME ?>">
<section> <section>
<h2> <?= $O_recipe->S_NAME ?> </h2> <h2> <?= $O_recipe->S_NAME ?> </h2>
<p> <?= $O_recipe->queryNote() ?> </p> <p> <?= $O_recipe->queryNote() ?> </p>

View File

@ -4,7 +4,7 @@ $O_recipe = $A_view["RECIPE"];
<main> <main>
<?php View::show("common/category_list") ?> <?php View::show("common/category_list") ?>
<article> <article>
<img src="<?= $O_recipe->getImageLink() ?>" alt="Image d'illustration de la recette"> <img src="<?= $O_recipe->getImgLink() ?>" alt="Image d'illustration de la recette">
<section class="infosRecette"> <section class="infosRecette">
<header> <header>