-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvoir_notes.php
More file actions
138 lines (126 loc) · 5.13 KB
/
voir_notes.php
File metadata and controls
138 lines (126 loc) · 5.13 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
<?php
require_once "config/database.php";
require_once "models/Note.php";
require_once "models/Etudiant.php";
require_once "models/Matiere.php";
$database = new Database();
$db = $database->getConnection();
$note = new Note($db);
$etudiant = new Etudiant($db);
$matiere = new Matiere($db);
if (!isset($_GET['id'])) {
header("Location: index.php");
exit();
}
$etudiant_id = $_GET['id'];
$etudiant_info = $etudiant->getById($etudiant_id);
if (!$etudiant_info) {
header("Location: index.php");
exit();
}
// Récupérer toutes les notes de l'étudiant
$notes = $note->readByEtudiant($etudiant_id);
// Organiser les notes par matière et type
$notes_par_matiere = [];
while ($row = $notes->fetch(PDO::FETCH_ASSOC)) {
if (!isset($notes_par_matiere[$row['matiere']])) {
$notes_par_matiere[$row['matiere']] = [
'cc' => null,
'sn' => null,
'credit' => $matiere->getCredit($row['matiere'])
];
}
$notes_par_matiere[$row['matiere']][$row['type_note']] = [
'note' => $row['note'],
'date' => $row['date_examen']
];
}
// Calculer la moyenne générale
$moyenne = $note->getMoyenneEtudiant($etudiant_id);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Notes de <?php echo htmlspecialchars($etudiant_info['prenom'] . ' ' . $etudiant_info['nom']); ?></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
.note-finale {
font-weight: bold;
background-color: #f8f9fa;
}
.credit-info {
font-size: 0.8em;
color: #666;
}
.date-info {
font-size: 0.75em;
color: #666;
margin-top: 2px;
}
</style>
</head>
<body>
<?php include 'header.php'; ?>
<div class="container mt-4">
<div class="card mb-4">
<div class="card-body">
<h1 class="card-title h3">Notes de <?php echo htmlspecialchars($etudiant_info['prenom'] . ' ' . $etudiant_info['nom']); ?></h1>
<p class="card-text">
Classe : <?php echo htmlspecialchars($etudiant_info['classe']); ?><br>
Moyenne générale : <strong><?php echo $moyenne !== null ? number_format($moyenne, 2) : '-'; ?>/20</strong>
</p>
<a href="index.php" class="btn btn-secondary">Retour</a>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Matière</th>
<th>Contrôle Continu (CC)<div class="credit-info">30%</div></th>
<th>Session Normale (SN)<div class="credit-info">70%</div></th>
<th>Note Finale</th>
</tr>
</thead>
<tbody>
<?php foreach ($notes_par_matiere as $matiere_nom => $notes_matiere): ?>
<tr>
<td>
<?php echo htmlspecialchars($matiere_nom); ?>
<div class="credit-info">
<?php echo $notes_matiere['credit']; ?> crédit<?php echo $notes_matiere['credit'] > 1 ? 's' : ''; ?>
</div>
</td>
<td>
<?php if ($notes_matiere['cc']): ?>
<?php echo number_format($notes_matiere['cc']['note'], 2); ?>/20
<div class="date-info">Date: <?php echo date('d/m/Y', strtotime($notes_matiere['cc']['date'])); ?></div>
<?php else: ?>
-
<?php endif; ?>
</td>
<td>
<?php if ($notes_matiere['sn']): ?>
<?php echo number_format($notes_matiere['sn']['note'], 2); ?>/20
<div class="date-info">Date: <?php echo date('d/m/Y', strtotime($notes_matiere['sn']['date'])); ?></div>
<?php else: ?>
-
<?php endif; ?>
</td>
<td class="note-finale">
<?php if ($notes_matiere['sn'] && $notes_matiere['cc']): ?>
<?php echo number_format((0.3 * $notes_matiere['cc']['note'] + 0.7 * $notes_matiere['sn']['note']), 2) . '/20'; ?>
<?php else: ?>
-
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>