-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_courses.php
More file actions
78 lines (74 loc) · 2.46 KB
/
list_courses.php
File metadata and controls
78 lines (74 loc) · 2.46 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
<?php
include 'includes/dbcon.php';
?>
<?php
if (isset($_GET['category_id'])) {
$category_id = $_GET['category_id'];
$sql = "SELECT cat_title FROM lesson_cat WHERE cat_short_title = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$category_id]);
$category_title = $stmt->fetch();
}
?>
<?php include "includes/header.php"; ?>
<!-- Begin Page Content -->
<div class="container-fluid">
<div class="my-3">
<h1 class="h3 mb-0 text-gray-800">Λίστα Μαθημάτων</h1>
</div>
<!-- Πίνακας Μαθημάτων -->
<div class="shadow">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary"><?php echo $category_title['cat_title']; ?></h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="dataTable" class="table table-bordered table-hover" style="width:100%">
<thead>
<tr>
<th>Τίτλος</th>
<th>Εξάμηνο</th>
<th>Μονάδες ECTS</th>
<th>Θεωρία</th>
<th>Εργαστήριο</th>
<th>Φροντιστήριο</th>
</tr>
</thead>
<tbody>
<!-- Εμφάνιση Λίστας Μαθημάτων -->
<?php
$sql = "SELECT * FROM lesson WHERE cat_id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$category_id]);
$lessons = $stmt->fetchAll();
foreach ($lessons as $lesson) :
?>
<tr>
<td><a href="lesson.php?lesson_id=<?php echo $lesson['lesson_code']; ?>" class="text-gray-600"><?php echo $lesson['title']; ?></a></td>
<td><?php echo $lesson['semester']; ?></td>
<td><?php echo $lesson['ects']; ?></td>
<td><?php echo $lesson['hours_teaching']; ?></td>
<td><?php echo ($lesson['hours_lab'] != 0) ?: '-'; ?></td>
<td><?php echo ($lesson['hours_exer'] != 0) ?: '-'; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<?php include "includes/footer.php"; ?>
<script>
$(document).ready(function() {
$('#dataTable').DataTable();
});
$('tbody>tr').click(function() {
window.location = $(this).find('a').attr('href');
}).hover(function() {
$(this).toggleClass('hover');
});
</script>