From f27cca08ff786ceff1870147f6d6bad14d71117f Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 23 Oct 2026 00:47:32 +0200 Subject: =?UTF-8?q?dossiers=20avec=20majuscule,=20namespace=20pour=20toute?= =?UTF-8?q?s=20les=20classes,=20autoload=20psr-4,=20UserDataService::creat?= =?UTF-8?q?eZip=20d=C3=A9plac=C3=A9=20dans=20Backup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/entities/AppMetadata.php | 46 ------- src/model/entities/Article.php | 94 -------------- src/model/entities/Asset.php | 68 ---------- src/model/entities/AssetEmployment.php | 54 -------- src/model/entities/Email.php | 131 ------------------- src/model/entities/EmailForm.php | 57 --------- src/model/entities/Event.php | 129 ------------------- src/model/entities/Image.php | 89 ------------- src/model/entities/Log.php | 38 ------ src/model/entities/Node.php | 166 ------------------------- src/model/entities/NodeData.php | 102 --------------- src/model/entities/Page.php | 221 --------------------------------- src/model/entities/Presentation.php | 135 -------------------- src/model/entities/User.php | 67 ---------- 14 files changed, 1397 deletions(-) delete mode 100644 src/model/entities/AppMetadata.php delete mode 100644 src/model/entities/Article.php delete mode 100644 src/model/entities/Asset.php delete mode 100644 src/model/entities/AssetEmployment.php delete mode 100644 src/model/entities/Email.php delete mode 100644 src/model/entities/EmailForm.php delete mode 100644 src/model/entities/Event.php delete mode 100644 src/model/entities/Image.php delete mode 100644 src/model/entities/Log.php delete mode 100644 src/model/entities/Node.php delete mode 100644 src/model/entities/NodeData.php delete mode 100644 src/model/entities/Page.php delete mode 100644 src/model/entities/Presentation.php delete mode 100644 src/model/entities/User.php (limited to 'src/model/entities') diff --git a/src/model/entities/AppMetadata.php b/src/model/entities/AppMetadata.php deleted file mode 100644 index ae42ad9..0000000 --- a/src/model/entities/AppMetadata.php +++ /dev/null @@ -1,46 +0,0 @@ -key_name = $key; - $this->value = $value; - } - - public function getKey(): string - { - return $this->key_name; - } - public function getValue(): string - { - return $this->value; - } - - public function setKey(string $key): void - { - $this->key_name = $key; - } - public function setValue(string $value): void - { - $this->value = $value; - } -} \ No newline at end of file diff --git a/src/model/entities/Article.php b/src/model/entities/Article.php deleted file mode 100644 index b9cb4bb..0000000 --- a/src/model/entities/Article.php +++ /dev/null @@ -1,94 +0,0 @@ - 'CURRENT_TIMESTAMP'], unique: true)] - private ?\DateTime $date_time; // le type datetime de doctrine convertit en type \DateTime de PHP - - #[ORM\Column(type: "text")] // "string" => varchar(255) => risque HTML non valide - private string $title; - - #[ORM\Column(type: "text")] - private string $preview; // une simple textarea - - #[ORM\Column(type: "text")] - private string $content; // de l'éditeur html - - #[ORM\ManyToMany(targetEntity: Image::class, inversedBy: "article")] // cascade: ['remove'] = très dangereux! - #[ORM\JoinTable( - name: TABLE_PREFIX . "article_image", - joinColumns: [new ORM\JoinColumn(name: "article_id", referencedColumnName: "id_article", onDelete: "CASCADE")], // onDelete: "CASCADE": très utile - inverseJoinColumns: [new ORM\JoinColumn(name: "image_id", referencedColumnName: "id_image", onDelete: "CASCADE")] - )] - private Collection $images; - - public function __construct(string $content, \DateTime $date_time = null, string $title = '', string $preview = '') - { - $this->date_time = $date_time; - $this->title = $title; - $this->preview = $preview; - $this->content = $content; - $this->images = new ArrayCollection(); // initialisation nécessaire - } - - public function getDateTime(): \DateTime - { - return $this->date_time; - } - public function setDateTime(\DateTime $date_time): void - { - $this->date_time = $date_time; - } - public function getTimestamp(): int - { - return $this->date_time->getTimestamp(); - } - public function getTitle(): string - { - return $this->title; - } - public function setTitle(string $title): void - { - $this->title = $title; - } - public function getPreview(): string - { - return $this->preview; - } - public function setPreview(string $preview): void - { - $this->preview = $preview; - } - public function getContent(): string - { - return $this->content; - } - public function setContent(string $data): void - { - $this->content = $data; - } - - public function getImages(): Collection - { - return $this->images; - } -} diff --git a/src/model/entities/Asset.php b/src/model/entities/Asset.php deleted file mode 100644 index d76ba08..0000000 --- a/src/model/entities/Asset.php +++ /dev/null @@ -1,68 +0,0 @@ -file_name = $name; - $this->mime_type = $mime_type; - $this->hash = $hash; - } - - public function getFileName(): string - { - return $this->file_name; - } - public function setFileName(string $name): void - { - $this->file_name = $name; - } - public function getMimeType(): string - { - return $this->mime_type; - } - public function setMimeType(string $mime_type): void - { - $this->mime_type = $mime_type; - } - public function getHash(): string - { - return $this->hash; - } - - public function getAssetEmployments(): Collection - { - return $this->asset_employment; - } -} diff --git a/src/model/entities/AssetEmployment.php b/src/model/entities/AssetEmployment.php deleted file mode 100644 index 04bbd9a..0000000 --- a/src/model/entities/AssetEmployment.php +++ /dev/null @@ -1,54 +0,0 @@ - ressource unique" (paires node_data/role uniques) -// doctrine gère mal les clés primaires triples, j'ai donc choisi une clé primaire double node_data_id/role - -declare(strict_types=1); - -namespace App\Entity; - -use Doctrine\ORM\Mapping as ORM; - -#[ORM\Entity] -#[ORM\Table(name: TABLE_PREFIX . 'asset_employment')] -class AssetEmployment -{ - // clé primaire double - #[ORM\Id] - #[ORM\ManyToOne(targetEntity: NodeData::class, inversedBy: 'asset_employment')] - #[ORM\JoinColumn(name: 'node_data_id', referencedColumnName: 'id_node_data', onDelete: 'CASCADE')] - private NodeData $node_data; - - #[ORM\Id] - #[ORM\Column(type: 'string', length: 50)] - private string $role; - - #[ORM\ManyToOne(targetEntity: Asset::class, inversedBy: 'asset_employment')] - #[ORM\JoinColumn(name: 'asset_id', referencedColumnName: 'id_asset', onDelete: 'CASCADE')] - private Asset $asset; - - public function __construct(NodeData $node_data, Asset $asset, string $role){ - $this->node_data = $node_data; - $this->asset = $asset; - $this->role = $role; - } - - /*public function getNodeData(): NodeData - { - return $this->node_data; - }*/ - public function getAsset(): Asset - { - return $this->asset; - } - public function setAsset(Asset $asset): self - { - $this->asset = $asset; - return $this; - } - public function getRole(): string - { - return $this->role; - } -} diff --git a/src/model/entities/Email.php b/src/model/entities/Email.php deleted file mode 100644 index 60fcc1f..0000000 --- a/src/model/entities/Email.php +++ /dev/null @@ -1,131 +0,0 @@ - 'CURRENT_TIMESTAMP'])] - private \DateTime $date_time; - - #[ORM\Column(type: 'boolean')] - private bool $is_sensitive; // "sensitive" tout court est un mot réservé - - #[ORM\Column(type: 'datetime', options: ['default' => 'CURRENT_TIMESTAMP'])] - private \DateTime $last_contact_date; - - #[ORM\Column(type: 'datetime', nullable: true)] - private ?\DateTime $is_sensitive_since; - - #[ORM\ManyToOne(targetEntity: EmailForm::class)] - #[ORM\JoinColumn(name: "email_form_id", referencedColumnName: "id_email_form", nullable: true)] - private ?EmailForm $email_form; - - public function __construct(string $sender_name, string $sender_address, string $recipient, string $content, EmailForm $email_form, bool $sensitive = false){ - $this->sender_name = strtolower($sender_name); - $this->sender_address = strtolower($sender_address); - $this->recipient = strtolower($recipient); - $this->content = $content; - $this->date_time = new \DateTime; - $this->last_contact_date = new \DateTime; - $this->email_form = $email_form; - $this->makeSensitive($sensitive); - } - - public function getId(): int - { - return $this->id_email; - } - public function getSenderName(): string - { - return $this->sender_name; - } - public function getSenderAddress(): string - { - return $this->sender_address; - } - public function getRecipient(): string - { - return $this->recipient; - } - public function getContent(): string - { - return $this->content; - } - public function getDateTime(): \DateTime - { - return $this->date_time; - } - /*public function getLastContactDate(): \DateTime - { - return $this->last_contact_date; - }*/ - public function isSensitive(): bool - { - return $this->is_sensitive; - } - public function isSensitiveSince(): ?\DateTime - { - return $this->is_sensitive_since; - } - - public function makeSensitive(bool $sensitive = true): void - { - $this->is_sensitive = $sensitive; - if($sensitive && $this->is_sensitive_since === null){ - $this->is_sensitive_since = new \DateTime(); - } - } - - public function updateLastContactDate(): void - { - $this->last_contact_date = new \DateTime; - } - - public function getDeletionDate(): \DateTime // utilise une durée de conservation $period qui est propre au bloc formulaire (à son EmailForm) - { - // tests appliqués: - // => e-mail associé à un formulaire? - // => ce formulaire dispose d'une durée de stockage spécifique? - // => cette donnée est un entier > 0 - $key = $this->is_sensitive ? 'retention_period_sensible' : 'retention_period'; - $period = $this->email_form ? (int)($this->email_form->getData()[$key] ?? null) : null; - - $default = $this->is_sensitive ? self::DEFAULT_RETENTION_PERIOD_SENSITIVE : self::DEFAULT_RETENTION_PERIOD; - $period = ($period === null || $period <= 0) ? $default : $period; - - $date = clone ($this->is_sensitive ? $this->is_sensitive_since : $this->last_contact_date); // erreur si "sensible" mais sans date disponible (pas censé arriver) - return $date->modify('+ ' . (string)$period . ' month'); - } -} \ No newline at end of file diff --git a/src/model/entities/EmailForm.php b/src/model/entities/EmailForm.php deleted file mode 100644 index 0dcdeec..0000000 --- a/src/model/entities/EmailForm.php +++ /dev/null @@ -1,57 +0,0 @@ -data = $data; - $this->node = $node; - } - - public function getId(): int - { - return $this->id_email_form; - } - - // getData et updateData sont indentiques au code dans NodeData - // plutôt qu'une interface, pourquoi pas une classe abstraite? ou peut-être un trait? - public function getData(): array - { - return $this->data; - } - public function updateData(string $key, string|int|bool|array $value = ''): void - { - if($value !== ''){ - $this->data[$key] = $value; - } - // si $value est vide, supprime la clé - elseif(isset($this->data[$key])){ - unset($this->data[$key]); - } - } - - public function setNode(?Node $node): void - { - $this->node = $node; - } -} \ No newline at end of file diff --git a/src/model/entities/Event.php b/src/model/entities/Event.php deleted file mode 100644 index ae0d396..0000000 --- a/src/model/entities/Event.php +++ /dev/null @@ -1,129 +0,0 @@ - 255) - - #[ORM\Column(type: 'text')] - private string $description = ''; - // chatgpt: Dans un contexte API/Front comme FullCalendar, - // préférer une chaîne vide à une varaible "null" peut être plus pratique, - // car ça évite des contrôles côté JS. - - #[ORM\Column(type: 'datetime')] // chatgpt: Doctrine suppose UTC si pas de configuration spécifique - private \DateTimeInterface $start; // typage possible avec une interface, - //chatgpt: choix \DateTime par défaut, autorise \DateTimeImmutable - - #[ORM\Column(type: 'datetime')] - private \DateTimeInterface $end; - - #[ORM\Column(type: 'boolean')] - private bool $all_day; - - #[ORM\Column(type: 'string', length: 7, nullable: true)] - private ?string $color = null; - - public function __construct(array $json){ - $this->securedUpdateFromJSON($json); - } - - public function securedUpdateFromJSON(array $json): void - { - $this->title = htmlspecialchars($json['title']); - $this->description = htmlspecialchars($json['description']); - try{ - $this->start = new \Datetime($json['start']); - $this->end = new \Datetime($json['end']); - } - catch(\Exception $e){ - throw new \InvalidArgumentException('Bad date input'); - } - $all_day = filter_var($json['allDay'] ?? null, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); - if(!is_bool($all_day)){ - throw new \InvalidArgumentException('Bad checkbox input'); - } - $this->all_day = $all_day; - $this->color = isset($json['color']) ? htmlspecialchars($json['color']) : null; - } - - public function getId(): int - { - return $this->id; - } - - public function getTitle(): string - { - return $this->title; - } - /*public function setTitle(string $title): self - { - $this->title = $title; - return $this; - }*/ - - public function getDescription(): string - { - return $this->description; - } - /*public function setDescription(string $description = ''): self - { - $this->description = $description; - return $this; - }*/ - - public function getStart(): \DateTimeInterface - { - return $this->start; - } - /*public function setStart(\DateTimeInterface $start): self - { - $this->start = $start; - return $this; - }*/ - - public function getEnd(): \DateTimeInterface - { - return $this->end; - } - /*public function setEnd(\DateTimeInterface $end): self - { - $this->end = $end; - return $this; - }*/ - - public function isAllDay(): bool - { - return $this->all_day; - } - /*public function setAllDay(bool $all_day): self - { - $this->all_day = $all_day; - return $this; - }*/ - - public function getColor(): ?string - { - return $this->color; - } - /*public function setColor(?string $color): self - { - $this->color = $color; - return $this; - }*/ -} diff --git a/src/model/entities/Image.php b/src/model/entities/Image.php deleted file mode 100644 index 2ee379a..0000000 --- a/src/model/entities/Image.php +++ /dev/null @@ -1,89 +0,0 @@ - Validation du type de fichier : On vérifie que le fichier est bien une image en utilisant le type MIME. On peut aussi vérifier la taille du fichier. - => Création d'un répertoire structuré : On génère un chemin dynamique basé sur la date (uploads/2024/12/24/) pour organiser les images. - => Génération d'un nom de fichier unique : On utilise uniqid() pour générer un nom unique et éviter les conflits de nom. - => Déplacement du fichier sur le serveur : Le fichier est déplacé depuis son emplacement temporaire vers le répertoire uploads/. - => Enregistrement dans la base de données : On enregistre les informations de l'image dans la base de données. */ - - #[ORM\ManyToMany(targetEntity: Article::class, mappedBy: "images")] - private Collection $article; - - public function __construct(string $name, ?string $path, ?string $path_mini, string $mime_type, string $alt) - { - $this->file_name = $name; - $this->file_path = $path; - $this->file_path_mini = $path_mini; - $this->mime_type = $mime_type; - $this->alt = $alt; - } - - public function getFileName(): string - { - return $this->file_name; - } - public function getFilePath(): string - { - return $this->file_path; - } - public function getFilePathMini(): string - { - return $this->file_path_mini; - } - public function getAlt(): string - { - return $this->alt; - } - - - // pour ViewBuilderController? - /*public function displayImage($imageId): void - { - //$imageId = 1; // Exemple d'ID d'image - $stmt = $pdo->prepare("SELECT file_path FROM images WHERE id = ?"); - $stmt->execute([$imageId]); - $image = $stmt->fetch(); - - if ($image) { - echo "Image"; - } else { - echo "Image non trouvée."; - } - }*/ -} diff --git a/src/model/entities/Log.php b/src/model/entities/Log.php deleted file mode 100644 index 222b8db..0000000 --- a/src/model/entities/Log.php +++ /dev/null @@ -1,38 +0,0 @@ - 'CURRENT_TIMESTAMP'])] // CURRENT_TIMESTAMP "inutile", date générée par PHP - private \DateTime $date_time; // type datetime de doctrine <=> type \DateTime de PHP - - #[ORM\Column(type: "boolean")] - private bool $success; - - public function __construct(bool $success){ - $this->date_time = new \DateTime; - $this->success = $success; - } - - public function getFormatedDate(): string - { - return $this->date_time->format('d/m/Y à H\hi'); - } - public function getSuccess(): bool - { - return $this->success; - } -} diff --git a/src/model/entities/Node.php b/src/model/entities/Node.php deleted file mode 100644 index 7932efc..0000000 --- a/src/model/entities/Node.php +++ /dev/null @@ -1,166 +0,0 @@ -name_node = $name; - $this->position = $position; - $this->parent = $parent; - $this->page = $page; - $this->article = $article; - } - - // pfff... - public function getId(): ?int - { - return $this->id_node; - } - public function getName(): string - { - return $this->name_node; - } - /*public function setName(string $name): void - { - $this->name_node = $name; - }*/ - - public function getParent(): ?self - { - return $this->parent; - } - /*public function setParent(?self $parent): void - { - $this->parent = $parent; - }*/ - public function getPosition(): int - { - return $this->position; - } - public function setPosition(int $position): void - { - $this->position = $position; - } - public function getPage(): Page - { - return $this->page; - } - /*public function setPage(Page $page): void - { - $this->page = $page; - }*/ - - // utiliser l'interface de NodeData et EmailForm - public function getArticle(): Article - { - return $this->article; - } - /*public function setArticle(Article $article): void - { - $this->article = $article; - }*/ - - // une interface serait cool! - // OU possible un "héritage doctrine", faire en sorte que Node soit la mère de NodeData, EmailForm, Article... - // une seule instance est matérialisée par plusieurs tables en même temps - public function getNodeData(): NodeData|EmailForm|Presentation|null - { - // pour du polymorphisme (une unique variable $node_data): opter pour l'héritage - return match($this->name_node){ - 'form' => $this->email_form, - 'post_block', 'news_block' => $this->presentation, - default => $this->node_data, // inclut 'calendar' - }; - } - public function getChildren(): array - { - return $this->children; - } - public function getNodeByName(string $name): ?Node - { - foreach($this->children as $child){ - if($child->getName() === $name){ - return $child; - } - } - return null; - } - public function addChild(self $child): void - { - $this->children[] = $child; - - if(!Presentation::hasPresentation($this->getName())){ // post_block et news_block ont leurs enfants ordonnés avec ORDER BY - $this->sortChildren(false); - } - } - public function removeChild(self $child): void - { - foreach($this->children as $key => $object){ - if($object->getId() === $child->getId()){ - unset($this->children[$key]); - } - break; - } - $this->children = array_values($this->children); // réindexer pour supprimer la case vide - } - - public function getAdoptedChild(): ?self // peut renvoyer null - { - return $this->adopted; - } - public function setAdoptedChild(self $child): void - { - $this->adopted = $child; - } -} diff --git a/src/model/entities/NodeData.php b/src/model/entities/NodeData.php deleted file mode 100644 index 1646c92..0000000 --- a/src/model/entities/NodeData.php +++ /dev/null @@ -1,102 +0,0 @@ - noeud "show_emails" - - public function __construct(array $data, Node $node, Collection $asset_employment = new ArrayCollection){ - $this->data = $data; - $this->node = $node; - $this->asset_employment = $asset_employment; - } - - public function getId(): int - { - return $this->id_node_data; - } - public function getData(): array - { - return $this->data; - } - /*public function setData(array $data): void // entrée = tableau associatif - { - $this->data = $data; - }*/ - public function updateData(string $key, string|int|bool|array $value = ''): void - { - if($value !== ''){ - $this->data[$key] = $value; - } - // si $value est vide, supprime la clé - elseif(isset($this->data[$key])){ - unset($this->data[$key]); - } - } - - public function setNode(?Node $node): void - { - $this->node = $node; - } - - public function getNodeDataAssets(): Collection - { - return $this->asset_employment; - } - public function getAssetEmploymentByRole(string $role): ?AssetEmployment - { - foreach($this->asset_employment as $nda){ - if($nda->getRole() === $role){ - return $nda; - } - } - return null; - } - public function getAssetByRole(string $role): ?Asset - { - $nda = $this->getAssetEmploymentByRole($role); - if($nda === null){ - return null; - } - return $nda->getAsset() ?? null; - } - - // pour affichage page Courriels - public function getEmails(): array // appelée dans ShowEmailsBuilder - { - return $this->emails; - } - public function setEmails(array $emails): void // appelée dans Model - { - $this->emails = $emails; - } -} \ No newline at end of file diff --git a/src/model/entities/Page.php b/src/model/entities/Page.php deleted file mode 100644 index 8d3dd40..0000000 --- a/src/model/entities/Page.php +++ /dev/null @@ -1,221 +0,0 @@ -name_page = $name; - $this->end_of_path = $eop; - $this->description = $description; - $this->reachable = $reachable; - $this->in_menu = $in_menu; - $this->hidden = $hidden; - $this->position = $position; - $this->parent = $parent; - $this->children = new ArrayCollection(); - } - - // getters/setters - public function getId(): int - { - return $this->id_page; - } - public function getPageName(): string - { - return $this->name_page; - } - public function setPageName(string $name): void - { - $this->name_page = $name; - } - public function getPagePath(): string - { - return $this->page_path; - } - public function setPagePath(string $path):void - { - $this->page_path = $path; - } - public function getEndOfPath(): string - { - return $this->end_of_path; - } - public function setEndOfPath(string $end_of_path):void - { - $this->end_of_path = $end_of_path; - } - public function getDescription(): string - { - return $this->description; - } - public function setDescription(string $description): void - { - $this->description = $description; - } - - public function getCSS(): array - { - return array_merge(self::$default_css, $this->css ?? []); - } - public function addCSS(string $css): void - { - if(!in_array($css, $this->css ?? [])){ - $this->css[] = $css; - } - } - public function removeCSS(string $css): void - { - // array_diff renvoie une copie du 1er tableau alégée des élements existants aussi dans le 2è, array_values réindexe - $this->css = array_values(array_diff($this->css, [$css])); - } - public function getJS(): array - { - return array_merge(self::$default_js, $this->js ?? []); - //UPDATE `nb_page` SET `js` = NULL WHERE JSON_EQUALS(`js`, '["main"]'); - } - public function addJS(string $js): void - { - if(!in_array($js, $this->js ?? [])){ - $this->js[] = $js; - } - } - public function removeJS(string $js): void - { - $this->js = array_values(array_diff($this->js, [$js])); - } - - public function isReachable(): bool - { - return $this->reachable; - } - public function isInMenu(): bool - { - return $this->in_menu; - } - public function isHidden(): bool - { - return $this->hidden; - } - public function setHidden(bool $hidden): void - { - $this->hidden = $hidden; - } - public function getPosition(): ?int - { - return $this->position; - } - public function setPosition(int $position): void - { - $this->position = $position; - } - public function getParent(): ?Page - { - return $this->parent; - } - public function setParent(?Page $parent): void - { - $this->parent = $parent; - } - public function getChildren(): Collection - { - return $this->children; - } - - // utilisée par $menu_path - public function fillChildrenPagePath(string $parent_path = ''): void - { - $this->page_path = $parent_path != '' ? $parent_path . '/' . $this->end_of_path : $this->end_of_path; - foreach($this->getChildren() as $page){ - $page->fillChildrenPagePath($this->page_path); - } - } - - public function addChild(self $child): void - { - $this->children[] = $child; - $this->sortChildren(false); - } - public function removeChild(self $child): void - { - $this->children->removeElement($child); - $this->children = new ArrayCollection(array_values($this->children->toArray())); // réindexer en passant par un tableau - $this->sortChildren(false); - } - - public function findPageById(int $id): ?Page - { - $target = null; - foreach($this->children as $page){ - if($page->getId() === $id){ - return $page; - } - if(count($page->getChildren()) > 0){ - $target = $page->findPageById($id); - if($target !== null){ - return $target; - } - } - } - return $target; - } -} diff --git a/src/model/entities/Presentation.php b/src/model/entities/Presentation.php deleted file mode 100644 index d66bf24..0000000 --- a/src/model/entities/Presentation.php +++ /dev/null @@ -1,135 +0,0 @@ -data = $data; - $this->node = $node; - /*if(!empty($presentation) && $presentation === 'grid'){ - $this->grid_cols_min_width = 250; - } - $this->chrono_order = $chrono_order ?? null;*/ - } - - /*public function getId(): int - { - return $this->id_presentation; - }*/ - - public function setNode(?Node $node): void - { - $this->node = $node; - } - - // un trait pour ça - public function getData(): array - { - return $this->data; - } - public function updateData(string $key, string|int|bool|array $value = ''): void - { - if($value !== ''){ - $this->data[$key] = $value; - } - // si $value est vide, supprime la clé - elseif(isset($this->data[$key])){ - unset($this->data[$key]); - } - } - - // spécifique aux blocs contenant des articles - public function getPresentation(): ?string - { - return $this->presentation; - } - public function setPresentation(string $presentation): void - { - $this->presentation = $presentation; - } - public function getColsMinWidth(): int - { - $default = 320; // pixels - return $this->grid_cols_min_width === null ? $default : $this->grid_cols_min_width; - } - public function setColsMinWidth(int $columns): void - { - $this->grid_cols_min_width = $columns; - } - public function getChronoOrder(): bool - { - return $this->chrono_order ?? false; - } - public function setChronoOrder(bool $reverse_order): void - { - $this->chrono_order = $reverse_order; - } - - public function getPaginationLimit(): ?int - { - $default = 12; // si 0 pas de pagination, 12 rend bien avec des grilles de 2, 3 ou 4 colonnes - return $this->pagination_limit === null ? $default : $this->pagination_limit; - } - public function setPaginationLimit(int $pagination_limit): void - { - $this->pagination_limit = $pagination_limit; - } - public function getNumberOfPages(): int - { - return $this->nb_pages; - } - public function setNumberOfPages(int $nb_pages): void - { - $this->nb_pages = $nb_pages; - } - - - /* -- blocs et présentations disponibles dans l'application -- */ - const BLOCKS = ['post_block' => 'Articles libres', 'news_block' => 'Actualités', - //'galery' => 'Galerie', - 'calendar' => 'Calendrier', 'form' => 'Formulaire' - ]; - const PRESENTATIONS = ['fullwidth' => 'Pleine largeur', 'grid' => 'Grille', 'mosaic' => 'Mosaïque' - //, 'carousel' => 'Carrousel' - ]; - static public function hasPresentation(string $block): bool - { - return in_array($block, ['post_block', 'news_block']) ? true : false; - } -} \ No newline at end of file diff --git a/src/model/entities/User.php b/src/model/entities/User.php deleted file mode 100644 index 36bc4db..0000000 --- a/src/model/entities/User.php +++ /dev/null @@ -1,67 +0,0 @@ -login = $login; - $this->role = $role; - $this->password = $password; - } - - public function getId(): int - { - return $this->id_user; - } - - public function getLogin(): string - { - return $this->login; - } - public function setLogin(string $login): void - { - $this->login = $login; - } - public function getRole(): string - { - return $this->role; - } - public function setRole(string $role): void - { - $this->role = $role; - } - public function getPassword(): string - { - return $this->password; - } - public function setPassword(string $password): void - { - $this->password = $password; - } -} \ No newline at end of file -- cgit v1.2.3