Postingan lainnya
data dari controller tidak terpanggil di view
coding view
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<form action="<?=base_url('lihat/statistik_strategis');?>" method="get" class="form">
<div class="col-md-2"><?=form_dropdown("dari",$p_tahun,$dari,'class="form-control" required id="dari"');?></div>
<div class="col-md-1"><label for="">Sampai Dengan</label></div>
<div class="col-md-2"><?=form_dropdown("sampai",$p_tahun,$sampai,'class="form-control" required id="sampai"');?></div>
<div class="col-md-1"><label for="">Kata Kunci</label></div>
<div class="col-md-3"><?=form_input("q",$this->input->get('q'),'class="form-control"');?></div>
<div class="col-md-1"><button type="submit" class="btn btn-success"><i class="fa fa-search"></i></button></div>
</form>
</div>
</div>
</div>
</div>
<?=$html;?>
<div style="margin-bottom: 20px">
<p>*) Sumber : Badan Pusat Statistik Kulon Progo</p>
Keterangan Tabel :<br>
<div style="padding: 10px; display: inline; float: left; border: solid 1px #222; margin-right: 10px; background: #9af38a"></div>
<div style="display: inline; float: left; margin-right: 20px"> Angka Sementara </div>
<div style="padding: 10px; display: inline; float: left; border: solid 1px #222; margin-right: 10px; background: #909cf7"></div>
<div style="display: inline; float: left; margin-right: 20px"> Angka Sangat Sementara </div>
</div>
</div>
</div>
<!-- DATA PUBLIKASI BPS -->
<div class="modal fade" id="ModalGrafikDataStrategis" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Grafik</h4>
</div>
<div class="modal-body">
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
</div>
</div>
</div>
</div>
coding controller
public function input_detil() {
$p = $this->input->get();
if (array_key_exists("is_only_statistik_update", $p)) {
$url_new = base_url('index.php/statistik_strategis/input_detil?'.http_build_query($p));
} else {
$url_new = base_url('index.php/statistik_strategis/input_detil?'.http_build_query($p)."&is_only_statistik_update=1");
}
$this->db->where('tahun', $p['tahun']);
$get_data = $this->db->get('data_statistik_strategis_data')->result_array();
$tampung_data_detil = array();
if (!empty($get_data)) {
foreach ($get_data as $data_detil) {
$idx1 = $data_detil['id_ref'];
$idx2 = $data_detil['tahun'];
$tampung_data_detil[$idx1][$idx2]['val'] = $data_detil['isi'];
$tampung_data_detil[$idx1][$idx2]['status'] = $data_detil['status_data'];
}
}
// get elemen
$this->db->order_by('kode1', 'asc');
$this->db->order_by('kode2', 'asc');
if (!empty($p['is_only_statistik_update'])) {
if ($p['is_only_statistik_update'] == 1) {
$this->db->where('sebagai_statistik_update', 1);
}
}
$get_elemen = $this->db->get('data_statistik_strategis_ref')->result_array();
$html = '<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Nama</th>
';
// foreach ($p['tahun'] as $t) {
$html .= '<th>' . $p['tahun'] . '</th>';
$html .= '<th>Status Data</th>';
// $html .= '<th>' . $t . '</th>';
// }
$html .= '</tr></thead><tbody>';
foreach ($get_elemen as $g) {
$nama = '<b><i>'.$g['nama'].'</i></b>';
if ($g['kode1'] != "0" && $g['kode2'] != "0" && $g['kode3'] == "0") {
$nama = '<div style="margin-left: 40px">'.$g['nama'].'</div>';
} else if ($g['kode1'] != "0" && $g['kode2'] != "0" && $g['kode3'] != "0") {
$nama = '<div style="margin-left: 80px; text-transform: uppercase; font-weight: bold">'.$g['nama'].'</div>';
}
$html .= '<tr><td>' . $nama . '</td>';
$valu = "";
$stat = "";
$idx_elemen = $g['id'];
$t = $p['tahun'];
$idx_tahun = $t;
if (!empty($tampung_data_detil[$idx_elemen][$idx_tahun]['val'])) {
$valu = $tampung_data_detil[$idx_elemen][$idx_tahun]['val'];
}
if (!empty($tampung_data_detil[$idx_elemen][$idx_tahun]['status'])) {
$stat = $tampung_data_detil[$idx_elemen][$idx_tahun]['status'];
}
if($valu=='0.0000') {
$valu = "";
}
if (($g['kode1'] != "0" && $g['kode2'] == "0") || $g['mode_terhadap_child'] == 0) {
$html .= '<td><input type="text" style="text-align: right" name="data[' . $g['id'] . '][' . $t . '][val]" class="form-control input-sm" value="' . $valu . '"></td>';
$html .= '<td>'.form_dropdown('data['.$g['id'].']['.$t.'][status]', array("1"=>"OK","2"=>"Angka Sementara","3"=>"Angka Sangat Sementara"), $stat, 'class="form-control input-sm"').'</td>';
} else {
$html .= '<td> </td><td> </td>';
}
$html .= '</tr>';
}
$html .= '<tr><th colspan="3"><button type="submit" id="tbSubmit" class="btn btn-success">Simpan</button> <a href="' . base_url('index.php/statistik_strategis') . '" class="btn btn-danger">Kembali</a></th></tr></tbody></table>';
$d['url_new'] = $url_new;
$d['p'] = "view_form";
$d['html_form'] = $html;
$d['js'] = ["statistik_strategis_detil.js"];
$d['menu_aktif'] = 3;
$d['title'] = "Input Statistik Strategis";
$d['bredkum'] = bredkum(array("statistik_strategis" => $d['title']), "statistik_strategis");
$this->load->view('template', $d);
}
$d['data'] = $mo;
$d['p'] = "view";
$d['js'] = ["statistik_strategis.js"];
$d['menu_aktif'] = 3;
$d['title'] = "Statistik Strategis";
$d['bredkum'] = bredkum(array("statistik_strategis" => $d['title']), "statistik_strategis");
$this->load->view('template', $d);
}
Tanggapan
Baca aturan main di forum ini ya, sertakan kode atau gambar jika perlu, rapikan kode, taro di tag kode, jangan menumpuk pertanyaan di jawaban, tapi jadikan satu pertanyaan, jawaban untuk menjawab
1 Jawaban:
<div>di controller data kosong<br><figure data-trix-attachment="{"contentType":"image/png","filename":"image.png","filesize":308428,"height":1080,"url":"https://i.ibb.co/hXYY8HH/image.png","width":1920}" data-trix-content-type="image/png" data-trix-attributes="{"presentation":"gallery"}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/hXYY8HH/image.png" width="1920" height="1080"><figcaption class="attachment__caption"><span class="attachment__name">image.png</span></figcaption></figure><br>di view muncul 0,00<br></div>