diff options
Diffstat (limited to 'model/Page.php')
-rw-r--r-- | model/Page.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/model/Page.php b/model/Page.php index e03efe1..63730d8 100644 --- a/model/Page.php +++ b/model/Page.php | |||
@@ -13,10 +13,9 @@ class Page // classe "objet" | |||
13 | public $fileName = ''; // correspond à $_SESSION['nomFichier'] | 13 | public $fileName = ''; // correspond à $_SESSION['nomFichier'] |
14 | protected $time; // timestamp pour noms des fichiers créés | 14 | protected $time; // timestamp pour noms des fichiers créés |
15 | 15 | ||
16 | public function __construct($page, $format) | 16 | public function __construct($page) |
17 | { | 17 | { |
18 | $this->page = $page; | 18 | $this->page = $page; |
19 | $this->format = $format; | ||
20 | $this->time = time(); | 19 | $this->time = time(); |
21 | $this->makeFileList(); | 20 | $this->makeFileList(); |
22 | } | 21 | } |
@@ -39,6 +38,14 @@ class Page // classe "objet" | |||
39 | } | 38 | } |
40 | } | 39 | } |
41 | 40 | ||
41 | public function setFileName() | ||
42 | { | ||
43 | if(file_exists('data/' . $this->page . '/' . $this->format . '/' . $this->albumCode . '.' . $this->format)) | ||
44 | { | ||
45 | $this->fileName = 'data/' . $this->page . '/' . $this->format . '/' . $this->albumCode . '.' . $this->format; | ||
46 | } | ||
47 | } | ||
48 | |||
42 | // GET | 49 | // GET |
43 | 50 | ||
44 | // SET | 51 | // SET |
@@ -48,7 +55,7 @@ class Page // classe "objet" | |||
48 | // create | 55 | // create |
49 | public function create($content) | 56 | public function create($content) |
50 | { | 57 | { |
51 | $format = 'html'; | 58 | //$format = 'html'; |
52 | 59 | ||
53 | // nommer les fichiers avec le timestamp pour: | 60 | // nommer les fichiers avec le timestamp pour: |
54 | // - les trier par ordre chronologique | 61 | // - les trier par ordre chronologique |
@@ -65,7 +72,7 @@ class Page // classe "objet" | |||
65 | public function readAll() | 72 | public function readAll() |
66 | { | 73 | { |
67 | $i = 0; | 74 | $i = 0; |
68 | $articles = array(); | 75 | $articles = []; |
69 | foreach ($this->fileList as $oneFile) | 76 | foreach ($this->fileList as $oneFile) |
70 | { | 77 | { |
71 | $articles[$i] = file_get_contents($oneFile); | 78 | $articles[$i] = file_get_contents($oneFile); |