creaction entite & model image. Finalisation page projet
This commit is contained in:
parent
47ee556a8c
commit
c0aab723d7
6 changed files with 154 additions and 14 deletions
|
|
@ -3,6 +3,8 @@
|
|||
require("../app/entities/project_entity.php");
|
||||
require("../app/models/category_model.php");
|
||||
require("../app/entities/category_entity.php");
|
||||
require("../app/models/image_model.php");
|
||||
require("../app/entities/image_entity.php");
|
||||
|
||||
/**
|
||||
* Le controler des Project
|
||||
|
|
@ -84,9 +86,30 @@
|
|||
* Fonction d'affichage de la page projet
|
||||
*/
|
||||
|
||||
|
||||
public function project (){
|
||||
|
||||
$objProjectModel = new ProjectModel;
|
||||
$arrProject = $objProjectModel->findAll(4);
|
||||
$arrProjectToDiplay = array();
|
||||
foreach($arrProject as $arrDetProject){
|
||||
$objProject = new Project;
|
||||
$objProject->hydrate($arrDetProject);
|
||||
$arrProjectToDiplay[] = $objProject;
|
||||
}
|
||||
|
||||
$objImageModel = new ImageModel;
|
||||
$arrImage = $objImageModel->findAllImage(4);
|
||||
$arrImageToDiplay = array();
|
||||
foreach($arrImage as $arrDetImage){
|
||||
$objImage = new Image;
|
||||
$objImage->hydrate($arrDetImage);
|
||||
$arrImageToDiplay[] = $objImage;
|
||||
}
|
||||
|
||||
include("../app/views/partials/header.php");
|
||||
include('../app/views/project.php');
|
||||
include('../app/views/partials/footer.php');
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once("mother_entity.php");
|
||||
|
||||
/**
|
||||
* Classe d'un objet Projet
|
||||
* @author Laura
|
||||
|
|
@ -20,7 +22,7 @@ class Category extends Entity{
|
|||
// Méthode Getter et Setter
|
||||
|
||||
/**
|
||||
* Récuperation de l'id du Projet
|
||||
* Récuperation de l'id de la catégorie
|
||||
* @return int l'id de la catégorie
|
||||
*/
|
||||
public function getId():int{
|
||||
|
|
|
|||
90
app/entities/image_entity.php
Normal file
90
app/entities/image_entity.php
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
require_once("mother_entity.php");
|
||||
|
||||
/**
|
||||
* Classe d'un objet Projet
|
||||
* @author Laura
|
||||
*/
|
||||
|
||||
class Image extends Entity{
|
||||
|
||||
private int $_id;
|
||||
protected string $_name = '';
|
||||
protected string $_alt = '';
|
||||
protected string $_status ='';
|
||||
|
||||
|
||||
|
||||
//le construc habituel
|
||||
public function __construct(){
|
||||
$this->_prefix = 'image_';
|
||||
}
|
||||
|
||||
// Méthode Getter et Setter
|
||||
|
||||
/**
|
||||
* Récuperation de l'id de l'image
|
||||
* @return int l'id de l'image
|
||||
*/
|
||||
public function getId():int{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour de l'id de l'image
|
||||
* @param int le nouvelle id
|
||||
*/
|
||||
public function setId($id){
|
||||
$this->_id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récuperation du nom de l'image
|
||||
* @return string nom de l'image
|
||||
*/
|
||||
public function getName(){
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour du nom de l'image
|
||||
* @param string le nouveau nom de l'image
|
||||
*/
|
||||
public function setName($name){
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récuperation de l'alt
|
||||
* @return string contenu de l'alt
|
||||
*/
|
||||
public function getAlt(){
|
||||
return $this->_alt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour de l'alt
|
||||
* @param string le nouveau contenu de l'alt
|
||||
*/
|
||||
public function setAlt($alt){
|
||||
$this->_alt = $alt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récuperation du statut de la photo
|
||||
* @return string du statut
|
||||
*/
|
||||
public function getStatus(){
|
||||
return $this->_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour du statut de la photo
|
||||
* @param string le nouveau statut de la photo
|
||||
*/
|
||||
public function setStatus($status){
|
||||
$this->_status = $status;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* Classe d'un Mere de tout objet
|
||||
* @author Yass
|
||||
* @author Yass & Laura
|
||||
*/
|
||||
|
||||
class Entity{
|
||||
|
|
|
|||
25
app/models/image_model.php
Normal file
25
app/models/image_model.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
require_once('../config/database.php');
|
||||
|
||||
/**
|
||||
* Classe d'un objet Projet
|
||||
* @author Laura
|
||||
*/
|
||||
|
||||
class ImageModel extends Connect{
|
||||
|
||||
public function findAllImage(int $intLimit=0):array{
|
||||
|
||||
// Ecrire la requête
|
||||
$strRq = "SELECT image.*
|
||||
FROM image";
|
||||
|
||||
|
||||
if ($intLimit > 0){
|
||||
$strRq .= " LIMIT ".$intLimit;
|
||||
}
|
||||
|
||||
// Lancer la requête et récupérer les résultats
|
||||
return $this->_db->query($strRq)->fetchAll();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,24 @@
|
|||
<body>
|
||||
<section class="container mt-5 p-5 d-flex flex-column align-items-center">
|
||||
<div>
|
||||
<h2>Alimenter votre projet</h2>
|
||||
<button type="button" class="btn btn-primary btn-lg">+</button>
|
||||
</div>
|
||||
<section class="container mt-5 p-5 d-flex flex-column align-items-center justify-content-center">
|
||||
<h2>Alimenter votre projet</h2>
|
||||
<div class="justify-content-center align-items-center">
|
||||
<button type="button" class="btn btn-primary rounded-circle d-flex justify-content-center align-items-center"><span class="fs-4 fw-bold text-white mb-2 ms-2 me-2">+</span></button>
|
||||
</div class="col-12">
|
||||
<div>
|
||||
<h3>Description</h3>
|
||||
<h3 class="fw-semibold fs-3 my-5">Description</h3>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
||||
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Photos behind the scene</h3>
|
||||
<div class="row mb-2">
|
||||
<img >
|
||||
<div class="col-12">
|
||||
<h3 class="fw-semibold fs-3 my-5">Photos behind the scene</h3>
|
||||
<div class="row my-2">
|
||||
<img class="bd-placeholder-img" width="200" height="250" src="<?= isset($objImage) ? '../../public/assets/img/'.$objImage->getName() : '' ?>" alt="<?php echo $objImage->getAlt(); ?>" loading="lazy">
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="col-12">
|
||||
<h3>Other projects</h3>
|
||||
<div class="row mb-2">
|
||||
<div class="row my-2">
|
||||
<?php
|
||||
foreach($arrProjectToDiplay as $objProject){
|
||||
include("../app/views/partials/preview.php");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue