-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcourse.php
140 lines (118 loc) · 5.73 KB
/
course.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
<?php
//Database linked
require("Common_files/php/database.php");
$category = $_GET['cat_name'];
?>
<!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 START -->
<link rel="stylesheet" href="Common_files/css/bootstrap.min.css" />
<!-- BOOTSTRAP CSS LINK END -->
<!-- BOOTSTRAP JS LINK START -->
<script src="Common_files/js/bootstrap.bundle.min.js"></script>
<!-- BOOTSTRAP JS LINK END -->
<!-- ANIMATE CSS LINK START -->
<link rel="stylesheet" href="Common_files/css/animate.min.css" />
<!-- ANIMATE CSS LINK END -->
<!-- SWEET ALERT JS LINK START -->
<script src="Common_files/js/sweetalert.min.js"></script>
<!-- SWEET ALERT JS LINK END -->
<!--FONT AWESOME LINK START -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer"/>
<!--FONT AWESOME LINK END -->
<!-- JQUERY LINK START -->
<script src="Common_files/js/jquery.min.js"></script>
<!-- JQUERY LINK END -->
<!-- GOOGLE FONT START -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Sofia"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Audiowide"/>
<!-- GOOGLE FONT END -->
<title>Course</title>
<link rel="stylesheet" href="pages/index.css">
</head>
<body>
<!-- nav -->
<?php require("assets/nav.php"); ?>
<div class="container" style="margin-top: 100px;">
<a href="#" class="text-uppercase"><?php echo $category ?></a><br><br>
<div class="row">
<div class="col-md-3">
<div class="border bg-white p-4">
<h5>Filter</h5>
<div class="btn-group-vertical">
<?php
$get_course = "SELECT * FROM course WHERE category = '$category'";
$course_response = $db -> query($get_course);
if($course_response)
{
while($data = $course_response -> fetch_assoc())
{
echo "<button cat-name='".$data['category']."' class='btn filter-btn px-3 text-capitalize border'> <i class='fa fa-angle-double-right'></i> ".$data['name']."</button>";
}
}
?>
</div>
</div>
</div>
<div class="col-md-9">
<div class="bg-white d-flex flex-wrap justify-content-between batch-result border p-4">
</div>
</div>
</div>
</div>
<!-- footer -->
<?php require("assets/footer.php"); ?>
<script>
$(document).ready(function(){
$(".filter-btn").each(function(){
$(this).click(function(){
let cat_name = $(this).attr('cat-name').trim();
let course_name = $(this).text().trim();
//ajax
$.ajax({
type : "POST",
url : "pages/php/filter.php",
data : {
cat_name : cat_name,
course_name : course_name
},
cache : false,
beforeSend : function(){
$(".batch-result").html("<b>Loading...</b>");
},
success : function(response){
$(".batch-result").html("");
if(response.trim() != "There is no Batch!")
{
let batch_list = JSON.parse(response.trim());
if(batch_list.length != 0){
batch_list.forEach((batch, index) => {
let box = `
<div class="w-50 shadow-sm p-3 border mb-4">
<img src= "Employee/${batch.logo}" class="w-100" alt=""><br><br>
<span class="mt-3 fw-bold text-uppercase">${batch.course}</span><br><br>
<span class="fw-bold text-uppercase">Batch Time : ${batch.batch_from} to ${batch.batch_to}</span><br><br>
<span class="fw-bold text-uppercase">Batch Date : ${batch.batch_from_date} to ${batch.batch_to_date}</span><br><br>
<a href="http://localhost/School-ERP-System/register.php" class="btn btn-primary">Register</a>
</div>
`;
$(".batch-result").append(box);
});
}else{
$(".batch-result").html("<h2> <i class='fa fa-shoping-cart'></i> Yet No Batch in This Course.</h2>")
}
}else{
$(".batch-result").html("<h2> <i class='fa fa-shoping-cart'></i> Yet No Batch in This Course.</h2>")
}
},
});
});
});
});
</script>
</body>
</html>