From 0fa852ee4e9c3060ba7fc0daf4b08a44ea151f7f Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 2 Jul 2026 00:01:31 +0200 Subject: =?UTF-8?q?entit=C3=A9=20Presentation,=20MAJ=20filtre=20ViewContro?= =?UTF-8?q?ller::SPECIAL=5FPAGES,=20table=20node=5Fdata=20non=20all=C3=A9g?= =?UTF-8?q?=C3=A9e=20pour=20l'instant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/entities/Presentation.php | 133 ++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 src/model/entities/Presentation.php (limited to 'src/model/entities/Presentation.php') diff --git a/src/model/entities/Presentation.php b/src/model/entities/Presentation.php new file mode 100644 index 0000000..912c19e --- /dev/null +++ b/src/model/entities/Presentation.php @@ -0,0 +1,133 @@ +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; + } + + static public array $blocks = ['post_block' => 'Articles libres', 'news_block' => 'Actualités', + //'galery' => 'Galerie', + 'calendar' => 'Calendrier', 'form' => 'Formulaire' + ]; + static public array $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 -- cgit v1.2.3