diff options
Diffstat (limited to 'controller/admin.php')
-rw-r--r-- | controller/admin.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/controller/admin.php b/controller/admin.php index ba6fd83..90924e0 100644 --- a/controller/admin.php +++ b/controller/admin.php | |||
@@ -9,9 +9,8 @@ function melaineEdit($numArticle, $suppression) | |||
9 | $page_actuelle = "melaine"; | 9 | $page_actuelle = "melaine"; |
10 | 10 | ||
11 | // modèle | 11 | // modèle |
12 | $Article = new OneArticle($page_actuelle); | 12 | $Article = new Page($page_actuelle, 'html'); |
13 | $Article->makeFileList(); | 13 | |
14 | |||
15 | // nouvel article | 14 | // nouvel article |
16 | if($numArticle == 0) | 15 | if($numArticle == 0) |
17 | { | 16 | { |
@@ -22,7 +21,7 @@ function melaineEdit($numArticle, $suppression) | |||
22 | { | 21 | { |
23 | // nom de l'article ciblé (objet et session) | 22 | // nom de l'article ciblé (objet et session) |
24 | $Article->findFileName($numArticle); | 23 | $Article->findFileName($numArticle); |
25 | $_SESSION['nomFichier'] = $Article->getFileName(); | 24 | $_SESSION['nomFichier'] = $Article->fileName; |
26 | 25 | ||
27 | // suppression | 26 | // suppression |
28 | if($suppression) | 27 | if($suppression) |
@@ -62,13 +61,13 @@ function melaineEdit($numArticle, $suppression) | |||
62 | require('view/template.php'); | 61 | require('view/template.php'); |
63 | } | 62 | } |
64 | 63 | ||
65 | function discoEdit($numArticle, $suppression) | 64 | function discoEdit($numArticle, $albumCode, $suppression) |
66 | { | 65 | { |
67 | $page_actuelle = "discographie"; | 66 | $page_actuelle = "discographie"; |
68 | $title = "Discographie"; | 67 | $title = "Discographie"; |
69 | 68 | ||
70 | // modèle | 69 | // modèle |
71 | $Album = new OneArticle($page_actuelle); | 70 | $Album = new Album($page_actuelle); |
72 | $Album->makeFileList(); | 71 | $Album->makeFileList(); |
73 | 72 | ||
74 | // nouvel album | 73 | // nouvel album |
@@ -81,7 +80,7 @@ function discoEdit($numArticle, $suppression) | |||
81 | { | 80 | { |
82 | // nom de l'article ciblé (objet et session) | 81 | // nom de l'article ciblé (objet et session) |
83 | $Album->findFileName($numArticle); | 82 | $Album->findFileName($numArticle); |
84 | $_SESSION['nomFichier'] = $Album->getFileName(); | 83 | $_SESSION['nomFichier'] = $Album->fileName; |
85 | 84 | ||
86 | // suppression | 85 | // suppression |
87 | if($suppression) | 86 | if($suppression) |
@@ -94,7 +93,8 @@ function discoEdit($numArticle, $suppression) | |||
94 | else | 93 | else |
95 | { | 94 | { |
96 | $title = "Modifier un album"; | 95 | $title = "Modifier un album"; |
97 | $texte = $Album->readOne(); // entrée de l'éditeur | 96 | $texte = $Album->readOneAlbum($albumCode); |
97 | $vignette = json_decode($Album->getVignette(), true); | ||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
@@ -106,11 +106,10 @@ function discoEdit($numArticle, $suppression) | |||
106 | $texte = preparationCKeditor($numArticle, $texte); | 106 | $texte = preparationCKeditor($numArticle, $texte); |
107 | } | 107 | } |
108 | 108 | ||
109 | |||
110 | // contenu de tous les fichiers JSON (= tableau de chaines) | 109 | // contenu de tous les fichiers JSON (= tableau de chaines) |
111 | $albumsJSON = $Album->readAll(); | 110 | $albumsJSON = $Album->readAll(); |
112 | // noms des fichiers JSON | 111 | // noms des fichiers JSON |
113 | $albumNamesJSON = $Album->getFileList(); | 112 | $albumNamesJSON = $Album->fileList; |
114 | 113 | ||
115 | // changer les chaines JSON en tableaux: titre, année, pochette | 114 | // changer les chaines JSON en tableaux: titre, année, pochette |
116 | $i = 0; | 115 | $i = 0; |
@@ -124,13 +123,15 @@ function discoEdit($numArticle, $suppression) | |||
124 | $annees[$i] = $albumsJSON[$i][1]; | 123 | $annees[$i] = $albumsJSON[$i][1]; |
125 | $i++; | 124 | $i++; |
126 | } | 125 | } |
126 | print_r($albumsJSON); | ||
127 | //exit(); | ||
127 | // tri d'un tableau multidimensionnel | 128 | // tri d'un tableau multidimensionnel |
128 | array_multisort($annees, $albumsJSON); | 129 | array_multisort($annees, $albumsJSON); |
129 | 130 | ||
130 | // on passe maintenant au contenu HTML | 131 | // on passe maintenant au contenu HTML |
131 | $Album->setFormat('html'); | 132 | $Album->format = 'html'; |
132 | $Album->makeFileList(); | 133 | $Album->makeFileList(); |
133 | $albumNamesHTML = $Album->getFileList(); | 134 | $albumNamesHTML = $Album->fileList; |
134 | 135 | ||
135 | // lien vers le HTML ou ancre? | 136 | // lien vers le HTML ou ancre? |
136 | // pour chaque album, détecter le fichier html | 137 | // pour chaque album, détecter le fichier html |
@@ -149,6 +150,7 @@ function discoEdit($numArticle, $suppression) | |||
149 | if(file_exists('data/discographie/html/' . $nomJSONsansExt . '.html')) | 150 | if(file_exists('data/discographie/html/' . $nomJSONsansExt . '.html')) |
150 | { | 151 | { |
151 | $lienAlbum[$i] = 'album&album_code=' . $nomJSONsansExt . '&album_name=' . $albumsJSON[$i][0]; | 152 | $lienAlbum[$i] = 'album&album_code=' . $nomJSONsansExt . '&album_name=' . $albumsJSON[$i][0]; |
153 | $lienBoutonModif[$i] = 'discographie&action=edition&album_code=' . $nomJSONsansExt; | ||
152 | $avecLien[$i] = true; | 154 | $avecLien[$i] = true; |
153 | } | 155 | } |
154 | else | 156 | else |