From abd968a1c573b1862bd0728f0b7b6a88e307900a Mon Sep 17 00:00:00 2001 From: polo Date: Mon, 28 Feb 2022 02:15:31 +0100 Subject: sauvegarde zip --- model/Album.php | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'model/Album.php') diff --git a/model/Album.php b/model/Album.php index 9c90a6b..3f13939 100644 --- a/model/Album.php +++ b/model/Album.php @@ -7,16 +7,32 @@ class Album extends Article public function __construct($page) { + $this->format = 'json'; // vaut 'html' dans la classe mère + // pour: page, fileCode, time et makeFileList() parent::__construct($page); - //$this->page = $page; - //$this->fileCode = ''; // désigne un fichier json et un html - $this->format = 'json'; // vaut 'html' dans la classe mère - //$this->time = time(); - //$this->makeFileList(); } // GET + public function getAllJSON() // pour la page album + { + // mettre le JSON dans fileList[$i]['content'] + parent::readAll(); + + $this->format = 'html'; + + for($i = 0; $i < $this->fileListCount; $i++) + { + $content = json_decode($this->fileList[$i]['content'], true); + $this->fileList[$i]['titre'] = $content[0]; + $this->fileList[$i]['annee'] = $content[1]; + $this->fileList[$i]['pochette'] = $content[2]; + $this->fileList[$i]['pochetteMini'] = $content[3]; + } + + // on remet comme avant + $this->format = 'json'; + } // SET @@ -70,6 +86,7 @@ class Album extends Article // permet de ne pas la remplacer par la nouvelle $this->format = 'html'; + for($i = 0; $i < $this->fileListCount; $i++) { // ajout du JSON @@ -103,7 +120,7 @@ class Album extends Article { for($i = 0; $i < $this->fileListCount; $i++) { - if($_SESSION['target'] == $this->fileList[$i]['fileCode']) + if($this->fileCode == $this->fileList[$i]['fileCode']) { // json $this->oneAlbum['fileCode'] = $this->fileList[$i]['fileCode']; @@ -127,7 +144,7 @@ class Album extends Article } // page d'un album - public static function readOneHTML($fileCode) + /*public static function readOneHTML($fileCode) { if(file_exists('data/discographie/html/' . $fileCode . '.html')) { @@ -137,7 +154,7 @@ class Album extends Article { return(''); } - } + }*/ public function getVignetteJSON() { -- cgit v1.2.3