-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpegawai.php
162 lines (148 loc) · 6.08 KB
/
pegawai.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
session_start();
if($_SESSION['login']!='login') header('Location: login.php');
include 'koneksi.php'; // include = menambahkan/mengikutkan file, setting koneksi ke database
?>
<!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">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<title>Dashboard Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/dashboard.css" rel="stylesheet">
<!-- DATA TABLES -->
<link href="css/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<link href="css/dataTables.tableTools.min.css" rel="stylesheet" type="text/css" />
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="../../assets/js/ie-emulation-modes-warning.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Genta ESP Admin</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><?php echo "Hello, ".ucwords($_SESSION['user']);?></a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<?php if($_SESSION['level']=='admin'){?>
<li><a href="user.php">User <span class="sr-only">(current)</span></a></li>
<?php } ?>
<li class="active"><a href="#">Pegawai</a></li>
<li><a href="divisi.php">Divisi</a></li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Dashboard <?php echo ucfirst($_SESSION['level']);?></h1>
<div>
<a type="button" class="btn btn-primary" href="tambah_pegawai.php">Tambah Pegawai</a>
</div>
<br>
<div>
<table id="example1" class="table table-bordered table-striped dataTable" aria-describedby="example1_info">
<thead>
<tr role="row">
<th>No</th>
<th>Nama</th>
<th>Alamat</th>
<th>Divisi</th>
<th>Pilihan</th>
</tr>
</thead>
<tfoot>
<tr role="row">
<th>No</th>
<th>Nama</th>
<th>Alamat</th>
<th>Divisi</th>
<th>Pilihan</th>
</tr>
</tfoot>
<tbody role="alert" aria-live="polite" aria-relevant="all">
<?php
$result = $mysqli->query("select p.id_pegawai, p.nama, p.alamat, d.divisi
from pegawai p, divisi d
where p.id_divisi = d.id_divisi");
if($result->num_rows > 0){
// echo "pegawai ada";
$no = 1;
while($row = $result->fetch_assoc()) {
?>
<tr class="odd">
<td class=" "><?php echo $no++; ?></td>
<td class=" "><?php echo ucfirst($row['nama']); ?></td>
<td class=" "><?php echo ucfirst($row['alamat']); ?></td>
<td class=" "><?php echo ucfirst($row['divisi']); ?></td>
<td class=" ">
<a type="button" class="btn btn-warning btn-xs" href="update_pegawai.php?id=<?php echo $row['id_pegawai'];?>">Update</a>
<a type="button" class="btn btn-danger btn-xs" href="delete_pegawai.php?id=<?php echo $row['id_pegawai'];?>" onClick="return confirm('Menghapus data pegawai <?php echo ucfirst($row['nama']);?> ?');">Delete</a>
</td>
</tr>
<?php
}
}
?>
</tbody></table>
</div>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- DATA TABES SCRIPT -->
<script src="js/jquery.dataTables.js" type="text/javascript"></script>
<script src="js/dataTables.bootstrap.js" type="text/javascript"></script>
<script src="js/dataTables.tableTools.min.js" type="text/javascript"></script>
<!-- Just to make our placeholder images work. Don't actually copy the next line! -->
<script src="js/holder.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
<!-- page script -->
<script type="text/javascript">
$(function () {
$("#example1").dataTable();
$('#example2').dataTable({
"bPaginate": true,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": true,
"bAutoWidth": false
});
});
</script>
</body>
</html>