summaryrefslogtreecommitdiff
path: root/view/articlesContent.php
diff options
context:
space:
mode:
Diffstat (limited to 'view/articlesContent.php')
-rw-r--r--view/articlesContent.php102
1 files changed, 102 insertions, 0 deletions
diff --git a/view/articlesContent.php b/view/articlesContent.php
new file mode 100644
index 0000000..fe71204
--- /dev/null
+++ b/view/articlesContent.php
@@ -0,0 +1,102 @@
1<?php
2// view/articlesContent.php
3
4// variable $articlesContent
5ob_start();
6if($_SESSION['admin'] == 1)
7{
8 // à la place du bouton après rechargement
9 if(isset($_GET['action']) && $_GET['action'] == 'editor' && !isset($_GET['file_code']))
10 {
11 $style = 'class="articleAvecEditeur"';
12?>
13 <div <?= $style ?>>
14 <h3>Rédiger un nouvel article</h3>
15<?php
16 echo($editeurHTML); // injection de template-formulaires.php
17 }
18
19 // bouton
20 else
21 {
22?>
23 <div>
24 <p class="boutonArticle boutonNouvelArticle" >
25 <a href="index.php?page=<?= $page ?>&action=editor" >
26 Nouvel article
27 </a>
28 </p>
29<?php
30 }
31?>
32 </div>
33<?php
34}
35
36// PAGINATION ??
37
38
39// tableau articles[] du plus récent au plus ancien
40for($i = 0; $i < $Articles->fileListCount; $i++)
41{
42 // la div invisible sert à la compensation des liens d'ancre #
43
44 // article modifié sur fond coloré
45 if(isset($fileCode) && $Articles->fileList[$i]['fileCode'] == $fileCode)
46 {
47 $style = 'class="articleAvecEditeur"';
48 }
49 elseif($page == 'menu')
50 {
51 $style = 'class="articleActu"';
52 }
53 else
54 {
55 $style = '';
56 }
57?>
58 <div class="zoneVideNav" ></div>
59 <article id="<?= $Articles->fileList[$i]['fileCode'] ?>">
60 <div <?= $style ?>>
61<?php
62
63 // remplacer un article par l'éditeur
64 if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'editor' && isset($_GET['file_code'])
65 && $_GET['file_code'] == $Articles->fileList[$i]['fileCode']
66 )
67 {
68 // on pourrait utiliser ici le timedate, ou encore le nom de l'article
69?>
70 <h3>Modification d'un article</h3>
71<?php
72 echo($editeurHTML); // injection de template-editor.php
73 }
74
75 // placer un article
76 else
77 {
78 // et voila
79 echo($Articles->fileList[$i]['content'] . "\n");
80
81 // bouton
82 if($_SESSION['admin'] == 1)
83 {
84 ?>
85 <p class="boutonArticle" >
86 <a href="index.php?page=<?= $page ?>&action=editor&file_code=<?= $Articles->fileList[$i]['fileCode'] ?>#<?= $Articles->fileList[$i]['fileCode'] ?>" >
87 Modifier cet article
88 </a>
89 &nbsp;<!-- un espace -->
90 <a href="index.php?page=<?= $page ?>&action=suppression&file_code=<?= $Articles->fileList[$i]['fileCode'] ?>" onclick="confirmerSuppression()" >
91 Supprimer cet article
92 </a>
93 </p>
94 <?php
95 }
96 }
97?>
98 </div>
99 </article>
100<?php
101}
102$ArticlesContent = ob_get_clean(); \ No newline at end of file