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