diff options
| author | polo <ordipolo@gmx.fr> | 2025-08-26 01:15:33 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-08-26 01:15:33 +0200 |
| commit | f4df3e9b9df3d54ce58796f923da70ff7e566018 (patch) | |
| tree | bbd037099976d0411533823b26a34949d04f286c /src/model/Blocks.php | |
| parent | b02b44d1da7e9ddd7a341d29a597accfbb78155c (diff) | |
| download | cms-f4df3e9b9df3d54ce58796f923da70ff7e566018.tar.gz cms-f4df3e9b9df3d54ce58796f923da70ff7e566018.tar.bz2 cms-f4df3e9b9df3d54ce58796f923da70ff7e566018.zip | |
séparation bloc / mise en page, bloc spécial pour les actus, renommage de classes, fichiers, etc
Diffstat (limited to 'src/model/Blocks.php')
| -rw-r--r-- | src/model/Blocks.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/model/Blocks.php b/src/model/Blocks.php new file mode 100644 index 0000000..f6475cd --- /dev/null +++ b/src/model/Blocks.php | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | <?php | ||
| 2 | // src/Blocks.php | ||
| 3 | |||
| 4 | class Blocks{ | ||
| 5 | /*private array $types = ['blog', 'grid', 'calendar', 'galery', 'form'];*/ | ||
| 6 | static private array $types = ['post_block', 'news_block', 'calendar', 'galery', 'form']; | ||
| 7 | |||
| 8 | /*private array $names = ['Blog', 'Grille', 'Calendrier', 'Galerie', 'Formulaire'];*/ | ||
| 9 | static private array $names = ['Articles libres', 'Actualités', 'Calendrier', 'Galerie', 'Formulaire']; | ||
| 10 | |||
| 11 | static public function getNameList(): array | ||
| 12 | { | ||
| 13 | $blocks = []; | ||
| 14 | foreach(self::$types as $type){ | ||
| 15 | $blocks[] = $type; | ||
| 16 | } | ||
| 17 | return $blocks; | ||
| 18 | } | ||
| 19 | |||
| 20 | static public function getTypeNamePairs(): array | ||
| 21 | { | ||
| 22 | $blocks = []; | ||
| 23 | for($i = 0; $i < count(self::$types); $i++){ | ||
| 24 | $blocks[] = ['type' => self::$types[$i], 'name' => self::$names[$i]]; | ||
| 25 | } | ||
| 26 | return $blocks; | ||
| 27 | } | ||
| 28 | |||
| 29 | static public function getNameFromType(string $type): string | ||
| 30 | { | ||
| 31 | for($i=0; $i < count(self::$types); $i++){ | ||
| 32 | if(self::$types[$i] === $type){ | ||
| 33 | return self::$names[$i]; | ||
| 34 | } | ||
| 35 | } | ||
| 36 | return 'server side error'; | ||
| 37 | } | ||
| 38 | } \ No newline at end of file | ||
