diff options
Diffstat (limited to 'view/pageArticlesSimples.php')
-rw-r--r-- | view/pageArticlesSimples.php | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/view/pageArticlesSimples.php b/view/pageArticlesSimples.php new file mode 100644 index 0000000..aa755d8 --- /dev/null +++ b/view/pageArticlesSimples.php | |||
@@ -0,0 +1,136 @@ | |||
1 | <?php | ||
2 | // view/pageArticleSimple.php | ||
3 | |||
4 | // variable $css | ||
5 | ob_start(); | ||
6 | ?> | ||
7 | <link rel="stylesheet" type="text/css" href="public/css/pages_articles_simples.css" /> | ||
8 | <link rel="stylesheet" type="text/css" href="public/css/donnees_hors_editeur.css" /> | ||
9 | <?php | ||
10 | $css = ob_get_clean(); | ||
11 | |||
12 | |||
13 | //variable $js | ||
14 | ob_start(); | ||
15 | ?> | ||
16 | <script type="text/javascript" src="public/main.js" ></script> | ||
17 | <?php | ||
18 | if(isset($_GET['action']) && $_GET['action'] == 'editor') | ||
19 | { | ||
20 | |||
21 | // bibliothèques JS ckeditor | ||
22 | ?> | ||
23 | <script src="lib/ckeditor5/build/ckeditor.js"></script> | ||
24 | <?php | ||
25 | } | ||
26 | $js = ob_get_clean(); | ||
27 | |||
28 | |||
29 | // variable $header | ||
30 | ob_start(); | ||
31 | echo "\n"; | ||
32 | ?> | ||
33 | <header> | ||
34 | <div id="titre" > | ||
35 | <span class="police_titre" ><?= $headerPaintedTitle ?></span> | ||
36 | </div> | ||
37 | <?= $headerImage ?> | ||
38 | </header> | ||
39 | <?php | ||
40 | $header = ob_get_clean(); | ||
41 | |||
42 | |||
43 | // variable $content | ||
44 | ob_start(); | ||
45 | if($_SESSION['admin'] == 1) | ||
46 | { | ||
47 | // à la place du bouton après rechargement | ||
48 | if(isset($_GET['action']) && $_GET['action'] == 'editor' && !isset($_GET['file_code'])) | ||
49 | { | ||
50 | $style = 'class="articleAvecEditeur"'; | ||
51 | ?> | ||
52 | <div <?= $style ?>> | ||
53 | <h3>Rédiger un nouvel article</h3> | ||
54 | <?php | ||
55 | echo($editeurHTML); // injection de template-editor.php | ||
56 | } | ||
57 | |||
58 | // bouton | ||
59 | else | ||
60 | { | ||
61 | ?> | ||
62 | <div> | ||
63 | <p class="boutonArticle" > | ||
64 | <a href="index.php?page=<?= $page ?>&action=editor" > | ||
65 | Nouvel article | ||
66 | </a> | ||
67 | </p> | ||
68 | <?php | ||
69 | } | ||
70 | ?> | ||
71 | </div> | ||
72 | <?php | ||
73 | } | ||
74 | |||
75 | // on pourrait paginer avec des onglets de par exemple 10 articles | ||
76 | |||
77 | // tableau articles[] du plus récent au plus ancien | ||
78 | for($i = 0; $i < $Articles->fileListCount; $i++) | ||
79 | { | ||
80 | // la div invisible sert à la compensation des liens d'ancre # | ||
81 | |||
82 | // article modifié sur fond coloré | ||
83 | if(isset($fileCode) && $Articles->fileList[$i]['fileCode'] == $fileCode) | ||
84 | { | ||
85 | $style = 'class="articleAvecEditeur"'; | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | $style = ''; | ||
90 | } | ||
91 | ?> | ||
92 | <div class="zoneVideNav" ></div> | ||
93 | <article id="<?= $Articles->fileList[$i]['fileCode'] ?>"> | ||
94 | <div <?= $style ?>> | ||
95 | <?php | ||
96 | |||
97 | // remplacer un article par l'éditeur | ||
98 | if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'editor' && isset($_GET['file_code']) | ||
99 | && $_GET['file_code'] == $Articles->fileList[$i]['fileCode'] | ||
100 | ) | ||
101 | { | ||
102 | // on pourrait utiliser ici le timedate, ou encore le nom de l'article | ||
103 | ?> | ||
104 | <h3>Modification d'un article</h3> | ||
105 | <?php | ||
106 | echo($editeurHTML); // injection de template-editor.php | ||
107 | } | ||
108 | |||
109 | // placer un article | ||
110 | else | ||
111 | { | ||
112 | // et voila | ||
113 | echo($Articles->fileList[$i]['content'] . "\n"); | ||
114 | |||
115 | // bouton | ||
116 | if($_SESSION['admin'] == 1) | ||
117 | { | ||
118 | ?> | ||
119 | <p class="boutonArticle" > | ||
120 | <a href="index.php?page=<?= $page ?>&action=editor&file_code=<?= $Articles->fileList[$i]['fileCode'] ?>#<?= $Articles->fileList[$i]['fileCode'] ?>" > | ||
121 | Modifier cet article | ||
122 | </a> | ||
123 | <!-- un espace --> | ||
124 | <a href="index.php?page=<?= $page ?>&action=suppression&file_code=<?= $Articles->fileList[$i]['fileCode'] ?>" onclick="confirmerSuppression()" > | ||
125 | Supprimer cet article | ||
126 | </a> | ||
127 | </p> | ||
128 | <?php | ||
129 | } | ||
130 | } | ||
131 | ?> | ||
132 | </div> | ||
133 | </article> | ||
134 | <?php | ||
135 | } | ||
136 | $content = ob_get_clean(); | ||