-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreerQcm.php
More file actions
100 lines (98 loc) · 4.15 KB
/
Copy pathcreerQcm.php
File metadata and controls
100 lines (98 loc) · 4.15 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
<?php
include("header.php");
require_once "fonction.php";
$message = '';
$messageType = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$titre = trim($_POST['titre'] ?? '');
$description = trim($_POST['description'] ?? '');
if (empty($titre)) {
$message = 'Le titre du QCM est obligatoire.';
$messageType = 'danger';
} else {
if (creerQCM($titre, $description)) {
$message = 'QCM créé avec succès !';
$messageType = 'success';
header("Location: indexAdmin.php");
} else {
$message = 'Erreur lors de la création du QCM.';
$messageType = 'danger';
}
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Créer un QCM</title>
<link rel="stylesheet" href="style.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<style>
body.page-bg-gradient {
background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
min-height: 100vh;
}
.admin-card {
background: #fff;
border-radius: 20px;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
padding: 2rem 2.5rem;
margin-top: 3rem;
}
.admin-title {
color: #2575fc;
font-weight: bold;
}
.admin-btn {
background: linear-gradient(135deg, #477c93, #315a67,#aad2e3);
border: none;
color: #fff;
font-weight: 600;
transition: 0.2s;
}
.admin-btn:hover {
background: linear-gradient(90deg, #0f2027, #203a43, #2c5364);
color: #fff;
}
.admin-section {
margin-top: 2rem;
}
</style>
</head>
<body class="page-bg-gradient">
<div class="container d-flex flex-column align-items-center justify-content-center" style="min-height: 80vh;">
<div class="admin-card w-100 w-md-75 w-lg-50">
<h1 class="admin-title text-center mb-4">Créer un QCM</h1>
<?php if (!empty($message)): ?>
<div class="d-flex justify-content-center mb-4">
<div class="alert alert-<?= $messageType ?> text-center px-4 py-3 w-100" style="max-width: 420px; border-radius: 1rem; box-shadow: 0 4px 16px rgba(31,38,135,0.10); font-size: 1.1rem; letter-spacing: 0.5px;">
<?php if ($messageType === 'success'): ?>
<i class="bi bi-check-circle-fill me-2" style="font-size:1.3rem;"></i>
<?php else: ?>
<i class="bi bi-exclamation-triangle-fill me-2" style="font-size:1.3rem;"></i>
<?php endif; ?>
<?= $message; ?>
</div>
</div>
<?php endif; ?>
<form action="" method="post">
<div class="mb-3">
<label for="titre" class="form-label">Titre du QCM <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="titre" name="titre" required value="<?= isset($_POST['titre']) ? htmlspecialchars($_POST['titre']) : '' ?>">
</div>
<div class="mb-3">
<label for="description" class="form-label">Description</label>
<textarea class="form-control" id="description" name="description" rows="3"><?= isset($_POST['description']) ? htmlspecialchars($_POST['description']) : '' ?></textarea>
</div>
<button type="submit" class="btn admin-btn w-100 py-3">Créer le QCM</button>
</form>
</div>
</div>
<?php include("footer.php"); ?>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
</body>
</html>