-
Notifications
You must be signed in to change notification settings - Fork 3
/
teacher.php
158 lines (149 loc) · 6.89 KB
/
teacher.php
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<title>QuizX</title>
<script type="text/javascript">
(function (global) {
if(typeof (global) === "undefined") {
throw new Error("window is undefined");
}
var _hash = "!";
var noBackPlease = function () {
global.location.href += "#";
// Making sure we have the fruit available for juice (^__^)
global.setTimeout(function () {
global.location.href += "!";
}, 50);
};
global.onhashchange = function () {
if (global.location.hash !== _hash) {
global.location.hash = _hash;
}
};
global.onload = function () {
noBackPlease();
// Disables backspace on page except on input fields and textarea..
document.body.onkeydown = function (e) {
var elm = e.target.nodeName.toLowerCase();
if (e.which === 8 && (elm !== 'input' && elm !== 'textarea')) {
e.preventDefault();
}
// Stopping the event bubbling up the DOM tree...
e.stopPropagation();
};
}
})(window);
</script>
</head>
<body>
<?php include 'partials/_header.php'?>
<?php
if(isset($_GET['courseCreated']) && $_GET['courseCreated'] == 'true'){
echo '<div class="alert alert-success alert-dismissible fade show my-0" role="alert">
<strong>Success!</strong> A new course has been added.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>';
unset($_GET['courseCreated']);
}
else if(isset($_GET['courseCreated']) && $_GET['courseCreated'] == 'false'){
echo '<div class="alert alert-danger alert-dismissible fade show my-0" role="alert">
<strong>Error!</strong> '.$_GET['error'].'.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>';
unset($_GET['courseCreated']);
}
if(isset($_GET['courseUpdated']) && $_GET['courseUpdated'] == 'true'){
echo '<div class="alert alert-success alert-dismissible fade show my-0" role="alert">
<strong>Success!</strong> A course has been updated.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>';
unset($_GET['courseUpdated']);
}
else if(isset($_GET['courseUpdated']) && $_GET['courseUpdated'] == 'false'){
echo '<div class="alert alert-danger alert-dismissible fade show my-0" role="alert">
<strong>Error!</strong> '.$_GET['error'].'.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>';
unset($_GET['courseUpdated']);
}
if(isset($_GET['courseDeleted']) && $_GET['courseDeleted'] == 'true'){
echo '<div class="alert alert-success alert-dismissible fade show my-0" role="alert">
<strong>Success!</strong> A course has been deleted.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>';
unset($_GET['courseDeleted']);
}
else if(isset($_GET['courseDeleted']) && $_GET['courseDeleted'] == 'false'){
echo '<div class="alert alert-danger alert-dismissible fade show my-0" role="alert">
<strong>Error!</strong> '.$_GET['error'].'.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>';
unset($_GET['courseDeleted']);
}
if(isset($_GET['quizcreated']) && $_GET['quizcreated'] == 'true'){
echo '<div class="alert alert-success alert-dismissible fade show my-0" role="alert">
<strong>Success!</strong> A quiz has been created.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>';
unset($_GET['quizcreated']);
}
?>
<div class="container my-3">
<h1 class="text-center text-light">
Hi <em><?php echo $_SESSION['name'];?></em>, Welcome to QuizX.
</h1>
</div>
<div class="container">
<div class="row mb-2">
<h3 class="text-light">
Create/Modify a Course
</h3>
</div>
<div class="row mb-4">
<div class="col-sm-12 col-md-2">
<a href="/QUIZ/partials/_addcourse.php" type="button" class="btn btn-success btn-lg">Add a course</a>
</div>
<div class="col-sm-12 col-md-2">
<a href="/QUIZ/partials/_editcourse.php" type="button" class="btn btn-warning btn-lg">Edit a course</a>
</div>
<div class="col-sm-12 col-md-2">
<a href="/QUIZ/partials/_deletecourse.php" type="button" class="btn btn-danger btn-lg">Delete a
course</a>
</div>
</div>
<div class="row mb-2">
<h3 class="text-light">Available courses</h3>
</div>
<?php
include 'partials/_dbconnect.php';
$sql = "SELECT * FROM `course`";
$result = mysqli_query($conn, $sql);
echo '<div class="row">';
while($row = mysqli_fetch_assoc($result)){
echo'<div class="col-sm-12 col-md-3 mb-5">
<div class="card card-product" style="width: 18rem;">
<img src="https://source.unsplash.com/500x400/?'.$row['cname'].'" class="card-img-top"
alt="...">
<div class="card-body">
<h5 class="card-title">'.$row['cname'].'</h5>
<a href="/QUIZ/partials/_createquiz.php?subject='.$row['cname'].'" class="btn btn-success">Create a
Quiz</a>
</div>
</div>
</div>';
}
echo '</div>';
?>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous">
</script>
</body>
</html>