From 787d03e48471ba62cd830379428f04d996f0b74b Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 17 Feb 2022 18:13:00 +0100 Subject: model update --- controller/visitor.php | 275 ++++++++++++++++++++++++++----------------------- 1 file changed, 145 insertions(+), 130 deletions(-) (limited to 'controller/visitor.php') diff --git a/controller/visitor.php b/controller/visitor.php index 6c6146b..6044676 100644 --- a/controller/visitor.php +++ b/controller/visitor.php @@ -1,131 +1,146 @@ -readAll()); // lourd - - // variables $css, $js, $header et $content - require('view/melaine.php'); - // HTML - require('view/template.php'); -} - -function discoVisitor() -{ - $page_actuelle = "discographie"; - $title = "Discographie"; - - // modèle - $Albums = new Album($page_actuelle); - $Albums->makeFileList(); - - // contenu de tous les fichiers JSON (= tableau de chaines) - $albumsJSON = $Albums->readAll(); - // noms des fichiers JSON - $albumNamesJSON = $Albums->fileList; - - $annees = []; - for($i = 0; $i < count($albumsJSON); $i++) - { - // une case supplémentaire contient le "albumCode" - $albumsJSON[$i][3] = pathinfo($albumNamesJSON[$i])['filename']; - - $annees[$i] = $albumsJSON[$i][1]; - } - - // tri d'un tableau multidimensionnel - array_multisort($annees, $albumsJSON); - - // lien vers le HTML ou ancre? - $lienAlbum = []; - $avecLien = []; - $linkDiscoChrono = []; - for($i = 0; $i < count($albumsJSON); $i++) - { - // cas particulier où le dossier "html" est vide - if(!empty($Albums->fileList)) - { - if(file_exists('data/discographie/html/' . $albumsJSON[$i][3] . '.html')) - { - $lienAlbum[$i] = 'page=album&album_name=' . $albumsJSON[$i][0] . '&album_code=' . $albumsJSON[$i][3]; - $avecLien[$i] = true; - $linkDiscoChrono[$i] = 'linkChrono'; // css - } - else - { - $lienAlbum[$i] = 'page=discographie#' . $albumsJSON[$i][0]; - $avecLien[$i] = false; - $linkDiscoChrono[$i] = 'noLinkChrono'; // css - } - $lienBoutonModif[$i] = 'page=discographie&action=edition&album_code=' . $albumsJSON[$i][3]; - } - } - - // variables $css, $js et $content - require('view/discographie.php'); - // fin de l'assemblage - require('view/template.php'); -} - -// page d'un album -function album($albumCode, $albumName) -{ - $page_actuelle = 'discographie'; - $title = $albumName; - - $album = Album::readOneHTML($albumCode); // simple, efficace - - // variables $css, $header et $content - require('view/album.php'); - // HTML - require('view/template.php'); -} - -function presse() -{} - -function ateliers() -{} - -function liens() -{} - -function peinture() -{} - -function archives() +fileList[$i]['date']); + //getdate($Albums->fileList[$i]['fileCode']); + + // ajout des données dans $Articles->fileList['content'] + if(!empty($Articles->fileList)) + { + $Articles->readAll(); + $Articles->fileList = array_reverse($Articles->fileList); + } + + // variables $css, $js, $header et $content + require('view/melaine.php'); + // HTML + require('view/template.php'); +} + +function discoVisitor() +{ + $page_actuelle = "discographie"; + $title = "Discographie"; + + // modèle + $Albums = new Album($page_actuelle); + $Albums->makeFileList(); + + // on récupère tout: JSON, HTML, noms et chemins des fichiers + $Albums->readAll(); + $Albums->fileList = array_reverse($Albums->fileList); + //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++) + { + // 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); + + + + // lien vers le HTML ou ancre? + /*$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']; + $avecLien[$i] = true; + $linkDiscoChrono[$i] = 'linkChrono'; // css + } + else + { + $lienAlbum[$i] = 'page=discographie#' . $Albums->fileList[$i]['titre']; + $avecLien[$i] = false; + $linkDiscoChrono[$i] = 'noLinkChrono'; // css + } + $lienBoutonModif[$i] = 'page=discographie&action=edition&file_code=' . $Albums->fileList[$i]['fileCode']; + } + + // variables $css, $js et $content + require('view/discographie.php'); + // fin de l'assemblage + require('view/template.php'); +} + +// page d'un album +function album($fileCode, $albumName) +{ + $page_actuelle = 'discographie'; + $title = $albumName; + + $album = Album::readOneHTML($fileCode); // simple, efficace + + // variables $css, $header et $content + require('view/album.php'); + // HTML + require('view/template.php'); +} + +function presse() +{} + +function ateliers() +{} + +function liens() +{} + +function peinture() +{} + +function archives() {} \ No newline at end of file -- cgit v1.2.3