diff options
Diffstat (limited to 'model/Album.php')
| -rw-r--r-- | model/Album.php | 22 |
1 files changed, 11 insertions, 11 deletions
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 | |||
| 5 | { | 5 | { |
| 6 | public $oneAlbum; | 6 | public $oneAlbum; |
| 7 | 7 | ||
| 8 | public function __construct($page) | 8 | public function __construct(string $page, string $folder) |
| 9 | { | 9 | { |
| 10 | $this->format = 'json'; // vaut 'html' dans la classe mère | 10 | $this->format = 'json'; // vaut 'html' dans la classe mère |
| 11 | 11 | ||
| 12 | // pour: page, fileCode, time et makeFileList() | 12 | // pour: page, fileCode, time et makeFileList() |
| 13 | parent::__construct($page); | 13 | parent::__construct($page, $folder); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | // GET | 16 | // GET |
| @@ -49,7 +49,7 @@ class Album extends Article | |||
| 49 | 49 | ||
| 50 | // télécharger la pochette | 50 | // télécharger la pochette |
| 51 | require('model/Image.php'); | 51 | require('model/Image.php'); |
| 52 | $Image = new Image(false); | 52 | $Image = new Image($this->page, $this->folder, false); |
| 53 | $Image->upload(); | 53 | $Image->upload(); |
| 54 | $Image->makeThumbnail(201); | 54 | $Image->makeThumbnail(201); |
| 55 | 55 | ||
| @@ -61,7 +61,7 @@ class Album extends Article | |||
| 61 | $albumJSON = json_encode([$titre, $annee, $pochette, $pochetteMini]); | 61 | $albumJSON = json_encode([$titre, $annee, $pochette, $pochetteMini]); |
| 62 | //var_dump($albumJSON); die(); | 62 | //var_dump($albumJSON); die(); |
| 63 | 63 | ||
| 64 | $nom_fichier = 'data/' . $this->page . '/' . $this->format . '/' . $this->time . '.' . $this->format; | 64 | $nom_fichier = 'data/' . $this->folder . '/' . $this->format . '/' . $this->time . '.' . $this->format; |
| 65 | 65 | ||
| 66 | $fichier = fopen($nom_fichier, 'w'); // w pour créer ou écraser | 66 | $fichier = fopen($nom_fichier, 'w'); // w pour créer ou écraser |
| 67 | fputs($fichier, $albumJSON); | 67 | fputs($fichier, $albumJSON); |
| @@ -95,9 +95,9 @@ class Album extends Article | |||
| 95 | $this->fileList[$i]['pochetteMini'] = $content[3]; | 95 | $this->fileList[$i]['pochetteMini'] = $content[3]; |
| 96 | 96 | ||
| 97 | // ajout du HTML si il existe | 97 | // ajout du HTML si il existe |
| 98 | if(file_exists('data/' . $this->page . '/' . $this->format . '/' . $this->fileList[$i]['fileCode'] . '.' . $this->format)) | 98 | if(file_exists('data/' . $this->folder . '/' . $this->format . '/' . $this->fileList[$i]['fileCode'] . '.' . $this->format)) |
| 99 | { | 99 | { |
| 100 | $this->fileList[$i]['HTMLfileName'] = 'data/' . $this->page . '/' . $this->format . '/' . $this->fileList[$i]['fileCode'] . '.' . $this->format; | 100 | $this->fileList[$i]['HTMLfileName'] = 'data/' . $this->folder . '/' . $this->format . '/' . $this->fileList[$i]['fileCode'] . '.' . $this->format; |
| 101 | $this->fileList[$i]['HTMLcontent'] = file_get_contents($this->fileList[$i]['HTMLfileName']); | 101 | $this->fileList[$i]['HTMLcontent'] = file_get_contents($this->fileList[$i]['HTMLfileName']); |
| 102 | } | 102 | } |
| 103 | // utile? | 103 | // utile? |
| @@ -120,7 +120,7 @@ class Album extends Article | |||
| 120 | { | 120 | { |
| 121 | // json | 121 | // json |
| 122 | $this->oneAlbum['fileCode'] = $this->fileList[$i]['fileCode']; | 122 | $this->oneAlbum['fileCode'] = $this->fileList[$i]['fileCode']; |
| 123 | $this->oneAlbum['fileName'] = 'data/' . $this->page . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; | 123 | $this->oneAlbum['fileName'] = 'data/' . $this->folder . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; |
| 124 | $this->oneAlbum['content'] = file_get_contents($this->fileList[$i]['fileName']); | 124 | $this->oneAlbum['content'] = file_get_contents($this->fileList[$i]['fileName']); |
| 125 | $content = json_decode($this->oneAlbum['content']); | 125 | $content = json_decode($this->oneAlbum['content']); |
| 126 | $this->oneAlbum['titre'] = $content[0]; | 126 | $this->oneAlbum['titre'] = $content[0]; |
| @@ -130,9 +130,9 @@ class Album extends Article | |||
| 130 | 130 | ||
| 131 | // html | 131 | // html |
| 132 | $this->format = 'html'; | 132 | $this->format = 'html'; |
| 133 | if(file_exists('data/' . $this->page . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format)) | 133 | if(file_exists('data/' . $this->folder . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format)) |
| 134 | { | 134 | { |
| 135 | $this->oneAlbum['HTMLfileName'] = 'data/' . $this->page . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; | 135 | $this->oneAlbum['HTMLfileName'] = 'data/' . $this->folder . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; |
| 136 | $this->oneAlbum['HTMLcontent'] = file_get_contents($this->oneAlbum['HTMLfileName']); | 136 | $this->oneAlbum['HTMLcontent'] = file_get_contents($this->oneAlbum['HTMLfileName']); |
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| @@ -175,7 +175,7 @@ class Album extends Article | |||
| 175 | { | 175 | { |
| 176 | // télécharger la pochette | 176 | // télécharger la pochette |
| 177 | require('model/Image.php'); | 177 | require('model/Image.php'); |
| 178 | $Image = new Image(false); | 178 | $Image = new Image($this->page, $this->folder, false); |
| 179 | $Image->upload(); | 179 | $Image->upload(); |
| 180 | $Image->makeThumbnail(201); | 180 | $Image->makeThumbnail(201); |
| 181 | $erreur = $Image->erreur; | 181 | $erreur = $Image->erreur; |
| @@ -203,7 +203,7 @@ class Album extends Article | |||
| 203 | { | 203 | { |
| 204 | parent::delete(); // json | 204 | parent::delete(); // json |
| 205 | 205 | ||
| 206 | if(file_exists('data/' . $this->page . '/html/' . $this->fileCode . '.' . $this->format)); | 206 | if(file_exists('data/' . $this->folder . '/html/' . $this->fileCode . '.' . $this->format)); |
| 207 | { | 207 | { |
| 208 | $this->format = 'html'; | 208 | $this->format = 'html'; |
| 209 | parent::delete(); // html | 209 | parent::delete(); // html |
