-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_med.php
77 lines (73 loc) · 2.31 KB
/
admin_med.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
<?php
session_start();
if((!isset($_SESSION['manager']) && !isset($_SESSION['expert'])))
{
header("Location:index.php");
}
$title = "List of medicines";
require_once "./template/header.php";
require_once "./functions/database_functions.php";
$conn = db_connect();
$result = getAll($conn);
?>
<div>
<a href="admin_signout.php" class="btn btn-danger"><span class="glyphicon glyphicon-off"></span> Logout</a>
<a href="admin_used_for.php" class="btn btn-primary"><span class="glyphicon glyphicon-paperclip"></span> Uses</a>
<a href="admin_types.php" class="btn btn-primary"><span class="glyphicon glyphicon-list-alt"></span> Types</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 New Medicine</a>';
}
?>
</div>
<table class="table" style="margin-top: 20px">
<tr>
<th>Serial number</th>
<th>Medicine name</th>
<th>Manufacturer</th>
<th>Image</th>
<th>Description</th>
<th>Price</th>
<th>Used for</th>
<th>Type</th>
<th> </th>
<th> </th>
</tr>
<?php while($row = mysqli_fetch_assoc($result))
{
?>
<tr>
<td><?php echo $row['med_serial']; ?></td>
<td><?php echo $row['med_name']; ?></td>
<td><?php echo $row['med_manufacturer']; ?></td>
<td><?php echo $row['med_image']; ?></td>
<td><?php echo $row['med_descr']; ?></td>
<td><?php echo $row['med_price']; ?></td>
<td><?php echo getuseName($conn, $row['used_for_id']); ?></td>
<td><?php echo gettypeName($conn, $row['type_id']); ?></td>
<?php
if( isset($_SESSION['expert']) && $_SESSION['expert']==true)
{
echo '<td><a href="admin_edit.php?medserial=';
echo $row['med_serial'];
echo'"><span class="glyphicon glyphicon-pencil"></span>Edit</a></td>';
}
else if (isset($_SESSION['manager']) && $_SESSION['manager']==true)
{
//for deleting medicine
echo '<td><a href="admin_delete.php?medserial=';
echo $row['med_serial'];
echo '"><span class="glyphicon glyphicon-trash"></span>Delete</a></td>';
}
?>
</tr>
<?php } ?>
</table>
<?php
if(isset($conn))
{
mysqli_close($conn);
}
require_once "./template/footer.php";
?>