diff options
Diffstat (limited to 'model/Album.php')
-rw-r--r-- | model/Album.php | 33 |
1 files changed, 25 insertions, 8 deletions
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 | |||
7 | 7 | ||
8 | public function __construct($page) | 8 | public function __construct($page) |
9 | { | 9 | { |
10 | $this->format = 'json'; // vaut 'html' dans la classe mère | ||
11 | |||
10 | // pour: page, fileCode, time et makeFileList() | 12 | // pour: page, fileCode, time et makeFileList() |
11 | parent::__construct($page); | 13 | parent::__construct($page); |
12 | //$this->page = $page; | ||
13 | //$this->fileCode = ''; // désigne un fichier json et un html | ||
14 | $this->format = 'json'; // vaut 'html' dans la classe mère | ||
15 | //$this->time = time(); | ||
16 | //$this->makeFileList(); | ||
17 | } | 14 | } |
18 | 15 | ||
19 | // GET | 16 | // GET |
17 | public function getAllJSON() // pour la page album | ||
18 | { | ||
19 | // mettre le JSON dans fileList[$i]['content'] | ||
20 | parent::readAll(); | ||
21 | |||
22 | $this->format = 'html'; | ||
23 | |||
24 | for($i = 0; $i < $this->fileListCount; $i++) | ||
25 | { | ||
26 | $content = json_decode($this->fileList[$i]['content'], true); | ||
27 | $this->fileList[$i]['titre'] = $content[0]; | ||
28 | $this->fileList[$i]['annee'] = $content[1]; | ||
29 | $this->fileList[$i]['pochette'] = $content[2]; | ||
30 | $this->fileList[$i]['pochetteMini'] = $content[3]; | ||
31 | } | ||
32 | |||
33 | // on remet comme avant | ||
34 | $this->format = 'json'; | ||
35 | } | ||
20 | 36 | ||
21 | // SET | 37 | // SET |
22 | 38 | ||
@@ -70,6 +86,7 @@ class Album extends Article | |||
70 | // permet de ne pas la remplacer par la nouvelle | 86 | // permet de ne pas la remplacer par la nouvelle |
71 | 87 | ||
72 | $this->format = 'html'; | 88 | $this->format = 'html'; |
89 | |||
73 | for($i = 0; $i < $this->fileListCount; $i++) | 90 | for($i = 0; $i < $this->fileListCount; $i++) |
74 | { | 91 | { |
75 | // ajout du JSON | 92 | // ajout du JSON |
@@ -103,7 +120,7 @@ class Album extends Article | |||
103 | { | 120 | { |
104 | for($i = 0; $i < $this->fileListCount; $i++) | 121 | for($i = 0; $i < $this->fileListCount; $i++) |
105 | { | 122 | { |
106 | if($_SESSION['target'] == $this->fileList[$i]['fileCode']) | 123 | if($this->fileCode == $this->fileList[$i]['fileCode']) |
107 | { | 124 | { |
108 | // json | 125 | // json |
109 | $this->oneAlbum['fileCode'] = $this->fileList[$i]['fileCode']; | 126 | $this->oneAlbum['fileCode'] = $this->fileList[$i]['fileCode']; |
@@ -127,7 +144,7 @@ class Album extends Article | |||
127 | } | 144 | } |
128 | 145 | ||
129 | // page d'un album | 146 | // page d'un album |
130 | public static function readOneHTML($fileCode) | 147 | /*public static function readOneHTML($fileCode) |
131 | { | 148 | { |
132 | if(file_exists('data/discographie/html/' . $fileCode . '.html')) | 149 | if(file_exists('data/discographie/html/' . $fileCode . '.html')) |
133 | { | 150 | { |
@@ -137,7 +154,7 @@ class Album extends Article | |||
137 | { | 154 | { |
138 | return(''); | 155 | return(''); |
139 | } | 156 | } |
140 | } | 157 | }*/ |
141 | 158 | ||
142 | public function getVignetteJSON() | 159 | public function getVignetteJSON() |
143 | { | 160 | { |