page = $page; $this->format = 'json'; // vaut 'html' dans la classe mère $this->time = time(); } // GET // SET // fonctions CRUD // create public function createVignette($titre, $annee, $pochette) { $this->format = 'json'; if($pochette != '') { // télécharger la pochette require('model/Image.php'); $Image = new Image(false); $Image->upload(); /*$erreur = $Image->getError(); if(!empty($erreur)) {}*/ } $albumJSON = json_encode([$titre, $annee, $pochette]); $nom_fichier = 'data/' . $this->page . '/' . $this->format . '/' . $this->time . '.' . $this->format; $fichier = fopen($nom_fichier, 'w'); // w pour créer ou écraser fputs($fichier, $albumJSON); fclose($fichier); chmod($nom_fichier, 0666); } // read public function getVignette() { return(file_get_contents($this->fileName)); } // page de l'album public static function readOneAlbum($albumCode) { return(file_get_contents('data/discographie/html/' . $albumCode . '.html')); } // pour afficher des dates /*public function getDate($fileNumber) { // le 2è paramètre exclut le suffixe .html $timestamp = basename($this->files[$fileNumber], '.html'); return getdate($timestamp); }*/ // update public function updateVignette() {} // delete public function delete() { unlink($this->fileName); } }