-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgroupes.php
More file actions
190 lines (186 loc) · 7.89 KB
/
Copy pathgroupes.php
File metadata and controls
190 lines (186 loc) · 7.89 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
include('dbconfig.php');
include('security.php');
secAdmin();
include('includes/header.php');
include('includes/navbar.php');
?>
<div class="modal fade" id="addadminprofile" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Ajouter un groupe</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Fermer">
<span aria-hidden="true">×</span>
</button>
</div>
<form action="code.php" method="POST">
<div class="modal-body">
<div class="form-group">
<label>Nom du groupe</label>
<input type="text" name="nom" class="form-control" placeholder="Entrer Nom du groupe">
</div>
<div class="form-group">
<label for="niveau">Niveau</label>
<select name="niveau" class="form-control">
<option value="" selected disabled>Sélectionner un niveau</option>
<?php
$query_niveau = "SELECT * FROM `niveau`";
$query_run_niveau = mysqli_query($connection, $query_niveau);
if ($query_run_niveau) {
while ($row = mysqli_fetch_assoc($query_run_niveau)) {
?>
<option value="<?php echo $row['NiveauID']; ?>"><?php echo $row['Niveau_name']; ?></option>
<?php
}
}
?>
</select>
</div>
<div class="form-group">
<label>Date de création</label>
<input type="date" name="date_creation" class="form-control" placeholder="Entrer Date">
</div>
<div class="form-group">
<label for="professeur">Professeur</label>
<select name="professeur" class="form-control">
<option value="" selected disabled>Choisir un professeur</option>
<?php
$query_prof = "SELECT * FROM `professeurs`";
$query_run_prof = mysqli_query($connection, $query_prof);
if ($query_run_prof) {
while ($row = mysqli_fetch_assoc($query_run_prof)) {
?>
<option value="<?php echo $row['ProfesseurID']; ?>"><?php echo $row['Professeur_name'] . ' ' . $row['Professeur_prenom']; ?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
<button type="submit" name="groupebtn" class="btn btn-primary">Enregistrer</button>
</div>
</form>
</div>
</div>
</div>
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Groupes
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addadminprofile">Ajouter</button>
</h6>
</div>
<div class="card-body">
<?php
if(isset($_SESSION['success']) && $_SESSION['success'] != '') {
echo '<h6 class="alert alert-success" role="alert"> '.$_SESSION['success'].' </h6>
<meta http-equiv="refresh" content="5; url = groupes.php" />';
unset($_SESSION['success']);
}
if(isset($_SESSION['status']) && $_SESSION['status'] != '') {
echo '<h6 class="alert alert-danger" role="alert"> '.$_SESSION['status'].' </h6>';
unset($_SESSION['status']);
}
?>
<div class="table-responsive">
<?php
$query = "SELECT * FROM groupes";
$query_run = mysqli_query($connection, $query);
?>
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>ID</th>
<th>Nom</th>
<th>Niveau</th>
<th>Date de création</th>
<th>Professeur</th>
<th>Éditer</th>
<th>Supprimer</th>
</tr>
</thead>
<tbody>
<?php
if(mysqli_num_rows($query_run) > 0) {
while($row = mysqli_fetch_assoc($query_run)) {
?>
<tr>
<td><?php echo $row['GroupeID']; ?></td>
<td><?php echo $row['Groupe_name']; ?></td>
<td>
<?php
$niveau_query = "SELECT Niveau_name FROM niveau WHERE NiveauID = ".$row['Niveau'];
$niveau_result = mysqli_query($connection, $niveau_query);
if(mysqli_num_rows($niveau_result) > 0) {
$niveau_row = mysqli_fetch_assoc($niveau_result);
echo $niveau_row['Niveau_name'];
} else {
echo "Non attribué";
}
?>
</td>
<td><?php echo $row['Date_creation']; ?></td>
<td>
<?php
$prof_query = "SELECT Professeur_name, Professeur_prenom FROM professeurs WHERE ProfesseurID = ".$row['ProfesseurID'];
$prof_result = mysqli_query($connection, $prof_query);
if(mysqli_num_rows($prof_result) > 0) {
$prof_row = mysqli_fetch_assoc($prof_result);
echo $prof_row['Professeur_name'] . ' ' . $prof_row['Professeur_prenom'];
} else {
echo "Non attribué";
}
?>
</td>
<td>
<form action="groupe_edit.php" method="post">
<input type="hidden" name="edit_id" value="<?php echo $row['GroupeID']; ?>">
<button type="submit" name="editg_btn" class="btn btn-success">Éditer</button>
</form>
</td>
<td>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#confirmDeleteGroupeModal<?php echo $row['GroupeID']; ?>">Supprimer</button>
<div class="modal fade" id="confirmDeleteGroupeModal<?php echo $row['GroupeID']; ?>" tabindex="-1" role="dialog" aria-labelledby="confirmDeleteGroupeModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirmDeleteGroupeModalLabel">Confirmation de suppression</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Voulez-vous vraiment supprimer ce groupe?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
<form action="code.php" method="post">
<input type="hidden" name="deleteg_id" value="<?php echo $row['GroupeID']; ?>">
<button type="submit" name="deleteg_btn" class="btn btn-danger">Supprimer</button>
</form>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php
}
} else {
echo "Aucun enregistrement trouvé";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
include('includes/scripts.php');
include('includes/footer.php');
?>