| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/laragon3/www/_sakip/modules/ |
Upload File : |
<?php
//disini menggunakan link demo
$curl = curl_init();
$curl2 = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sakip.lumajangkab.go.id/api-sakip/read',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => array(
'nama_opd' => $nama_opd,
),
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
));
curl_setopt_array($curl2, array(
CURLOPT_URL => 'https://sakip.lumajangkab.go.id/api-sakip/api-katsakip',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
));
$response = curl_exec($curl);
$response2 = curl_exec($curl2);
curl_close($curl);
curl_close($curl2);
$json = json_decode($response, true);
$json2 = json_decode($response2, true);
?>
<div class="row" style="margin-top: 50px">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading" style="height:50px">
DAFTAR SAKIP
<a href="index.php?p=b_form_sakip" class="btn btn-success btn-sm pull-right">
<i class="glyphicon glyphicon-plus"></i> Tambah
</a>
</div>
<div class="panel-body">
<form class="form-horizontal">
<?= @$_SESSION['alert']?>
<div class="form-group">
<label for="" class="col-md-1">Kategori</label>
<div class="col-md-3">
<select name="kategori" class="form-control">
<option value="">Semua</option>
<?php foreach ($json2['data'] as $key => $value) {?>
<option><?=$value['nama_katsakip']?></option>
<?php }?>
</select>
</div>
</div>
</form>
<table class="table table-striped table-bordered" id="datatable1">
<thead>
<tr>
<th class="text-center">No</th>
<th class="text-center">Judul</th>
<th class="text-center">Kategori</th>
<th class="text-center">Tahun</th>
<th class="text-center">Tanggal Upload</th>
<th class="text-center">Aksi</th>
</tr>
</thead>
<tbody>
<?php foreach ($json['data'] as $key => $value) {
?>
<tr>
<td></td>
<td><?=$value['judul']?></td>
<td><?=$value['kategori']?></td>
<td><?=$value['tahun']?></td>
<td><?=$value['tgl_upload']?></td>
<td class="text-center">
<a href="<?=$value['link_file']?>" target="_blank" class="btn btn-primary btn-sm">
<i class="glyphicon glyphicon-download"></i>
</a>
<a href="index.php?p=b_form_sakip&id=<?= $value['id']?>" class="btn btn-info btn-sm">
<i class="glyphicon glyphicon-edit"></i>
</a>
<a href="#" onclick="hapus(<?= $value['id']?>)" class="btn btn-danger btn-sm">
<i class="glyphicon glyphicon-trash"></i>
</a>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/dt-1.10.23/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs/dt-1.10.23/datatables.min.js"></script>
<script>
$(document).ready( function () {
var dt = $('#datatable1').DataTable({
"columnDefs": [ {
"searchable": false,
"orderable": false,
"targets": 0
} ],
"order": [[ 3, 'desc' ],[4,'desc']]
});
$('[name=kategori]').change(function(){
dt.columns(2).search(this.value).draw();
});
dt.on( 'order.dt search.dt', function () {
dt.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
cell.innerHTML = i+1;
} );
} ).draw();
} );
function hapus(id)
{
if(confirm('Hapus ?')) window.location = 'modules/hapus_sakip.php?id='+id;
}
</script>