Restructuration du git et ajout de la fonctionnalité de création de portfolio
This commit is contained in:
parent
dfaaedbda8
commit
3c80c52529
43 changed files with 1818 additions and 0 deletions
55
app/entities/category_entity.php
Normal file
55
app/entities/category_entity.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
require_once("mother_entity.php");
|
||||
/**
|
||||
* Classe d'un objet Projet
|
||||
* @author Laura
|
||||
*/
|
||||
|
||||
class Category extends Entity{
|
||||
|
||||
private int $_id;
|
||||
protected string $_name = '';
|
||||
|
||||
/**
|
||||
* Constructeur (j'ai toujours pas compris à quoi ça sert)
|
||||
*/
|
||||
public function __construct(){
|
||||
$this->_prefix = 'category_';
|
||||
}
|
||||
|
||||
// Méthode Getter et Setter
|
||||
|
||||
/**
|
||||
* Récuperation de l'id du Projet
|
||||
* @return int l'id de la catégorie
|
||||
*/
|
||||
public function getId():int{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour de l'id de la catégorie
|
||||
* @param int le nouvelle id
|
||||
*/
|
||||
public function setId($id){
|
||||
$this->_id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récuperation du nom de la catégorie
|
||||
* @return string nom de la catégorie
|
||||
*/
|
||||
public function getName(){
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour du nom de la catégorie
|
||||
* @param string le nouveau nom de la catégorie
|
||||
*/
|
||||
public function setName($name){
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
30
app/entities/mother_entity.php
Normal file
30
app/entities/mother_entity.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Classe d'une Mere de tout objet
|
||||
* @author Yass
|
||||
*/
|
||||
|
||||
class Entity{
|
||||
|
||||
protected string $_prefix = '';
|
||||
|
||||
|
||||
public function hydrate(array $arrData){
|
||||
foreach($arrData as $key=>$value){
|
||||
$strMethodName = "set".ucfirst(str_replace($this->_prefix,'',$key));
|
||||
var_dump($strMethodName);
|
||||
if (method_exists($this,$strMethodName)){
|
||||
$this->$strMethodName($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function nettoyer(string $strText){
|
||||
$strText = trim($strText);
|
||||
$strText = str_replace("<script>", "", $strText);
|
||||
$strText = str_replace("</script>", "", $strText);
|
||||
return $strText;
|
||||
}
|
||||
|
||||
}
|
||||
221
app/entities/project_entity.php
Normal file
221
app/entities/project_entity.php
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
require_once("mother_entity.php");
|
||||
|
||||
/**
|
||||
* Classe d'un objet Projet
|
||||
* @author Yass
|
||||
*/
|
||||
|
||||
class Project extends Entity{
|
||||
|
||||
private int $_id;
|
||||
private string $_title;
|
||||
private string $_description;
|
||||
private string $_thumbnail;
|
||||
private string $_content;
|
||||
private string $_creation_date;
|
||||
private string $_status;
|
||||
private int $_user;
|
||||
private int $_category;
|
||||
private string $_creatorname;
|
||||
private string $_user_image;
|
||||
|
||||
|
||||
/**
|
||||
* Constructeur (logique mdrr)
|
||||
*/
|
||||
public function __construct(){
|
||||
$this->_prefix = 'project_';
|
||||
}
|
||||
|
||||
// Méthode Getter et Setter
|
||||
|
||||
/**
|
||||
* Récuperation de l'id du Projet
|
||||
* @return int l'id du projet
|
||||
*/
|
||||
public function getId():int{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour de l'id du projet
|
||||
* @param int le nouvelle id
|
||||
*/
|
||||
public function setId($id){
|
||||
$this->_id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récuperation du titre
|
||||
* @return string tite du projet
|
||||
*/
|
||||
public function getTitle(){
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour du titre
|
||||
* @param string le nouveau titre
|
||||
*/
|
||||
public function setTitle($title){
|
||||
$this->_title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récuperation de la description
|
||||
* @return string description du projet
|
||||
*/
|
||||
public function getDescription(){
|
||||
return $this->_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour de la description
|
||||
* @param string la nouvelle description
|
||||
*/
|
||||
public function setDescription($description){
|
||||
$this->_description = $description;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Récuperation de l'image
|
||||
* @return string chemin vers l'image
|
||||
*/
|
||||
public function getThumbnail(){
|
||||
return $this->_thumbnail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour de l'image
|
||||
* @param string chemin vers nouvelle image
|
||||
*/
|
||||
public function setThumbnail($thumbnail){
|
||||
$this->_thumbnail = $thumbnail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récuperation du contenue
|
||||
* @return string contenue du projet
|
||||
*/
|
||||
public function getContent(){
|
||||
return $this->_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour du contenue
|
||||
* @param string le nouveau contenue
|
||||
*/
|
||||
public function setContent($content){
|
||||
$this->_content = $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Récupération de la date de création
|
||||
* @param string lang de formatage de la date (par défaut = "fr_FR")
|
||||
* @return string date de création formatter
|
||||
*/
|
||||
public function getCreation_date(string $strFormat = "fr_FR"){
|
||||
$objDate = new DateTime($this->_creation_date);
|
||||
|
||||
$objDateFormatter = new IntlDateFormatter(
|
||||
$strFormat,
|
||||
IntlDateFormatter::LONG,
|
||||
IntlDateFormatter::NONE,
|
||||
|
||||
);
|
||||
$strFormat = $objDateFormatter->format($objDate);
|
||||
return $strFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour de la date de création
|
||||
* @param string la nouvelle date de création
|
||||
*/
|
||||
public function setCreation_date($creation_date){
|
||||
$this->_creation_date = $creation_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupération du statut
|
||||
* @return string statut
|
||||
*/
|
||||
public function getStatus(){
|
||||
return $this->_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour du statut
|
||||
* @param string le nouveau statut
|
||||
*/
|
||||
public function setStatus($status){
|
||||
$this->_status = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupération de l'utilisateur
|
||||
* @return int id de l'utilisateur
|
||||
*/
|
||||
public function getUser(){
|
||||
return $this->_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour de l'utilisateur
|
||||
* @param int id de l'utilisateur
|
||||
*/
|
||||
public function setUser($user){
|
||||
$this->_user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupération de la catégorie
|
||||
* @return int id de la catégorie
|
||||
*/
|
||||
public function getCategory(){
|
||||
return $this->_category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour de la catégorie
|
||||
* @param int id de la catégorie
|
||||
*/
|
||||
public function setCategory($category){
|
||||
$this->_category = $category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupération du nom du créateur
|
||||
* @return string nom du créateur
|
||||
*/
|
||||
public function getCreatorName(){
|
||||
return $this->_creatorname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour du nom du créateur
|
||||
* @param string le nom du créateur
|
||||
*/
|
||||
public function setCreatorName($creatorname){
|
||||
$this->_creatorname = $creatorname;
|
||||
}
|
||||
/**
|
||||
* Récupération du chemin photo profil
|
||||
* @return string nom du chemin photo profil
|
||||
*/
|
||||
public function getUser_image(){
|
||||
return $this->_user_image;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour du chemin photo profil
|
||||
* @param string chemin photo profil
|
||||
*/
|
||||
public function setUser_image($user_image){
|
||||
$this->_user_image = $user_image;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
51
app/entities/user_entity.php
Normal file
51
app/entities/user_entity.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
require_once("mother_entity.php");
|
||||
|
||||
class User extends Entity{
|
||||
// Attributs
|
||||
private string $_name = '';
|
||||
private string $_firstname = '';
|
||||
private string $_mail = '';
|
||||
private string $_pwd;
|
||||
|
||||
/**
|
||||
* Constructeur
|
||||
*/
|
||||
public function __construct(){
|
||||
// Préfixe de la table pour hydratation
|
||||
$this->_prefixe = 'user_';
|
||||
}
|
||||
|
||||
// Méthodes - getters et setters
|
||||
public function getName():string{
|
||||
return $this->_name;
|
||||
}
|
||||
public function setName(string $strNewName){
|
||||
$this->_name = $this->nettoyer($strNewName);
|
||||
}
|
||||
public function getFirstname():string{
|
||||
return $this->_firstname;
|
||||
}
|
||||
public function setFirstname(string $strFirstname){
|
||||
$this->_firstname = $this->nettoyer($strFirstname);
|
||||
}
|
||||
public function getMail():string{
|
||||
return $this->_mail;
|
||||
}
|
||||
public function setMail(string $strMail){
|
||||
$this->_mail = strtolower($this->nettoyer($strMail));
|
||||
}
|
||||
public function getPwd():string{
|
||||
return $this->_pwd;
|
||||
}
|
||||
public function getPwdHash():string{
|
||||
return password_hash($this->_pwd, PASSWORD_DEFAULT);
|
||||
}
|
||||
public function setPwd(string $strPwd){
|
||||
$this->_pwd = $strPwd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue