-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocument.php
More file actions
163 lines (146 loc) · 7.59 KB
/
Copy pathdocument.php
File metadata and controls
163 lines (146 loc) · 7.59 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/**
* Electhèque - Page de visualisation d'un document
*/
require_once __DIR__ . '/includes/functions.php';
$id = intval($_GET['id'] ?? 0);
if ($id <= 0) {
header('Location: ' . SITE_URL);
exit;
}
$document = getDocumentById($id);
if (!$document) {
header('HTTP/1.0 404 Not Found');
$pageTitle = 'Document non trouvé - ' . SITE_NAME;
require_once INCLUDES_PATH . 'header.php';
?>
<section class="section">
<div class="container">
<div class="empty-state">
<svg class="empty-state-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M12 12h.01M12 12h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<h1 class="empty-state-title">Document non trouvé</h1>
<p class="empty-state-text">Ce document n'existe pas ou a été supprimé.</p>
<a href="<?= SITE_URL ?>" class="btn btn-primary">Retour à l'accueil</a>
</div>
</div>
</section>
<?php
require_once INCLUDES_PATH . 'footer.php';
exit;
}
$pageTitle = $document['candidat_nom'] . ' - ' . TYPES_DOCUMENT[$document['type_document']] . ' - ' . SITE_NAME;
$pageDescription = TYPES_DOCUMENT[$document['type_document']] . ' de ' . $document['candidat_nom'] .
' (' . $document['parti'] . ') pour les élections ' . TYPES_ELECTION[$document['type_election']] .
' de ' . $document['annee'] . ' à ' . $document['lieu_nom'];
require_once INCLUDES_PATH . 'header.php';
?>
<section class="section">
<div class="container">
<!-- Fil d'Ariane -->
<nav style="margin-bottom: var(--spacing-6); font-size: var(--font-size-sm); color: var(--color-gray-500);">
<a href="<?= SITE_URL ?>">Accueil</a> ›
<a href="<?= SITE_URL ?>/recherche.php">Documents</a> ›
<span><?= e($document['candidat_nom']) ?></span>
</nav>
<div class="document-view">
<!-- Prévisualisation -->
<div class="document-preview">
<?php if ($document['type_fichier'] === 'image'): ?>
<a href="<?= UPLOADS_URL . e($document['fichier']) ?>" target="_blank">
<img src="<?= UPLOADS_URL . e($document['fichier']) ?>"
alt="<?= e($document['candidat_nom']) ?> - <?= e(TYPES_DOCUMENT[$document['type_document']]) ?>">
</a>
<?php else: ?>
<!-- Lecteur PDF avec PDF.js -->
<iframe src="https://mozilla.github.io/pdf.js/web/viewer.html?file=<?= urlencode(UPLOADS_URL . $document['fichier']) ?>"
title="<?= e($document['candidat_nom']) ?> - <?= e(TYPES_DOCUMENT[$document['type_document']]) ?>">
</iframe>
<?php endif; ?>
</div>
<!-- Informations -->
<div class="document-info">
<h1><?= e($document['candidat_nom']) ?></h1>
<p style="color: var(--color-gray-600); margin-bottom: var(--spacing-6);">
<?= e($document['parti']) ?>
</p>
<ul class="document-meta">
<li>
<span class="document-meta-label">Type de document</span>
<span class="document-meta-value"><?= e(TYPES_DOCUMENT[$document['type_document']]) ?></span>
</li>
<li>
<span class="document-meta-label">Type d'élection</span>
<span class="document-meta-value"><?= e(TYPES_ELECTION[$document['type_election']]) ?></span>
</li>
<li>
<span class="document-meta-label">Année</span>
<span class="document-meta-value"><?= e($document['annee']) ?></span>
</li>
<li>
<span class="document-meta-label">Lieu</span>
<span class="document-meta-value"><?= e($document['lieu_nom']) ?></span>
</li>
<li>
<span class="document-meta-label">Ajouté le</span>
<span class="document-meta-value"><?= formatDateFr($document['date_upload']) ?></span>
</li>
</ul>
<div class="document-actions">
<a href="<?= UPLOADS_URL . e($document['fichier']) ?>" download class="btn btn-primary">
Télécharger
</a>
<button type="button" class="btn btn-secondary" data-modal-open="modal-signaler">
Signaler un problème
</button>
</div>
<!-- Liens de recherche -->
<div style="margin-top: var(--spacing-6); padding-top: var(--spacing-6); border-top: 1px solid var(--color-gray-200);">
<p style="font-size: var(--font-size-sm); color: var(--color-gray-500); margin-bottom: var(--spacing-3);">
Voir d'autres documents :
</p>
<div style="display: flex; flex-wrap: wrap; gap: var(--spacing-2);">
<a href="<?= SITE_URL ?>/recherche.php?candidat=<?= urlencode($document['candidat_nom']) ?>" class="card-tag">
<?= e($document['candidat_nom']) ?>
</a>
<a href="<?= SITE_URL ?>/recherche.php?type_election=<?= $document['type_election'] ?>" class="card-tag">
<?= e(TYPES_ELECTION[$document['type_election']]) ?>
</a>
<a href="<?= SITE_URL ?>/recherche.php?annee=<?= $document['annee'] ?>" class="card-tag">
<?= e($document['annee']) ?>
</a>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Modal Signalement -->
<div class="modal-overlay" id="modal-signaler">
<div class="modal">
<div class="modal-header">
<h2 class="modal-title">Signaler un problème</h2>
<button type="button" class="modal-close" data-modal-close>×</button>
</div>
<form action="<?= SITE_URL ?>/signaler.php" method="post">
<div class="modal-body">
<input type="hidden" name="csrf_token" value="<?= e(generateCsrfToken()) ?>">
<input type="hidden" name="document_id" value="<?= $document['id'] ?>">
<div class="form-group">
<label for="raison" class="form-label required">Raison du signalement</label>
<textarea name="raison" id="raison" class="form-textarea" required
placeholder="Décrivez le problème rencontré avec ce document..."></textarea>
</div>
<p style="font-size: var(--font-size-sm); color: var(--color-gray-500);">
Exemples : document illisible, mauvaise classification, contenu inapproprié, doublon...
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-modal-close>Annuler</button>
<button type="submit" class="btn btn-primary">Envoyer le signalement</button>
</div>
</form>
</div>
</div>
<?php require_once INCLUDES_PATH . 'footer.php'; ?>