summaryrefslogtreecommitdiff
path: root/controller
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2022-03-02 01:10:29 +0100
committerpolo <ordipolo@gmx.fr>2022-03-02 01:10:29 +0100
commit2afdde9749eeface10ceca832eb7f8ff8d32de3c (patch)
treec0e14c238fa8c60897919afabe6f6ef7ba69a2d1 /controller
parent2ac4254829fb27d878044978e4e89f15eeeddd23 (diff)
downloadmelaine-2afdde9749eeface10ceca832eb7f8ff8d32de3c.zip
Affichage et page archives
Diffstat (limited to 'controller')
-rw-r--r--controller/admin.php44
-rw-r--r--controller/visitor.php33
2 files changed, 19 insertions, 58 deletions
diff --git a/controller/admin.php b/controller/admin.php
index ee5c217..5e3cde7 100644
--- a/controller/admin.php
+++ b/controller/admin.php
@@ -6,7 +6,17 @@
6 6
7function pageArticlesSimplesAdmin(string $page, string $title, string $headerPaintedTitle, $fileCode, int $suppression) 7function pageArticlesSimplesAdmin(string $page, string $title, string $headerPaintedTitle, $fileCode, int $suppression)
8{ 8{
9 $headerImage = '<div class="photo" id="photo_' . $page . '" ></div>'; 9 if($page == 'archives')
10 {
11 $headerImage = '<div style="display: flex;" >
12 <div>hello</div>
13 <div class="photo" id="photo_' . $page . '" ></div>
14 </div>';
15 }
16 else
17 {
18 $headerImage = '<div class="photo" id="photo_' . $page . '" ></div>';
19 }
10 20
11 // infos sur les fichiers 21 // infos sur les fichiers
12 $Articles = new Article($page); 22 $Articles = new Article($page);
@@ -210,40 +220,10 @@ function discoEdit($fileCode, $suppression)
210 $fileCodeArgument = ''; 220 $fileCodeArgument = '';
211 } 221 }
212 222
213 // préremplir le champ <input type="file" >
214 // c'est normallement impossible
215
216
217 // tri des albums avec l'année dans le .json
218
219 // noms des fichiers JSON
220 //$albumNamesJSON = $Albums->fileList;
221 //$annees = [];
222 //for($i = 0; $i < $Albums->fileListCount; $i++)
223 //{
224 // une case supplémentaire contient le "fileCode"
225 //$albumsJSON[$i][3] = pathinfo($albumNamesJSON[$i])['filename'];
226 //$albumsJSON[$i][3] = pathinfo($Albums->fileList[$i]['fileCode'])['filename'];
227
228 //$annees[$i] = $albumsJSON[$i][1];
229 //}
230 //var_dump($annee); die();
231
232 // tri d'un tableau multidimensionnel
233 //array_multisort($annees, $albumsJSON);
234
235
236
237 // liens dans la page et le menu chronologie
238 // ce dernier comporte une ancre lorsque le html n'existe pas
239 /*$lienAlbum = [];
240 $avecLien = [];
241 $linkDiscoChrono = [];*/
242 for($i = 0; $i < $Albums->fileListCount; $i++) 223 for($i = 0; $i < $Albums->fileListCount; $i++)
243 { 224 {
244 if(file_exists('data/discographie/html/' . $Albums->fileList[$i]['fileCode'] . '.html')) 225 if(file_exists('data/discographie/html/' . $Albums->fileList[$i]['fileCode'] . '.html'))
245 { 226 {
246 /*$lienAlbum[$i] = 'page=album&album_name=' . $Albums->fileList[$i]['titre'] . '&file_code=' . $Albums->fileList[$i]['fileCode'];*/
247 $lienAlbum[$i] = 'page=album&file_code=' . $Albums->fileList[$i]['fileCode']; 227 $lienAlbum[$i] = 'page=album&file_code=' . $Albums->fileList[$i]['fileCode'];
248 $avecLien[$i] = true; 228 $avecLien[$i] = true;
249 $linkDiscoChrono[$i] = 'linkChrono'; // css 229 $linkDiscoChrono[$i] = 'linkChrono'; // css
@@ -254,7 +234,7 @@ function discoEdit($fileCode, $suppression)
254 $avecLien[$i] = false; 234 $avecLien[$i] = false;
255 $linkDiscoChrono[$i] = 'noLinkChrono'; // css 235 $linkDiscoChrono[$i] = 'noLinkChrono'; // css
256 } 236 }
257 $lienBoutonModif[$i] = 'page=discographie&action=edition&file_code=' . $Albums->fileList[$i]['fileCode']; 237 $lienBoutonModif[$i] = 'page=discographie&action=edition&file_code=' . $Albums->fileList[$i]['fileCode'] . '#' . $Albums->fileList[$i]['fileCode'];
258 } 238 }
259 239
260 // morceaux en HTML à assembler 240 // morceaux en HTML à assembler
diff --git a/controller/visitor.php b/controller/visitor.php
index aae15a7..ac19441 100644
--- a/controller/visitor.php
+++ b/controller/visitor.php
@@ -30,8 +30,6 @@ function menu()
30// toutes celles du menu sauf: menu et discographie 30// toutes celles du menu sauf: menu et discographie
31function pageArticlesSimplesVisitor(string $page, string $title, string $headerPaintedTitle) 31function pageArticlesSimplesVisitor(string $page, string $title, string $headerPaintedTitle)
32{ 32{
33 $headerImage = '<div class="photo" id="photo_' . $page . '" ></div>';
34
35 // infos sur les fichiers $Articles->fileList 33 // infos sur les fichiers $Articles->fileList
36 $Articles = new Article($page); 34 $Articles = new Article($page);
37 35
@@ -47,7 +45,7 @@ function pageArticlesSimplesVisitor(string $page, string $title, string $headerP
47 $Articles->fileList = array_reverse($Articles->fileList); 45 $Articles->fileList = array_reverse($Articles->fileList);
48 } 46 }
49 47
50 // variables $css, $js, $header et $content 48 // variables $css, $js, $header, $content et $headerImage
51 require('view/pageArticlesSimples.php'); 49 require('view/pageArticlesSimples.php');
52 // HTML 50 // HTML
53 require('view/template.php'); 51 require('view/template.php');
@@ -122,43 +120,22 @@ function discoVisitor()
122 } 120 }
123 //var_dump($Albums->fileList); die(); 121 //var_dump($Albums->fileList); die();
124 122
125
126 // tri des albums avec l'année dans le .json
127
128 // noms des fichiers JSON
129 //$albumNamesJSON = $Albums->fileList;
130
131 //$annees = [];
132 for($i = 0; $i < $Albums->fileListCount; $i++)
133 {}
134 //var_dump($annee); die();
135
136 // tri d'un tableau multidimensionnel
137 //array_multisort($annees, $albumsJSON);
138
139
140 // lien vers le HTML ou ancre?
141 /*$lienAlbum = [];
142 $avecLien = [];
143 $linkDiscoChrono = [];*/
144
145 // liens vers les albums 123 // liens vers les albums
146 for($i = 0; $i < $Albums->fileListCount; $i++) 124 for($i = 0; $i < $Albums->fileListCount; $i++)
147 { 125 {
148 if(file_exists('data/discographie/html/' . $Albums->fileList[$i]['fileCode'] . '.html')) 126 if(file_exists('data/discographie/html/' . $Albums->fileList[$i]['fileCode'] . '.html'))
149 { 127 {
150 /*$lienAlbum[$i] = 'page=album&album_name=' . $Albums->fileList[$i]['titre'] . '&file_code=' . $Albums->fileList[$i]['fileCode'];*/
151 $lienAlbum[$i] = 'page=album&file_code=' . $Albums->fileList[$i]['fileCode']; 128 $lienAlbum[$i] = 'page=album&file_code=' . $Albums->fileList[$i]['fileCode'];
152 $avecLien[$i] = true; 129 $avecLien[$i] = true;
153 $linkDiscoChrono[$i] = 'linkChrono'; // pour le css 130 $linkDiscoChrono[$i] = 'linkChrono'; // pour le css
154 } 131 }
155 else 132 else
156 { 133 {
157 $lienAlbum[$i] = 'page=discographie#' . $Albums->fileList[$i]['titre']; 134 $lienAlbum[$i] = 'page=discographie#' . $Albums->fileList[$i]['fileCode'];
158 $avecLien[$i] = false; 135 $avecLien[$i] = false;
159 $linkDiscoChrono[$i] = 'noLinkChrono'; // pour le css 136 $linkDiscoChrono[$i] = 'noLinkChrono'; // pour le css
160 } 137 }
161 $lienBoutonModif[$i] = 'page=discographie&action=edition&file_code=' . $Albums->fileList[$i]['fileCode']; 138 $lienBoutonModif[$i] = 'page=discographie&action=edition&file_code=' . $Albums->fileList[$i]['fileCode'] . '#' . $Albums->fileList[$i]['fileCode'];
162 } 139 }
163 140
164 // variables $css, $js et $content 141 // variables $css, $js et $content
@@ -174,6 +151,10 @@ function album($fileCode)
174 151
175 $Albums = new Album($page); 152 $Albums = new Album($page);
176 $Albums->getAllJSON(); 153 $Albums->getAllJSON();
154 if(!empty($Albums->fileList))
155 {
156 $Albums->fileList = array_reverse($Albums->fileList);
157 }
177 $Albums->fileCode = $fileCode; 158 $Albums->fileCode = $fileCode;
178 $Albums->readOne(); 159 $Albums->readOne();
179 160