-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_types.php
60 lines (58 loc) · 2.04 KB
/
admin_types.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
<?php
session_start();
if((!isset($_SESSION['manager']) && !isset($_SESSION['expert'])))
{
header("Location:index.php");
}
$title = "List of types";
require_once "./template/header.php";
require_once "./functions/database_functions.php";
$conn = db_connect();
$result = getAlltypes($conn);
?>
<div>
<a href="admin_signout.php" class="btn btn-danger"><span class="glyphicon glyphicon-off"></span> Logout</a>
<a href="admin_med.php" class="btn btn-primary"><span class="glyphicon glyphicon-book"></span> Medicines</a>
<a href="admin_used_for.php" class="btn btn-primary"><span class="glyphicon glyphicon-paperclip"></span> Uses</a>
<?php
if (isset($_SESSION['manager']) && $_SESSION['manager']==true)
{
echo '<a class="btn btn-primary" href="admin_add.php"><span class="glyphicon glyphicon-plus"></span> Add Medicine</a>';
}
?>
</div>
<table class="table" style="margin-top: 20px">
<tr>
<th>Name</th>
<th> </th>
<th> </th>
</tr>
<?php while($row = mysqli_fetch_assoc($result)){ ?>
<tr>
<td><?php echo $row['type_name']; ?></td>
<?php
if( isset($_SESSION['expert']) && $_SESSION['expert']==true)
{
echo '<td><a href="admin_edittypes.php?typeid=';
echo $row['type_id'];
echo'"><span class="glyphicon glyphicon-pencil"></span> Edit</a></td>';
}
else if (isset($_SESSION['manager']) && $_SESSION['manager']==true)
{
echo '<td><a href="admin_deletetypes.php?typeid=';
echo $row['type_id'];
echo '"><span class="glyphicon glyphicon-trash"></span> Delete</a></td>';
}
?>
</tr>
<?php } ?>
</table>
<?php
if (isset($_SESSION['manager']) && $_SESSION['manager']==true){
echo '<a class="btn btn-primary" href="admin_addtype.php"><span class="glyphicon glyphicon-plus"></span> Add type</a>';
}
?>
<?php
if(isset($conn)) {mysqli_close($conn);}
require_once "./template/footer.php";
?>