diff options
author | polo <ordipolo@gmx.fr> | 2025-10-19 14:24:00 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2025-10-19 14:24:00 +0200 |
commit | 61a907785d9382adeb2de05b4b080de1d270f6d0 (patch) | |
tree | a29ba877c4ac2e50ec04445726c3e0c464cea2c7 /src | |
parent | c9aa2be60924fc32c2d3d4f62596ed7c786fe3c1 (diff) | |
download | cms-61a907785d9382adeb2de05b4b080de1d270f6d0.zip |
suppression champ file_path_mini dans Asset, nettoyage divers, résolution bug quand pas d'image de fond
Diffstat (limited to 'src')
-rw-r--r-- | src/installation.php | 12 | ||||
-rw-r--r-- | src/model/entities/Asset.php | 12 | ||||
-rw-r--r-- | src/model/entities/Node.php | 19 | ||||
-rw-r--r-- | src/view/HeaderBuilder.php | 8 | ||||
-rw-r--r-- | src/view/templates/header.php | 2 |
5 files changed, 16 insertions, 37 deletions
diff --git a/src/installation.php b/src/installation.php index e0314a5..7fff5f7 100644 --- a/src/installation.php +++ b/src/installation.php | |||
@@ -118,11 +118,13 @@ function makeStartPage(EntityManager $entityManager){ | |||
118 | 118 | ||
119 | /* -- table asset -- */ | 119 | /* -- table asset -- */ |
120 | // paramètres: file_name, file_path, file_path_mini, mime_type, alt | 120 | // paramètres: file_name, file_path, file_path_mini, mime_type, alt |
121 | $favicon = new Asset("favicon48x48.png", NULL, "assets/favicon48x48.png", "image/png", "favicon"); | 121 | $favicon = new Asset("favicon48x48.png", "assets/favicon48x48.png", "image/png", "favicon"); |
122 | $facebook = new Asset("facebook.svg", NULL, "assets/facebook.svg", "image/svg+xml", "facebook"); | 122 | $background = new Asset("fond-piscine.jpg", "assets/fond-piscine.jpg", "image/jpeg", "background"); |
123 | $instagram = new Asset("instagram.svg", NULL, "assets/instagram.svg", "image/svg+xml", "instagram"); | 123 | $logo = new Asset("logo-nb-et-ffn.png", "assets/logo-nb-et-ffn.png", "image/png", "logo"); |
124 | $linkedin = new Asset("linkedin.svg", NULL, "assets/linkedin.svg", "image/svg+xml", "linkedin"); | 124 | $facebook = new Asset("facebook.svg", "assets/facebook.svg", "image/svg+xml", "facebook"); |
125 | $github = new Asset("github.svg", NULL, "assets/github.svg", "image/svg+xml", "github"); | 125 | $instagram = new Asset("instagram.svg", "assets/instagram.svg", "image/svg+xml", "instagram"); |
126 | $linkedin = new Asset("linkedin.svg", "assets/linkedin.svg", "image/svg+xml", "linkedin"); | ||
127 | $github = new Asset("github.svg", "assets/github.svg", "image/svg+xml", "github"); | ||
126 | 128 | ||
127 | /* -- table node_data -- */ | 129 | /* -- table node_data -- */ |
128 | // paramètres: data, node, images | 130 | // paramètres: data, node, images |
diff --git a/src/model/entities/Asset.php b/src/model/entities/Asset.php index df8c98b..e1071b4 100644 --- a/src/model/entities/Asset.php +++ b/src/model/entities/Asset.php | |||
@@ -19,13 +19,10 @@ class Asset | |||
19 | #[ORM\Column(type: "string", length: 255, unique: true)] // nom d'image UNIQUE | 19 | #[ORM\Column(type: "string", length: 255, unique: true)] // nom d'image UNIQUE |
20 | private string $file_name; | 20 | private string $file_name; |
21 | 21 | ||
22 | // choisir un répertoire du genre /var/www/html/uploads/ de préférence hors de /src | 22 | // choisir un répertoire du genre /var/www/html/uploads/, au moins hors de /src |
23 | #[ORM\Column(type: "string", length: 255, unique: true, nullable: true)] | 23 | #[ORM\Column(type: "string", length: 255, unique: true, nullable: true)] |
24 | private ?string $file_path; | 24 | private ?string $file_path; |
25 | 25 | ||
26 | #[ORM\Column(type: "string", length: 255, unique: true, nullable: true)] | ||
27 | private ?string $file_path_mini; | ||
28 | |||
29 | #[ORM\Column(type: "string", length: 255, nullable: true)] | 26 | #[ORM\Column(type: "string", length: 255, nullable: true)] |
30 | private string $mime_type; // image/jpeg, image/png, etc | 27 | private string $mime_type; // image/jpeg, image/png, etc |
31 | 28 | ||
@@ -44,11 +41,10 @@ class Asset | |||
44 | #[ORM\ManyToMany(targetEntity: NodeData::class, mappedBy: "assets")] | 41 | #[ORM\ManyToMany(targetEntity: NodeData::class, mappedBy: "assets")] |
45 | private $node_data; | 42 | private $node_data; |
46 | 43 | ||
47 | public function __construct(string $name, ?string $path, ?string $path_mini, string $mime_type, string $alt) | 44 | public function __construct(string $name, ?string $path, string $mime_type, string $alt) |
48 | { | 45 | { |
49 | $this->file_name = $name; | 46 | $this->file_name = $name; |
50 | $this->file_path = $path; | 47 | $this->file_path = $path; |
51 | $this->file_path_mini = $path_mini; | ||
52 | $this->mime_type = $mime_type; | 48 | $this->mime_type = $mime_type; |
53 | $this->alt = $alt; | 49 | $this->alt = $alt; |
54 | } | 50 | } |
@@ -61,10 +57,6 @@ class Asset | |||
61 | { | 57 | { |
62 | return $this->file_path; | 58 | return $this->file_path; |
63 | } | 59 | } |
64 | public function getFilePathMini(): string | ||
65 | { | ||
66 | return $this->file_path_mini; | ||
67 | } | ||
68 | public function getAlt(): string | 60 | public function getAlt(): string |
69 | { | 61 | { |
70 | return $this->alt; | 62 | return $this->alt; |
diff --git a/src/model/entities/Node.php b/src/model/entities/Node.php index 76ef74b..2034b3d 100644 --- a/src/model/entities/Node.php +++ b/src/model/entities/Node.php | |||
@@ -176,25 +176,6 @@ class Node | |||
176 | $this->sortChildren(false); | 176 | $this->sortChildren(false); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | |||
180 | // remplacée par "ORDER BY a.date_time" en DQL | ||
181 | /*private function sortNews(bool $chrono = false) // affichage du plus récent au plus ancien par défaut | ||
182 | { | ||
183 | // tri par insertion similaire à Position::sortChildren | ||
184 | for($i = 1; $i < count($this->children); $i++){ | ||
185 | $tmp = $this->children[$i]; | ||
186 | $j = $i - 1; | ||
187 | |||
188 | $compare = $chrono ? fn($a, $b) => $a > $b : fn($a, $b) => $a < $b; | ||
189 | |||
190 | while($j >= 0 && $compare($this->children[$j]->getArticle()->getDateTime(), $tmp->getArticle()->getDateTime())){ | ||
191 | $this->children[$j + 1] = $this->children[$j]; | ||
192 | $j--; | ||
193 | } | ||
194 | $this->children[$j + 1] = $tmp; | ||
195 | } | ||
196 | }*/ | ||
197 | |||
198 | public function removeChild(self $child): void | 179 | public function removeChild(self $child): void |
199 | { | 180 | { |
200 | foreach($this->children as $key => $object){ | 181 | foreach($this->children as $key => $object){ |
diff --git a/src/view/HeaderBuilder.php b/src/view/HeaderBuilder.php index 46a74a8..1b60bc9 100644 --- a/src/view/HeaderBuilder.php +++ b/src/view/HeaderBuilder.php | |||
@@ -50,7 +50,10 @@ class HeaderBuilder extends AbstractBuilder | |||
50 | // réseaux sociaux + logo dans l'entête | 50 | // réseaux sociaux + logo dans l'entête |
51 | $keys = array_keys($social); | 51 | $keys = array_keys($social); |
52 | $social_networks = ''; | 52 | $social_networks = ''; |
53 | $head_logo = ''; | 53 | //$header_logo; |
54 | //$header_background; | ||
55 | |||
56 | // nécéssite des entrées dans la table node_asset | ||
54 | /*foreach($node->getNodeData()->getAssets() as $asset) | 57 | /*foreach($node->getNodeData()->getAssets() as $asset) |
55 | { | 58 | { |
56 | for($i = 0; $i < count($keys); $i++) | 59 | for($i = 0; $i < count($keys); $i++) |
@@ -73,7 +76,8 @@ class HeaderBuilder extends AbstractBuilder | |||
73 | //} | 76 | //} |
74 | } | 77 | } |
75 | }*/ | 78 | }*/ |
76 | // chemin du ficher dans node_data, à déplacer dans asset | 79 | |
80 | // réseaux sociaux, chemin du ficher dans node_data à déplacer dans asset | ||
77 | foreach($keys as $one_key){ | 81 | foreach($keys as $one_key){ |
78 | $social_networks .= '<a href="' . $social[$one_key] . '" target="_blank" rel="noopener noreferrer"> | 82 | $social_networks .= '<a href="' . $social[$one_key] . '" target="_blank" rel="noopener noreferrer"> |
79 | <img src="assets/' . $one_key . '.svg" alt="' . $one_key . '_alt"></a>'; | 83 | <img src="assets/' . $one_key . '.svg" alt="' . $one_key . '_alt"></a>'; |
diff --git a/src/view/templates/header.php b/src/view/templates/header.php index 47d4874..d419a12 100644 --- a/src/view/templates/header.php +++ b/src/view/templates/header.php | |||
@@ -1,7 +1,7 @@ | |||
1 | <?php declare(strict_types=1); ?> | 1 | <?php declare(strict_types=1); ?> |
2 | <body> | 2 | <body> |
3 | <div> | 3 | <div> |
4 | <header style="background-image: url('<?= $header_background ?>');"> | 4 | <header style="background-image: url('<?= $header_background ?? '' ?>');"> |
5 | <div id="nav_zone"> | 5 | <div id="nav_zone"> |
6 | <?= $nav ?> | 6 | <?= $nav ?> |
7 | </div> | 7 | </div> |