backup du projet

This commit is contained in:
Yasder5
2026-02-26 00:19:11 +01:00
commit 4655c05be6
670 changed files with 87655 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?php
require_once("mother_entity.php");
class Authorisation extends Entity{
private int $_id;
private string $_name = '';
public function __construct(){
$this->_prefix = 'authorisation_';
}
public function getId():int{
return $this->_id;
}
public function setId(int $id){
$this->_id = $id;
}
public function getName():string{
return $this->_name;
}
public function setName(string $name){
$this->_name = $name;
}
}

View File

@@ -0,0 +1,81 @@
<?php
require_once("mother_entity.php");
/**
* Classe d'un objet Projet
* @author Laura
*/
class Category extends Entity{
private ?int $_id = null;
protected string $_name = '';
protected ?int $_parent = null;
/**
* 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 de la catégorie
* @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){
if (empty($id)) {
$this->_id = null;
} else {
$this->_id = (int) $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;
}
/**
* Récuperation du nom du parent de la catégorie
* @return int nom de la catégorie
*/
public function getParent():?int{
return $this->_parent;
}
/**
* Mise à jour du nom du parent de la catégorie
* @param int le nouveau nom de la catégorie
*/
public function setParent($parent){
if (empty($parent)) {
$this->_parent = null;
} else {
$this->_parent = (int) $parent;
}
}
}

91
entities/image_entity.php Normal file
View File

@@ -0,0 +1,91 @@
<?php
require_once("mother_entity.php");
/**
* Classe d'un objet Projet
* @author Laura
*/
class Image extends Entity{
private int $_id;
private string $_name = '';
private string $_alt = '';
private string $_status ='';
private int $_project = 0;
//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;
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Classe d'un Mere de tout objet
* @author Yass & Laura
*/
class Entity{
protected string $_prefix = '';
public function hydrate(array $arrData){
foreach($arrData as $key=>$value){
$strMethodName = "set".ucfirst(str_replace($this->_prefix,'',$key));
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
entities/project_entity.php Normal file
View 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 = null;
private string $_title = "";
private string $_description = "";
private ?string $_thumbnail = null;
private string $_content = "";
private string $_creation_date;
private string $_status = "en_attente";
private int $_user;
private int $_category = 0;
private string $_creatorname;
private ?string $_user_image = null;
/**
* 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(int $id){
$this->_id = $id;
return $this;
}
/**
* 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_id(){
return $this->_user;
}
/**
* Mise à jour de l'utilisateur
* @param int id de l'utilisateur
*/
public function setUser_id($user){
$this->_user = $user;
}
/**
* Récupération de la catégorie
* @return int id de la catégorie
*/
public function getCategory():?int{
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;
}
}

124
entities/user_entity.php Normal file
View File

@@ -0,0 +1,124 @@
<?php
require_once("mother_entity.php");
class User extends Entity{
private int $_id;
private string $_name = '';
private string $_firstname = '';
private string $_pseudo = '';
private ?string $_image = null;
private string $_mail = '';
private string $_pwd;
private string $_phone = '';
private string $_work = '';
private ?string $_birth = null;
private string $_location = '';
private string $_description = '';
private string $_account_creation = '';
private int $_status;
public function __construct(){
$this->_prefix = 'user_';
}
public function getId():int{
return $this->_id;
}
public function setId(int $id){
$this->_id = $id;
}
public function getName():string{
return $this->_name;
}
public function setName(string $name){
$this->_name = $name;
}
public function getFirstname():string{
return $this->_firstname;
}
public function setFirstname(string $firstname){
$this->_firstname = $firstname;
}
public function getPseudo():string{
return $this->_pseudo;
}
public function setPseudo(string $pseudo){
$this->_pseudo = $pseudo;
}
public function getImage():?string{
return $this->_image;
}
public function setImage(?string $image){
$this->_image = $image;
}
public function getMail():string{
return $this->_mail;
}
public function setMail(string $mail){
$this->_mail = strtolower($mail);
}
public function getPwd():string{
return $this->_pwd;
}
public function getPwdHash():string{
return password_hash($this->_pwd, PASSWORD_DEFAULT);
}
public function setPwd(string $pwd){
$this->_pwd = $pwd;
}
public function getPhone():string{
return $this->_phone;
}
public function setPhone(string $phone){
$this->_phone = $phone;
}
public function getWork():string{
return $this->_work;
}
public function setWork(string $work){
$this->_work = $work;
}
public function getBirth():?string{
return $this->_birth;
}
public function setBirth(?string $birth){
$this->_birth = $birth;
}
public function getLocation():string{
return $this->_location;
}
public function setLocation(string $location){
$this->_location = $location;
}
public function getDescription():string{
return $this->_description;
}
public function setDescription(string $description){
$this->_description = $description;
}
public function getAccountCreation():string{
return $this->_account_creation;
}
public function setAccountCreation(string $account_creation){
$this->_account_creation = $account_creation;
}
public function getStatus():int{
return $this->_status;
}
public function setStatus(int $status){
$this->_status = $status;
}
}