From 90b3efeeb9d939303ff80b180725e06e2e57af79 Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 13 Apr 2023 03:02:57 +0200 Subject: =?UTF-8?q?=C3=A9diteur=20page=20album?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/Album.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'model/Album.php') diff --git a/model/Album.php b/model/Album.php index b4b7afe..d2537f7 100644 --- a/model/Album.php +++ b/model/Album.php @@ -5,12 +5,12 @@ class Album extends Article { public $oneAlbum; - public function __construct($page) + public function __construct(string $page, string $folder) { $this->format = 'json'; // vaut 'html' dans la classe mère // pour: page, fileCode, time et makeFileList() - parent::__construct($page); + parent::__construct($page, $folder); } // GET @@ -49,7 +49,7 @@ class Album extends Article // télécharger la pochette require('model/Image.php'); - $Image = new Image(false); + $Image = new Image($this->page, $this->folder, false); $Image->upload(); $Image->makeThumbnail(201); @@ -61,7 +61,7 @@ class Album extends Article $albumJSON = json_encode([$titre, $annee, $pochette, $pochetteMini]); //var_dump($albumJSON); die(); - $nom_fichier = 'data/' . $this->page . '/' . $this->format . '/' . $this->time . '.' . $this->format; + $nom_fichier = 'data/' . $this->folder . '/' . $this->format . '/' . $this->time . '.' . $this->format; $fichier = fopen($nom_fichier, 'w'); // w pour créer ou écraser fputs($fichier, $albumJSON); @@ -95,9 +95,9 @@ class Album extends Article $this->fileList[$i]['pochetteMini'] = $content[3]; // ajout du HTML si il existe - if(file_exists('data/' . $this->page . '/' . $this->format . '/' . $this->fileList[$i]['fileCode'] . '.' . $this->format)) + if(file_exists('data/' . $this->folder . '/' . $this->format . '/' . $this->fileList[$i]['fileCode'] . '.' . $this->format)) { - $this->fileList[$i]['HTMLfileName'] = 'data/' . $this->page . '/' . $this->format . '/' . $this->fileList[$i]['fileCode'] . '.' . $this->format; + $this->fileList[$i]['HTMLfileName'] = 'data/' . $this->folder . '/' . $this->format . '/' . $this->fileList[$i]['fileCode'] . '.' . $this->format; $this->fileList[$i]['HTMLcontent'] = file_get_contents($this->fileList[$i]['HTMLfileName']); } // utile? @@ -120,7 +120,7 @@ class Album extends Article { // json $this->oneAlbum['fileCode'] = $this->fileList[$i]['fileCode']; - $this->oneAlbum['fileName'] = 'data/' . $this->page . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; + $this->oneAlbum['fileName'] = 'data/' . $this->folder . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; $this->oneAlbum['content'] = file_get_contents($this->fileList[$i]['fileName']); $content = json_decode($this->oneAlbum['content']); $this->oneAlbum['titre'] = $content[0]; @@ -130,9 +130,9 @@ class Album extends Article // html $this->format = 'html'; - if(file_exists('data/' . $this->page . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format)) + if(file_exists('data/' . $this->folder . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format)) { - $this->oneAlbum['HTMLfileName'] = 'data/' . $this->page . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; + $this->oneAlbum['HTMLfileName'] = 'data/' . $this->folder . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; $this->oneAlbum['HTMLcontent'] = file_get_contents($this->oneAlbum['HTMLfileName']); } } @@ -175,7 +175,7 @@ class Album extends Article { // télécharger la pochette require('model/Image.php'); - $Image = new Image(false); + $Image = new Image($this->page, $this->folder, false); $Image->upload(); $Image->makeThumbnail(201); $erreur = $Image->erreur; @@ -203,7 +203,7 @@ class Album extends Article { parent::delete(); // json - if(file_exists('data/' . $this->page . '/html/' . $this->fileCode . '.' . $this->format)); + if(file_exists('data/' . $this->folder . '/html/' . $this->fileCode . '.' . $this->format)); { $this->format = 'html'; parent::delete(); // html -- cgit v1.2.3