From 2afdde9749eeface10ceca832eb7f8ff8d32de3c Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 2 Mar 2022 01:10:29 +0100 Subject: Affichage et page archives --- controller/admin.php | 44 ++++++++++++-------------------------------- controller/visitor.php | 33 +++++++-------------------------- 2 files changed, 19 insertions(+), 58 deletions(-) (limited to 'controller') 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 @@ function pageArticlesSimplesAdmin(string $page, string $title, string $headerPaintedTitle, $fileCode, int $suppression) { - $headerImage = '
'; + if($page == 'archives') + { + $headerImage = '
+
hello
+
+
'; + } + else + { + $headerImage = '
'; + } // infos sur les fichiers $Articles = new Article($page); @@ -210,40 +220,10 @@ function discoEdit($fileCode, $suppression) $fileCodeArgument = ''; } - // préremplir le champ - // c'est normallement impossible - - - // tri des albums avec l'année dans le .json - - // noms des fichiers JSON - //$albumNamesJSON = $Albums->fileList; - //$annees = []; - //for($i = 0; $i < $Albums->fileListCount; $i++) - //{ - // une case supplémentaire contient le "fileCode" - //$albumsJSON[$i][3] = pathinfo($albumNamesJSON[$i])['filename']; - //$albumsJSON[$i][3] = pathinfo($Albums->fileList[$i]['fileCode'])['filename']; - - //$annees[$i] = $albumsJSON[$i][1]; - //} - //var_dump($annee); die(); - - // tri d'un tableau multidimensionnel - //array_multisort($annees, $albumsJSON); - - - - // liens dans la page et le menu chronologie - // ce dernier comporte une ancre lorsque le html n'existe pas - /*$lienAlbum = []; - $avecLien = []; - $linkDiscoChrono = [];*/ for($i = 0; $i < $Albums->fileListCount; $i++) { if(file_exists('data/discographie/html/' . $Albums->fileList[$i]['fileCode'] . '.html')) { - /*$lienAlbum[$i] = 'page=album&album_name=' . $Albums->fileList[$i]['titre'] . '&file_code=' . $Albums->fileList[$i]['fileCode'];*/ $lienAlbum[$i] = 'page=album&file_code=' . $Albums->fileList[$i]['fileCode']; $avecLien[$i] = true; $linkDiscoChrono[$i] = 'linkChrono'; // css @@ -254,7 +234,7 @@ function discoEdit($fileCode, $suppression) $avecLien[$i] = false; $linkDiscoChrono[$i] = 'noLinkChrono'; // css } - $lienBoutonModif[$i] = 'page=discographie&action=edition&file_code=' . $Albums->fileList[$i]['fileCode']; + $lienBoutonModif[$i] = 'page=discographie&action=edition&file_code=' . $Albums->fileList[$i]['fileCode'] . '#' . $Albums->fileList[$i]['fileCode']; } // 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() // toutes celles du menu sauf: menu et discographie function pageArticlesSimplesVisitor(string $page, string $title, string $headerPaintedTitle) { - $headerImage = '
'; - // infos sur les fichiers $Articles->fileList $Articles = new Article($page); @@ -47,7 +45,7 @@ function pageArticlesSimplesVisitor(string $page, string $title, string $headerP $Articles->fileList = array_reverse($Articles->fileList); } - // variables $css, $js, $header et $content + // variables $css, $js, $header, $content et $headerImage require('view/pageArticlesSimples.php'); // HTML require('view/template.php'); @@ -122,43 +120,22 @@ function discoVisitor() } //var_dump($Albums->fileList); die(); - - // tri des albums avec l'année dans le .json - - // noms des fichiers JSON - //$albumNamesJSON = $Albums->fileList; - - //$annees = []; - for($i = 0; $i < $Albums->fileListCount; $i++) - {} - //var_dump($annee); die(); - - // tri d'un tableau multidimensionnel - //array_multisort($annees, $albumsJSON); - - - // lien vers le HTML ou ancre? - /*$lienAlbum = []; - $avecLien = []; - $linkDiscoChrono = [];*/ - // liens vers les albums for($i = 0; $i < $Albums->fileListCount; $i++) { if(file_exists('data/discographie/html/' . $Albums->fileList[$i]['fileCode'] . '.html')) { - /*$lienAlbum[$i] = 'page=album&album_name=' . $Albums->fileList[$i]['titre'] . '&file_code=' . $Albums->fileList[$i]['fileCode'];*/ $lienAlbum[$i] = 'page=album&file_code=' . $Albums->fileList[$i]['fileCode']; $avecLien[$i] = true; $linkDiscoChrono[$i] = 'linkChrono'; // pour le css } else { - $lienAlbum[$i] = 'page=discographie#' . $Albums->fileList[$i]['titre']; + $lienAlbum[$i] = 'page=discographie#' . $Albums->fileList[$i]['fileCode']; $avecLien[$i] = false; $linkDiscoChrono[$i] = 'noLinkChrono'; // pour le css } - $lienBoutonModif[$i] = 'page=discographie&action=edition&file_code=' . $Albums->fileList[$i]['fileCode']; + $lienBoutonModif[$i] = 'page=discographie&action=edition&file_code=' . $Albums->fileList[$i]['fileCode'] . '#' . $Albums->fileList[$i]['fileCode']; } // variables $css, $js et $content @@ -174,6 +151,10 @@ function album($fileCode) $Albums = new Album($page); $Albums->getAllJSON(); + if(!empty($Albums->fileList)) + { + $Albums->fileList = array_reverse($Albums->fileList); + } $Albums->fileCode = $fileCode; $Albums->readOne(); -- cgit v1.2.3