Commit 979a0ffe authored by Deddy Vita Kurniawan's avatar Deddy Vita Kurniawan

redmine#15879

* tambah field JUDUL, KRITERIA, SEBAB, AKIBAT, TANGGAPAN di tabel temuan_jenis * tambah field ID_REKOMENDASI, TIPE, FILENAME di tabel temuan_jenis_rinci
parent d5dac608
......@@ -2332,6 +2332,7 @@ class Pilih extends Pilih_Controller
$result[$i]['jenis_pemeriksaan'],
$result[$i]['penugasan'],
$result[$i]['nomor'],
$result[$i]['tanggal_surat'],
);
}
}
......@@ -2396,7 +2397,7 @@ class Pilih extends Pilih_Controller
);
}
else{
$data['colnames'] = array('', '', '', '', '', '', '', 'Nomor Surat Tugas');
$data['colnames'] = array('', '', '', '', '', '', '', 'Nomor Surat Tugas', 'Tanggal');
$data['colmodel'] = array(
array('name' => 'id_st', 'hidden' => true),
array('name' => 'id_tgs', 'hidden' => true),
......@@ -2406,6 +2407,7 @@ class Pilih extends Pilih_Controller
array('name' => 'jns_prs', 'hidden' => true),
array('name' => 'penugasan', 'hidden' => true),
array('name' => 'no', 'width' => 400, 'sortable' => true, 'search' => true, 'datatype' => 'string'),
array('name' => 'tanggal_surat', 'width' => 150, 'sortable' => true, 'search' => true, 'formatter' => 'date'),
);
}
$data['orderby'] = 'no';
......@@ -3043,4 +3045,34 @@ class Pilih extends Pilih_Controller
echo json_encode($response);
}
/*
Pilih rekomendasi
Keterangan : mengembalikan daftar rekomendasi
Dipakai di modul temuan
Digunakan untuk komponen select2
*/
function pilih_rekomendasi()
{
$q = $this->input->post('q');
$mode = $this->input->post('mode');
$req_param = array(
"q" => $q,
"mode" => $mode
);
$result = $this->pilih_model->getRekomendasiSelect($req_param);
$response = (object) NULL;
$response->results = array();
if ($result) {
for ($i = 0; $i < count($result); $i++) {
$response->results[] = array(
'id' => (string) $result[$i]['id_rekomendasi'],
'text' => (string) $result[$i]['kode'] ." - ". $result[$i]['uraian_rekomendasi'],
);
}
}
$response->sql = $this->db->queries;
echo json_encode($response);
}
}
......@@ -2749,4 +2749,19 @@ class Pilih_dasar_model extends Pilih_Model
$result = $this->db->get()->result_array();
return $result;
}
function getRekomendasiSelect($param)
{
$this->db->select('
a.id_rekomendasi,
a.kode,
a.uraian_rekomendasi
');
$this->db->from('ref_rekomendasi a');
if ($param['q'] != '')
$this->db->like('Upper(a.uraian_rekomendasi)', strtoupper($param['q']));
$this->db->order_by('a.kode');
$result = $this->db->get()->result_array();
return $result;
}
}
......@@ -2,21 +2,27 @@
class Temuan extends AktivitasBLUD_Controller
{
var $real_path;
public function __construct()
{
parent::__construct();
$this->modul_name = 'temuan';
$this->modul_display = 'Draft Temuan';
$this->modul_display = 'Temuan';
$this->view_form = 'temuan_form';
$this->view_daftar = 'temuan_view';
$this->report_daftar = 'Daftar Draft Temuan';
$this->report_form = 'Form Draft Temuan';
$this->report_daftar = 'Daftar Temuan';
$this->report_form = 'Form Temuan';
$this->load->model('temuan_model', 'data_model');
$this->message_aktivitas_dihapus = 'Draft Temuan telah dihapus.';
$this->message_aktivitas_gagal_dihapus = 'Draft Temuan tidak bisa dihapus.';
$this->message_gagal_dihapus_dependency = 'Draft Temuan digunakan di aktivitas lain.';
$this->message_aktivitas_dihapus = 'Temuan telah dihapus.';
$this->message_aktivitas_gagal_dihapus = 'Temuan tidak bisa dihapus.';
$this->message_gagal_dihapus_dependency = 'Temuan digunakan di aktivitas lain.';
$this->real_path = dirname( realpath(SELF) )."/uploads/";
if (!file_exists($this->real_path)) {
mkdir('./uploads/', 0777, true);
}
}
function validasi()
......@@ -32,79 +38,129 @@ class Temuan extends AktivitasBLUD_Controller
$this->form_validation->set_message('max_length', '%s tidak boleh melebihi %s karakter.');
}
function rinci($id = 0)
function rinci($id = 0,$tipe)
{
$result = $this->data_model->get_rinci_by_id($id);
$result = $this->data_model->get_rinci_by_id($id,$tipe);
$response = (object) null;
$last_kkp = '';
if ($result) {
$x=1;
for ($i = 0; $i < count($result); $i++) {
if ($result[$i]['nomor_kkp'] !== $last_kkp)
{
$idx = 'b'.$x;
$row = new stdclass();
$row->id = $idx;
$row = new stdclass();
$row->id = $result[$i]['id_rinci_temuan'];
if($tipe == '1'){
$row->cell = array(
$idx,
'',
$result[$i]['id_rinci_temuan'],
$result[$i]['id_rekomendasi'],
$result[$i]['kode'].' - '.$result[$i]['uraian_rekomendasi'],
$result[$i]['deskripsi'],
);
}
else if($tipe == '2'){
$row->cell = array(
$result[$i]['id_rinci_temuan'],
'',
$result[$i]['nomor_kkp'],
'<a href="" style="padding: 0px 2px 0px 2px; text-decoration: underline" id="'.$idx.'" onclick="return false;" class="view_file">lihat</a>',
$result[$i]['simpulan'],
$result[$i]['nomor_kkp'],
1,
$result[$i]['filename'],
$result[$i]['filename'],
'<input type="file" id="monitoring-file" class="monitoring-fileChanged" accept="application/pdf,.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel, image/gif, image/jpeg">',
);
$response->rows[] = $row;
$x+=1;
}
$row = new stdclass();
$row->id = $result[$i]['id_rinci_temuan'];
$row->cell = array(
$result[$i]['id_rinci_temuan'],
$result[$i]['id_ref_temuan'],
$result[$i]['jenis_temuan'],
$result[$i]['deskripsi'],
'',
'',
$result[$i]['nomor_kkp'],
0,
);
$response->rows[] = $row;
$last_kkp = $result[$i]['nomor_kkp'];
$response->rows[] = $row;
}
}
//$response->sql = $this->db->queries;
//die(print_r($response));
echo json_encode($response);
}
public function data_kkp($id_surat)
function hapus_file()
{
$response = (object) null;
$response = (object) NULL;
$id = $this->input->post('id')?$this->input->post('id'):0;
$nama_file = $this->input->post('nama_file')?$this->input->post('nama_file'):'';
if (file_exists(dirname($_SERVER['SCRIPT_FILENAME']).'/uploads/'.$nama_file)) {
$logo_file = dirname($_SERVER['SCRIPT_FILENAME']).'/uploads/'.$nama_file;
unlink($logo_file);
$response->message = 'File berhasil di hapus';
$response->isSuccess = TRUE;
}
else{
$response->message = 'File tidak ditemukan';
$response->isSuccess = FALSE;
}
echo json_encode($response);
}
function preview($filename){
$this->load->helper('file');
$dokumen = $this->real_path.$filename;
$this->load->helper('file');
if (!file_exists($dokumen)) {
$this->output->set_status_header(500);
return;
}
$ext = strtolower(pathinfo($dokumen, PATHINFO_EXTENSION));
$result = $this->data_model->get_data_kkp($id_surat);
header('Content-Disposition: filename="'.$filename.'"');
header('Content-Type: application/$ext');
header('Content-Length: '.filesize($dokumen));
header('Cache-Control: no-store');
readfile($dokumen);
}
function upload(){
$is_siup = isset($_FILES['hasil']);
$response = (object) null;
if ($result) {
$x=1;
for ($i = 0; $i < count($result); $i++) {
$idx = 'b'.$x;
$response->rows[$i]['id'] = $idx;
$response->rows[$i]['cell'] = array(
$idx,
'',
'',
$result[$i]['nomor_kkp'],
'<a href="" style="padding: 0px 2px 0px 2px; text-decoration: underline" id="'.$idx.'" onclick="return false;" class="view_file">lihat</a>',
$result[$i]['simpulan'],
$result[$i]['nomor_kkp'],
1,
);
$x+=1;
$result = $this->proses_dokumen($_FILES['hasil']);
//die(print_r($result));
echo json_encode( $result );
}
function proses_dokumen($file){
$this->load->helper('file');
$valid_exts = array('pdf','xls','jpg','jpeg','png','doc'); // valid extensions
$max_size = 10000 * 1024;
// get uploaded file extension
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
// looking for format and size validity
if (in_array($ext, $valid_exts) AND $file['size'] < $max_size)
{
// unique file path ;
$uid = uniqid();
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
$realname = $uid."-".$this->TextKeSlug(pathinfo($file['name'], PATHINFO_FILENAME)).".".$ext;
$path = $this->real_path . $realname;
// move uploaded file from temp to uploads directory
if (move_uploaded_file($file['tmp_name'], $path))
{
$result = array('status' => true, 'filename' => $realname, 'realname' => $realname);
}
else {
$result = array('status' => false, 'deskripsi' => 'gagal mengunggah dokumen');
}
}
echo json_encode($response);
else {
$result = array('status' => false, 'deskripsi' => 'hanya menerima file pdf,xls,jpg,jpeg,png,doc');
}
return $result;
}
function TextKeSlug($text) {
$text = trim($text);
if (empty($text)) return '';
$text = preg_replace("/[^a-zA-Z0-9\-\s]+/", "", $text);
$text = strtolower(trim($text));
$text = str_replace(' ', '-', $text);
$text = $text_ori = preg_replace('/\-{2,}/', '-', $text);
return $text;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment