-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunits.php
82 lines (79 loc) · 2.5 KB
/
units.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
<?php
session_start();
require_once "includer.php";
require_once "includes/check_logged.php";
if(!isset($_GET['course'])){
redirect("courses.php");
}
$id = trim($_GET['course']);
if($id === ""){
redirect("courses.php");
}
$course = Course::getById($id);
//if(!is_hod()){
// redirect("index.php");
//}
if(zero($course)){
redirect("courses.php");
}
$units = $course->getUnits();
?>
<html>
<head>
<title>Informatics units</title>
<?php
include_once "includes/styles.php";
?>
</head>
<body>
<?php include_once "includes/hod_logged_in.php"; ?>
<div class="col-md-9 offset-2 align-content-center center-small">
<a href="addunit.php?course=<?= $id ?>" class="btn btn-success btn-sm">Create unit <i class="fa fa-plus-circle"></i> </a>
<div class="clearfix"></div>
<br><br>
<?php
if(count($units) === 0){
?>
<p class="font-weight-light text-center">There are currently no units for <strong class="font-italic"><?= $course->getName() ?> </strong></p>
<?php
} else{
?>
<table class="table table-responsive-lg table-responsive table-light table-hover">
<thead>
<tr class="bg-primary text-white">
<th>ID</th>
<th>Unit Code</th>
<th>Unit Title</th>
<th>Year of study</th>
<th>Semester</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php $i = 1;
foreach ($units as $unit){ ?>
<tr>
<td><?= $i ?></td>
<td><?= $unit->getCode() ?></td>
<td><?= $unit->getTitle() ?></td>
<td><?= $unit->getYearOfStudy() ?></td>
<td><?= $unit->getSemester() ?></td>
<td>
<!-- <div class="btn-group btn-group-sm text-white">-->
<a class="btn btn-outline-primary btn-sm" href="editunit.php?unit=<?= $unit->getId() ?>"><i class="fa fa-edit"></i> </a>
<a class="btn btn-outline-danger btn-sm" href="deleteunit.php?unit=<?= $unit->getId() ?>"><i class="fa fa-trash"></i> </a>
<!-- </div>-->
</td>
</tr>
<?php $i++; } ?>
</tbody>
</table>
<?php
}
?>
</div>
<?php
include_once "includes/scripts.php";
?>
</body>
</html>