diff options
| author | polo <ordipolo@gmx.fr> | 2026-07-12 12:35:04 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-07-12 12:35:04 +0200 |
| commit | d0c39f9c0d2724111a7b1019eacb1b675fd5fd94 (patch) | |
| tree | 546dc8520bd00eef59281b5ff786adc656fea03f /src | |
| parent | 0fa852ee4e9c3060ba7fc0daf4b08a44ea151f7f (diff) | |
| download | cms-d0c39f9c0d2724111a7b1019eacb1b675fd5fd94.tar.gz cms-d0c39f9c0d2724111a7b1019eacb1b675fd5fd94.tar.bz2 cms-d0c39f9c0d2724111a7b1019eacb1b675fd5fd94.zip | |
suppression colonnes dans NodeData, blocs et présentations dans des constantes
Diffstat (limited to 'src')
| -rw-r--r-- | src/controller/PageManagementController.php | 4 | ||||
| -rw-r--r-- | src/model/entities/NodeData.php | 58 | ||||
| -rw-r--r-- | src/model/entities/Presentation.php | 6 | ||||
| -rw-r--r-- | src/view/MainBuilder.php | 4 | ||||
| -rw-r--r-- | src/view/templates/modify_block.php | 2 |
5 files changed, 9 insertions, 65 deletions
diff --git a/src/controller/PageManagementController.php b/src/controller/PageManagementController.php index bfad474..11aab09 100644 --- a/src/controller/PageManagementController.php +++ b/src/controller/PageManagementController.php | |||
| @@ -132,7 +132,7 @@ class PageManagementController | |||
| 132 | $main = $model->getNode(); | 132 | $main = $model->getNode(); |
| 133 | $position = count($main->getChildren()) + 1; // position dans la fraterie | 133 | $position = count($main->getChildren()) + 1; // position dans la fraterie |
| 134 | 134 | ||
| 135 | if(!in_array($request->request->get("bloc_select"), array_keys(Presentation::$blocks), true)){ // 3è param: contrôle du type | 135 | if(!in_array($request->request->get("bloc_select"), array_keys(Presentation::BLOCKS), true)){ // 3è param: contrôle du type |
| 136 | // utiliser une flash error | 136 | // utiliser une flash error |
| 137 | return new RedirectResponse((string)new URL(['page' => $request->query->get('page'), 'error' => 'bad_bloc_type'])); | 137 | return new RedirectResponse((string)new URL(['page' => $request->query->get('page'), 'error' => 'bad_bloc_type'])); |
| 138 | } | 138 | } |
| @@ -311,7 +311,7 @@ class PageManagementController | |||
| 311 | $model = new Model($entityManager); | 311 | $model = new Model($entityManager); |
| 312 | $model->findNodeById($json['id']); | 312 | $model->findNodeById($json['id']); |
| 313 | 313 | ||
| 314 | if(in_array($json['presentation'], array_keys(Presentation::$presentations))){ | 314 | if(in_array($json['presentation'], array_keys(Presentation::PRESENTATIONS))){ |
| 315 | $model->getNode()->getNodeData()->setPresentation($json['presentation']); | 315 | $model->getNode()->getNodeData()->setPresentation($json['presentation']); |
| 316 | $entityManager->flush(); | 316 | $entityManager->flush(); |
| 317 | 317 | ||
diff --git a/src/model/entities/NodeData.php b/src/model/entities/NodeData.php index f6d6b01..1646c92 100644 --- a/src/model/entities/NodeData.php +++ b/src/model/entities/NodeData.php | |||
| @@ -29,18 +29,6 @@ class NodeData | |||
| 29 | #[ORM\Column(type: "json")] | 29 | #[ORM\Column(type: "json")] |
| 30 | private array $data; | 30 | private array $data; |
| 31 | 31 | ||
| 32 | #[ORM\Column(type: "string", length: 255, nullable: true)] | ||
| 33 | private ?string $presentation; | ||
| 34 | |||
| 35 | #[ORM\Column(type: "boolean", length: 255, nullable: true)] | ||
| 36 | private ?bool $chrono_order = null; | ||
| 37 | |||
| 38 | #[ORM\Column(type: "integer", nullable: true)] | ||
| 39 | private ?int $grid_cols_min_width = null; // pour le mode grille | ||
| 40 | |||
| 41 | #[ORM\Column(type: "integer", nullable: true)] | ||
| 42 | private ?int $pagination_limit = null; // pour les post_block et news_block | ||
| 43 | |||
| 44 | #[ORM\OneToMany(mappedBy: 'node_data', targetEntity: AssetEmployment::class, cascade: ['persist', 'remove'])] | 32 | #[ORM\OneToMany(mappedBy: 'node_data', targetEntity: AssetEmployment::class, cascade: ['persist', 'remove'])] |
| 45 | private Collection $asset_employment; | 33 | private Collection $asset_employment; |
| 46 | 34 | ||
| @@ -74,52 +62,6 @@ class NodeData | |||
| 74 | unset($this->data[$key]); | 62 | unset($this->data[$key]); |
| 75 | } | 63 | } |
| 76 | } | 64 | } |
| 77 | |||
| 78 | // spécifique aux blocs contenant des articles | ||
| 79 | /*public function getPresentation(): ?string | ||
| 80 | { | ||
| 81 | return $this->presentation; | ||
| 82 | } | ||
| 83 | public function setPresentation(string $presentation): void | ||
| 84 | { | ||
| 85 | $this->presentation = $presentation; | ||
| 86 | } | ||
| 87 | public function getColsMinWidth(): int | ||
| 88 | { | ||
| 89 | $default = 320; // pixels | ||
| 90 | return $this->grid_cols_min_width === null ? $default : $this->grid_cols_min_width; | ||
| 91 | } | ||
| 92 | public function setColsMinWidth(int $columns): void | ||
| 93 | { | ||
| 94 | $this->grid_cols_min_width = $columns; | ||
| 95 | } | ||
| 96 | public function getChronoOrder(): bool | ||
| 97 | { | ||
| 98 | return $this->chrono_order ?? false; | ||
| 99 | } | ||
| 100 | public function setChronoOrder(bool $reverse_order): void | ||
| 101 | { | ||
| 102 | $this->chrono_order = $reverse_order; | ||
| 103 | } | ||
| 104 | |||
| 105 | public function getPaginationLimit(): ?int | ||
| 106 | { | ||
| 107 | $default = 12; // si 0 pas de pagination, 12 rend bien avec des grilles de 2, 3 ou 4 colonnes | ||
| 108 | return $this->pagination_limit === null ? $default : $this->pagination_limit; | ||
| 109 | } | ||
| 110 | public function setPaginationLimit(int $pagination_limit): void | ||
| 111 | { | ||
| 112 | $this->pagination_limit = $pagination_limit; | ||
| 113 | } | ||
| 114 | private int $nb_pages = 1; | ||
| 115 | public function getNumberOfPages(): int | ||
| 116 | { | ||
| 117 | return $this->nb_pages; | ||
| 118 | } | ||
| 119 | public function setNumberOfPages(int $nb_pages): void | ||
| 120 | { | ||
| 121 | $this->nb_pages = $nb_pages; | ||
| 122 | }*/ | ||
| 123 | 65 | ||
| 124 | public function setNode(?Node $node): void | 66 | public function setNode(?Node $node): void |
| 125 | { | 67 | { |
diff --git a/src/model/entities/Presentation.php b/src/model/entities/Presentation.php index 912c19e..d66bf24 100644 --- a/src/model/entities/Presentation.php +++ b/src/model/entities/Presentation.php | |||
| @@ -119,11 +119,13 @@ class Presentation{ | |||
| 119 | $this->nb_pages = $nb_pages; | 119 | $this->nb_pages = $nb_pages; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | static public array $blocks = ['post_block' => 'Articles libres', 'news_block' => 'Actualités', | 122 | |
| 123 | /* -- blocs et présentations disponibles dans l'application -- */ | ||
| 124 | const BLOCKS = ['post_block' => 'Articles libres', 'news_block' => 'Actualités', | ||
| 123 | //'galery' => 'Galerie', | 125 | //'galery' => 'Galerie', |
| 124 | 'calendar' => 'Calendrier', 'form' => 'Formulaire' | 126 | 'calendar' => 'Calendrier', 'form' => 'Formulaire' |
| 125 | ]; | 127 | ]; |
| 126 | static public array $presentations = ['fullwidth' => 'Pleine largeur', 'grid' => 'Grille', 'mosaic' => 'Mosaïque' | 128 | const PRESENTATIONS = ['fullwidth' => 'Pleine largeur', 'grid' => 'Grille', 'mosaic' => 'Mosaïque' |
| 127 | //, 'carousel' => 'Carrousel' | 129 | //, 'carousel' => 'Carrousel' |
| 128 | ]; | 130 | ]; |
| 129 | static public function hasPresentation(string $block): bool | 131 | static public function hasPresentation(string $block): bool |
diff --git a/src/view/MainBuilder.php b/src/view/MainBuilder.php index b888a56..1df5846 100644 --- a/src/view/MainBuilder.php +++ b/src/view/MainBuilder.php | |||
| @@ -56,7 +56,7 @@ class MainBuilder extends AbstractBuilder | |||
| 56 | private function viewEditBlocks(Node $node): void | 56 | private function viewEditBlocks(Node $node): void |
| 57 | { | 57 | { |
| 58 | $options = ''; | 58 | $options = ''; |
| 59 | foreach(Presentation::$blocks as $key => $value){ | 59 | foreach(Presentation::BLOCKS as $key => $value){ |
| 60 | $options .= '<option value= "' . $key . '">' . $value . "</option>\n"; | 60 | $options .= '<option value= "' . $key . '">' . $value . "</option>\n"; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| @@ -87,7 +87,7 @@ class MainBuilder extends AbstractBuilder | |||
| 87 | private function makePresentationOptions(string $presentation): string | 87 | private function makePresentationOptions(string $presentation): string |
| 88 | { | 88 | { |
| 89 | $options = ''; | 89 | $options = ''; |
| 90 | foreach(Presentation::$presentations as $key => $value){ | 90 | foreach(Presentation::PRESENTATIONS as $key => $value){ |
| 91 | $options .= '<option value="' . $key . '" ' . ($presentation === $key ? 'selected' : '') . '>' . $value . '</option>'; | 91 | $options .= '<option value="' . $key . '" ' . ($presentation === $key ? 'selected' : '') . '>' . $value . '</option>'; |
| 92 | } | 92 | } |
| 93 | return $options; | 93 | return $options; |
diff --git a/src/view/templates/modify_block.php b/src/view/templates/modify_block.php index 1da3176..e966ee3 100644 --- a/src/view/templates/modify_block.php +++ b/src/view/templates/modify_block.php | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | <?php declare(strict_types=1); ?> | 1 | <?php declare(strict_types=1); ?> |
| 2 | <div class="modify_one_block" id="bloc_edit_<?= $child_node->getId() ?>"> | 2 | <div class="modify_one_block" id="bloc_edit_<?= $child_node->getId() ?>"> |
| 3 | <div class="block_options"> | 3 | <div class="block_options"> |
| 4 | <label for="bloc_rename_<?= $child_node->getId() ?>">Type <b><?= App\Entity\Presentation::$blocks[$child_node->getName()] ?? '<i>erreur base de données</i>' ?></b> | 4 | <label for="bloc_rename_<?= $child_node->getId() ?>">Type <b><?= App\Entity\Presentation::BLOCKS[$child_node->getName()] ?? '<i>erreur base de données</i>' ?></b> |
| 5 | </label> | 5 | </label> |
| 6 | <p> | 6 | <p> |
| 7 | <input type="text" id="bloc_rename_<?= $child_node->getId() ?>" name="bloc_rename_title" value="<?= $child_node->getNodeData()->getdata()['title'] ?>" required> | 7 | <input type="text" id="bloc_rename_<?= $child_node->getId() ?>" name="bloc_rename_title" value="<?= $child_node->getNodeData()->getdata()['title'] ?>" required> |
