358 lines
14 KiB
PHP
358 lines
14 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
$this->load->view('dist/_partials/user/header_user');
|
|
?>
|
|
|
|
<main id="main">
|
|
|
|
<!-- ======= Portfolio Section ======= -->
|
|
<section id="portfolio" class="portfolio">
|
|
<div class="container" data-aos="fade-up">
|
|
|
|
<div class="section-title">
|
|
<h2>Peta</h2>
|
|
<p>Daerah Rawan Pencurian Ternak Kabupaten Lumajang</p>
|
|
<?php
|
|
$tahunt = "SELECT DISTINCT(tahun) as th from predikat";
|
|
$ta2 = $this->db->query($tahunt);
|
|
?>
|
|
</div>
|
|
<?php
|
|
foreach ($ta2->result_array() as $tess) {
|
|
$tahunnya=$tess['th'];
|
|
}
|
|
$_th = $_GET['tahun'];
|
|
if ($_th==''){
|
|
$tahundapat=$tahunnya;
|
|
}else{
|
|
$tahundapat=$_th;
|
|
}
|
|
?>
|
|
<ul id="portfolio-flterss" class="d-flex justify-content-center" data-aos="fade-up" data-aos-delay="100">
|
|
<?php foreach ($ta2->result_array() as $ok) { ?>
|
|
<a href="<?php echo base_url()?>welcome/peta?tahun=<?php echo $ok['th'];?>"><li data-filter=".<?php echo $ok['th'];?>" class="<?php echo $tahundapat == $ok['th'] ? 'filter-active' : ''; ?>"><?php echo $ok['th'];?></li></a>
|
|
<?php } ?>
|
|
</ul>
|
|
|
|
|
|
|
|
<!-- Main Content -->
|
|
<div class="main-contentt">
|
|
<section class="section">
|
|
|
|
<?php
|
|
$tahunt = "SELECT DISTINCT(tahun) as th from predikat";
|
|
$ta22 = $this->db->query($tahunt);
|
|
|
|
?>
|
|
<?php
|
|
|
|
foreach ($ta22->result_array() as $tesss) {
|
|
$tahunnyaa=$tesss['th'];
|
|
}
|
|
$_thhh = $_GET['tahun'];
|
|
if ($_thhh==''){
|
|
$cek=$tahunnyaa;
|
|
}else{
|
|
$cek=$_thhh;
|
|
}
|
|
|
|
$q1 = "SELECT COUNT(hasil=$cek) as ok from predikat WHERE hasil='sangat rawan' and tahun='$cek'";
|
|
$q2 = "SELECT COUNT(hasil=$cek) as ok from predikat WHERE hasil='rawan' and tahun='$cek'";
|
|
$q3 = "SELECT COUNT(hasil) as ok from predikat WHERE hasil='aman' and tahun='$cek'";
|
|
$tampil1 = $this->db->query($q1);
|
|
$tampil2 = $this->db->query($q2);
|
|
$tampil3 = $this->db->query($q3);
|
|
?>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-4 col-md-6 col-sm-6 col-12">
|
|
<div class="card card-statistic-1">
|
|
<div class="card-icon bg-danger">
|
|
<i class="fas fa-times"></i>
|
|
</div>
|
|
<div class="card-wrap">
|
|
<div class="card-header">
|
|
<h4>Sangat Rawan</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
|
|
<?php
|
|
foreach ($tampil1->result_array() as $t1) {
|
|
echo $t1['ok'];
|
|
}
|
|
?> kecamatan
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-lg-4 col-md-6 col-sm-6 col-12">
|
|
<div class="card card-statistic-1">
|
|
<div class="card-icon bg-warning">
|
|
<i class="fas fa-exclamation-triangle"></i>
|
|
</div>
|
|
<div class="card-wrap">
|
|
<div class="card-header">
|
|
<h4>Rawan</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<?php
|
|
foreach ($tampil2->result_array() as $t2) {
|
|
echo $t2['ok'];
|
|
}
|
|
?> kecamatan
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-4 col-md-6 col-sm-6 col-12">
|
|
<div class="card card-statistic-1">
|
|
<div class="card-icon bg-success">
|
|
<i class="fas fa-check"></i>
|
|
</div>
|
|
<div class="card-wrap">
|
|
<div class="card-header">
|
|
<h4>Aman</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<?php
|
|
foreach ($tampil3->result_array() as $t3) {
|
|
echo $t3['ok'];
|
|
}
|
|
?> kecamatan
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php ?>
|
|
</section>
|
|
</div>
|
|
|
|
|
|
<div class="row portfolio-container" data-aos="fade-up" data-aos-delay="200">
|
|
|
|
|
|
<!-- <div class="col-lg-12 col-md-12 portfolio-item 2019">
|
|
<div id="mapid" style="height:600px;"></div>
|
|
</div> -->
|
|
|
|
<div class="col-lg-12 col-md-12 portfolio-item <?php echo $tahundapat;?>">
|
|
<div id="mapid" style="height:600px;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</section><!-- End Portfolio Section -->
|
|
|
|
|
|
|
|
</main><!-- End #main -->
|
|
|
|
<script>
|
|
|
|
var map = L.map("mapid").setView([-8.137977327799765, 113.13331709073779], 11);
|
|
|
|
var basemap = L.tileLayer(
|
|
"https://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}",
|
|
{
|
|
maxZoom: 20,
|
|
subdomains: ["mt0", "mt1", "mt2", "mt3"],
|
|
attribution: 'Google | <a href="#">unsorry@2020</a>',
|
|
}
|
|
);
|
|
basemap.addTo(map);
|
|
|
|
|
|
|
|
|
|
// control that shows state info on hover
|
|
var info = L.control();
|
|
|
|
info.onAdd = function (map) {
|
|
this._div = L.DomUtil.create('div', 'info1');
|
|
this.update();
|
|
return this._div;
|
|
};
|
|
|
|
info.update = function (props) {
|
|
|
|
};
|
|
|
|
info.addTo(map);
|
|
|
|
function getColor(d) {
|
|
return d == 3 ? '#ff510d' :
|
|
d == 2 ? '#fcff0d' :
|
|
d == 1 ? '#0dffa8' :
|
|
'#0dffa8';
|
|
}
|
|
|
|
function style(feature) {
|
|
return {
|
|
weight: -1,
|
|
opacity: 0.5,
|
|
color: 'black',
|
|
|
|
fillOpacity: 0.3,
|
|
fillColor: getColor(feature)
|
|
};
|
|
}
|
|
|
|
function highlightFeature(e) {
|
|
var layer = e.target;
|
|
var placeId = layer.feature.properties.GID_4;
|
|
layer.setStyle({
|
|
weight: 5,
|
|
opacity: 1,
|
|
color: 'black',
|
|
dashArray: '',
|
|
fillOpacity: 1
|
|
});
|
|
|
|
if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
|
|
layer.bringToFront();
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
var jsonData;
|
|
|
|
function resetHighlight(e) {
|
|
// jsonData.resetStyle(e.target);
|
|
var layer = e.target;
|
|
layer.setStyle({
|
|
weight: -1,
|
|
opacity: 0.5,
|
|
color: 'black',
|
|
fillOpacity: 0.4,
|
|
});
|
|
|
|
if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
|
|
layer.bringToFront();
|
|
}
|
|
|
|
info.update();
|
|
}
|
|
|
|
function zoomToFeature(e) {
|
|
map.fitBounds(e.target.getBounds());
|
|
}
|
|
|
|
function onEachFeature(feature, layer) {
|
|
layer.on({
|
|
mouseover: highlightFeature,
|
|
mouseout: resetHighlight,
|
|
|
|
});
|
|
var content = layer.feature.properties.name.toString();
|
|
layer.bindTooltip(content, {
|
|
direction: "center",
|
|
permanent: true,
|
|
className: "styleLabelkecamatan",
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
<?php
|
|
$tahunt2 = "SELECT DISTINCT(tahun) as th from predikat";
|
|
$ta22 = $this->db->query($tahunt2);
|
|
foreach ($ta22->result_array() as $tess2) {
|
|
$tahunnya2=$tess2['th'];
|
|
}
|
|
$_thh =$_GET['tahun'];
|
|
if ($_thh==''){
|
|
$th=$tahunnya2;
|
|
}else{
|
|
$th=$_thh;
|
|
}
|
|
|
|
foreach ($rendah->result_array() as $r) {
|
|
$_r = $r['alternatif_id'];
|
|
|
|
$data_kamp = $this->db->query("SELECT alternatif_file FROM alternatif WHERE alternatif_id = '$_r'")->row();
|
|
$data_krit = $this->db->query("SELECT * FROM kriteria WHERE alternatif_id = '$_r' and tahun='$th'")->row();
|
|
$nama = $this->db->query("SELECT alternatif_nama FROM alternatif WHERE alternatif_id = '$_r'")->row();?>
|
|
var jsonData = new L.GeoJSON.AJAX([
|
|
"<?php echo base_url() ?>assets/geojson/<?=$data_kamp->alternatif_file?>"
|
|
], {
|
|
onEachFeature: onEachFeature,
|
|
style: style(1)
|
|
},
|
|
|
|
)
|
|
.addTo(map)
|
|
.bindPopup("<?php echo '<center><b style=color:green;>' . $nama->alternatif_nama . ' ' . $th . '<br>' . '<img width=100px src=' . base_url('assets/img/check.gif') . '>' . '</b></center>'; ?> <div class='table-responsive'><table class='table table-striped'><thead align='center'><?php foreach ($tes->result() as $tb) {$namak = $tb->nama;$isik = $tb->isi;$klask = $tb->klas;?><tr><th width='30px'><?php echo $klask; ?></th><th style='text-align:left';> <?php echo $namak; ?></th><th><?php echo $data_krit->$isik; ?></th></tr><?php }?></thead></table></div>");
|
|
|
|
<?php
|
|
}
|
|
foreach ($sedang->result_array() as $s) {
|
|
$_s = $s['alternatif_id'];
|
|
$data_kamp = $this->db->query("SELECT alternatif_file FROM alternatif WHERE alternatif_id = '$_s'")->row();
|
|
$data_krit2 = $this->db->query("SELECT * FROM kriteria WHERE alternatif_id = '$_s' and tahun='$th'")->row();
|
|
$nama = $this->db->query("SELECT alternatif_nama FROM alternatif WHERE alternatif_id = '$_s'")->row();?>
|
|
var jsonData = new L.GeoJSON.AJAX([
|
|
|
|
"<?php echo base_url() ?>assets/geojson/<?=$data_kamp->alternatif_file?>"
|
|
], {
|
|
onEachFeature: onEachFeature,
|
|
style: style(2)
|
|
}).addTo(map)
|
|
.bindPopup("<?php echo '<center><b style=color:yellow;>' . $nama->alternatif_nama . ' ' . $th . '<br>' . '<img width=100px src=' . base_url('assets/img/warning.gif') . '>' . '</b></center>'; ?> <div class='table-responsive'><table class='table table-striped'><thead align='center'><?php foreach ($tes->result() as $tb) {$namak = $tb->nama;$isik = $tb->isi;$klask = $tb->klas;?><tr><th width='30px'><?php echo $klask; ?></th><th style='text-align:left';> <?php echo $namak; ?></th><th><?php echo $data_krit2->$isik; ?></th></tr><?php }?></thead></table></div>");
|
|
<?php
|
|
}
|
|
foreach ($tinggi->result_array() as $t) {
|
|
$_t = $t['alternatif_id'];
|
|
$data_kamp = $this->db->query("SELECT alternatif_file FROM alternatif WHERE alternatif_id = '$_t'")->row();
|
|
$data_krit3 = $this->db->query("SELECT * FROM kriteria WHERE alternatif_id = '$_t' and tahun='$th'")->row();
|
|
$nama = $this->db->query("SELECT alternatif_nama FROM alternatif WHERE alternatif_id = '$_t'")->row();?>
|
|
var jsonData = new L.GeoJSON.AJAX([
|
|
"<?php echo base_url() ?>assets/geojson/<?=$data_kamp->alternatif_file?>"
|
|
], {
|
|
onEachFeature: onEachFeature,
|
|
style: style(3)
|
|
}).addTo(map)
|
|
.bindPopup("<?php echo '<center><b style=color:red;>' . $nama->alternatif_nama . ' ' . $th . '<br>' . '<img width=100px src=' . base_url('assets/img/danger.gif') . '>' . '</b></center>'; ?> <div class='table-responsive'><table class='table table-striped'><thead align='center'><?php foreach ($tes->result() as $tb) {$namak = $tb->nama;$isik = $tb->isi;$klask = $tb->klas;?><tr><th width='30px'><?php echo $klask; ?></th><th style='text-align:left';> <?php echo $namak; ?></th><th><?php echo $data_krit3->$isik; ?></th></tr><?php }?></thead></table></div>");
|
|
<?php
|
|
}?>
|
|
|
|
// map.attributionControl.addAttribution('Population data © <a href="http://census.gov/">US Census Bureau</a>');
|
|
|
|
|
|
var legend = L.control({
|
|
position: 'bottomright'
|
|
});
|
|
|
|
legend.onAdd = function (map) {
|
|
|
|
var label = ['Aman', 'Rawan', 'Sangat Rawan'];
|
|
|
|
var div = L.DomUtil.create('div', 'info1 legend'),
|
|
grades = [1, 2, 3],
|
|
labels = [],
|
|
from, to;
|
|
|
|
for (var i = 0; i < grades.length; i++) {
|
|
from = grades[i];
|
|
to = grades[i + 1];
|
|
|
|
labels.push(
|
|
'<i style="background:' + getColor(from) + '"></i>' + label[i]);
|
|
}
|
|
|
|
div.innerHTML = labels.join('<br>');
|
|
return div;
|
|
};
|
|
|
|
legend.addTo(map);
|
|
|
|
|
|
</script>
|
|
|
|
<?php $this->load->view('dist/_partials/footer_user'); ?>
|