-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert.php
More file actions
98 lines (91 loc) · 3.12 KB
/
insert.php
File metadata and controls
98 lines (91 loc) · 3.12 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
<?php
session_start();
require_once 'db.php';
// Redirection si l'utilisateur n'est pas connecté
if (!isset($_SESSION['user_id'])) {
header('Location: loginE.php');
exit;
}
// Message pour les actions
$message = '';
// Ajout ou mise à jour des notes d'un étudiant
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['submit_grades'])) {
$student_id = $_POST['student_id'];
$grade = $_POST['grade'];
$course = $_POST['course'];
$teacher_id = $_SESSION['user_id'];
// Insertion de la note dans la table pending_grades
$sql_insert = "INSERT INTO pending_grades (student_id, teacher_id, course, grade) VALUES (:student_id, :teacher_id, :course, :grade)";
$stmt_insert = $pdo->prepare($sql_insert);
$stmt_insert->execute(['student_id' => $student_id, 'teacher_id' => $teacher_id, 'course' => $course, 'grade' => $grade]);
$message = 'Nouvelle note ajoutée avec succès et en attente de validation.';
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ajouter des Notes</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
body {
background-color: #f8f9fa;
font-family: Arial, sans-serif;
}
.container {
margin-top: 50px;
}
h2 {
text-align: center;
margin-bottom: 20px;
}
.alert {
margin-top: 20px;
}
.form-group {
margin-bottom: 15px;
}
.btn-custom {
margin-top: 10px;
}
.nav-link {
margin-right: 15px;
}
.nav-link.active {
font-weight: bold;
color: #1abc9c;
}
</style>
</head>
<body>
<div class="container">
<h2>Ajouter des Notes</h2>
<nav class="nav">
<a class="nav-link" href="teacher_dashboard.php">Tableau de bord</a>
<a class="nav-link active" href="insert.php">Ajouter des Notes</a>
<a class="nav-link" href="logout.php">Déconnexion</a>
</nav>
<?php if ($message): ?>
<div class="alert alert-info" role="alert">
<?= htmlspecialchars($message) ?>
</div>
<?php endif; ?>
<form method="POST">
<div class="form-group">
<label for="student_id">ID de l'étudiant</label>
<input type="text" class="form-control" id="student_id" name="student_id" required>
</div>
<div class="form-group">
<label for="course">Cours</label>
<input type="text" class="form-control" id="course" name="course" required>
</div>
<div class="form-group">
<label for="grade">Note</label>
<input type="text" class="form-control" id="grade" name="grade" required>
</div>
<button type="submit" class="btn btn-primary btn-custom" name="submit_grades">Soumettre</button>
</form>
</div>
</body>
</html>