Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 28.12 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class List_surat_penyaluran extends CI_Controller {
  4.     function __construct(){
  5.         parent::__construct();
  6.         error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
  7.         $this->load->model('Model_penyaluran');
  8.         $this->load->model('Model_wilayah');
  9.         $this->load->model('Model_tanggapan');
  10.         $this->load->model('M_rekap');
  11.         $this->load->library('pagination');
  12.         $this->load->library('M_pdf');
  13.         $this->load->helper('url');
  14.  
  15.     }
  16.  
  17.     // new lihat data
  18.     function lihat($id){
  19.         if($this->auth->is_logged_in() == false)
  20.       {
  21.          redirect('Login');
  22.       }
  23.       else
  24.       {
  25.             if($this->auth->is_user() == false)
  26.           {
  27.              redirect('Login');
  28.  
  29.           }
  30.             else{
  31.               $nomor_agenda=decrypt($id);
  32.               $where =   mysqli_real_escape_string(mysqli_connect(),$nomor_agenda);
  33.               $data['penyaluran_data'] = $this->Model_penyaluran->lihatdata($where);
  34.        
  35.               $this->load->view('lihat_penyaluran',$data);
  36.             }
  37.       }
  38.        
  39.     }
  40.     // new tampil edit penyaluran
  41.    
  42.     function edit($id){
  43.         if($this->auth->is_logged_in() == false)
  44.       {
  45.          redirect('Login');
  46.       }
  47.       else
  48.       {
  49.             if($this->auth->is_user() == false)
  50.           {
  51.              redirect('Login');
  52.  
  53.           }
  54.             else{
  55.                 $nomor_agenda=decrypt($id);
  56.                 $where = mysqli_real_escape_string(mysqli_connect(),$nomor_agenda);
  57.                 // $data['baris'] = $this->Model_penyaluran->edit_data($where,'agenda_terlapor')->result();
  58.                 $data2= $this->Model_penyaluran->edit_data($where);
  59.                 $data['baris']=$data2;
  60.                 foreach ($data2 as $row){
  61.                     $data['combo_jns_penyimpangan']=$this->Model_wilayah->get_jenispenyimpangan2($row->id_penyimpangan);
  62.                     $data['combo_kabu']=$this->Model_wilayah->get_kabupaten($row->prov);
  63.                     $data['combo_kabupaten']=$this->Model_wilayah->get_kabupaten($row->provinsi);
  64.                     $data['combo_kabupatennya']=$this->Model_wilayah->get_kabupaten($row->provinsinya);
  65.                     }
  66.                 // sort($idprov);
  67.                 $data['combo_provinsi']=$this->Model_wilayah->get_provinsi();
  68.                 $data['combo_pengaduan']=$this->Model_wilayah->get_pengaduan();
  69.                 $data['combo_pengawasan']=$this->Model_wilayah->get_pengawasan();
  70.                 $data['combo_pelapor']=$this->Model_wilayah->get_pelapor();
  71.                 $data['combo_k_penyimpangan']=$this->Model_wilayah->get_penyimpangan();
  72.                 $data['combo_provinsi']=$this->Model_wilayah->get_provinsi();
  73.                 $data['combo_instansi']=$this->Model_wilayah->get_instansi();
  74.                 $data['combo_uu']=$this->Model_wilayah->get_uu();
  75.                 $this->load->view('penyaluran/edit',$data);
  76.                 }
  77.       }
  78.        
  79.     }
  80.  
  81.  
  82.   //BUAT SURAT TANGGAPAN
  83.   public function tanggapan($id)
  84.   { if($this->auth->is_logged_in() == false)
  85.       {
  86.          redirect('Login');
  87.       }
  88.       else
  89.       {
  90.           if($this->auth->is_user() == false)
  91.         {
  92.            redirect('Login');
  93.  
  94.         }
  95.           else{
  96.             $nomor_agenda = decrypt($id);
  97.             $where        = mysqli_real_escape_string(mysqli_connect(),$nomor_agenda);
  98.             $data['tampil'] = $this->Model_penyaluran->lihatdata($where);
  99.             //$data['provinsi']=$this->Model_wilayah->get_provinsi();
  100.             $this->load->view('buat_surat_tanggapan', $data);
  101.         }
  102.       }
  103.    
  104.   }
  105.  
  106.     // new cetak all data proses
  107.     function cetak_all($where,$jenis){
  108.         if($this->auth->is_logged_in() == false)
  109.       {
  110.          redirect('Login');
  111.       }
  112.       else
  113.       {
  114.             if($this->auth->is_user() == false)
  115.           {
  116.              redirect('Login');
  117.  
  118.           }
  119.             else{
  120.                
  121.                 $data['data'] = $this->Model_penyaluran->cetak_all('agenda_terlapor',$where);
  122.                 $data['total_rows']=count($data['data']);
  123.                 $data['list']=$jenis;        
  124.                 $sumber=$this->load->view('penyaluran/ctk_klas_surat', $data,TRUE);
  125.                 $html = $sumber;
  126.          
  127.          
  128.                 $pdf = $this->m_pdf->load();
  129.          
  130.                 $pdf->AddPage('P','','','','',25,25,/*35*/20,10,10,10);
  131.                 $pdf->WriteHTML($html);
  132.                
  133.                 $pdf->Output(/*$dir.*/$pdfFilePath, "I");
  134.                 echo '<br><br><br><br><br><br><br><br><br><br><br><br><br><center>Berkas berhasil di simpan</center>';
  135.                 exit();
  136.                 }
  137.       }
  138.                    
  139.     }
  140.  
  141.   function cetak_all_proses(){
  142.         if($this->auth->is_logged_in() == false)
  143.       {
  144.          redirect('Login');
  145.       }
  146.       else
  147.       {
  148.             if($this->auth->is_user() == false)
  149.           {
  150.              redirect('Login');
  151.  
  152.           }
  153.             else{
  154.        
  155.                 if(empty( $this->input->post('date1'))){
  156.                 $from = str_replace("/","-", $this->input->post('date'));
  157.                 $until ="";
  158.                   $where = array(
  159.                 'date'  => date('Y-m-d', strtotime($from)),
  160.                 'date2'  => $until,
  161.                 'status' => '1',
  162.                
  163.                
  164.                 );
  165.                 }  
  166.                 else{
  167.                 $from = str_replace("/","-", $this->input->post('date'));
  168.                 $until = str_replace("/","-", $this->input->post('date1'));
  169.                   $where = array(
  170.                 'date'  => date('Y-m-d', strtotime($from)),
  171.                 'date2'  => date('Y-m-d', strtotime($until)),
  172.                 'status' => '1',
  173.                
  174.                 );
  175.                 }
  176.                 $jenis="DALAM PROSES";      
  177.                 $this->cetak_all($where,$jenis);
  178.          
  179.             }
  180.       }
  181.  
  182.   }
  183.     // new cetak all data arsip
  184.    
  185.   function cetak_all_arsip(){
  186.         if($this->auth->is_logged_in() == false)
  187.       {
  188.          redirect('Login');
  189.       }
  190.       else
  191.       {
  192.             if($this->auth->is_user() == false)
  193.           {
  194.              redirect('Login');
  195.  
  196.           }
  197.             else{
  198.        
  199.                 if(empty( $this->input->post('date1'))){
  200.                 $from = str_replace("/","-", $this->input->post('date'));
  201.                 $until ="";
  202.                   $where = array(
  203.                 'date'  => date('Y-m-d', strtotime($from)),
  204.                 'date2'  => $until,
  205.                 'status' => '2',
  206.                
  207.                
  208.                 );
  209.                 }  
  210.                 else{
  211.                 $from = str_replace("/","-", $this->input->post('date'));
  212.                 $until = str_replace("/","-", $this->input->post('date1'));
  213.                   $where = array(
  214.                 'date'  => date('Y-m-d', strtotime($from)),
  215.                 'date2'  => date('Y-m-d', strtotime($until)),
  216.                 'status' => '2',
  217.                
  218.                 );
  219.                 }
  220.                 $jenis="ARSIP";      
  221.                 $this->cetak_all($where,$jenis);
  222.          
  223.             }
  224.       }
  225.  
  226.   }
  227.   // new cetak all data tindak lanjut
  228.   function cetak_all_tindak_lanjut(){
  229.         if($this->auth->is_logged_in() == false)
  230.       {
  231.          redirect('Login');
  232.       }
  233.       else
  234.       {
  235.             if($this->auth->is_user() == false)
  236.           {
  237.              redirect('Login');
  238.  
  239.           }
  240.             else{
  241.        
  242.                 if(empty( $this->input->post('date1'))){
  243.                 $from = str_replace("/","-", $this->input->post('date'));
  244.                 $until ="";
  245.                   $where = array(
  246.                 'date'  => date('Y-m-d', strtotime($from)),
  247.                 'date2'  => $until,
  248.                 'status' => '7',
  249.                
  250.                
  251.                 );
  252.                 }  
  253.                 else{
  254.                 $from = str_replace("/","-", $this->input->post('date'));
  255.                 $until = str_replace("/","-", $this->input->post('date1'));
  256.                   $where = array(
  257.                 'date'  => date('Y-m-d', strtotime($from)),
  258.                 'date2'  => date('Y-m-d', strtotime($until)),
  259.                 'status' => '7',
  260.                
  261.                 );
  262.                 }      
  263.                 $jenis="TINDAK LANJUT";      
  264.                 $this->cetak_all($where,$jenis);
  265.          
  266.             }
  267.       }
  268.  
  269.   }
  270.  
  271.     function cetak_info($id){
  272.         if($this->auth->is_logged_in() == false)
  273.       {
  274.          redirect('Login');
  275.       }
  276.       else
  277.       {
  278.             if($this->auth->is_user() == false)
  279.           {
  280.              redirect('Login');
  281.  
  282.           }
  283.             else{
  284.                 $nomor_agenda=decrypt($id);
  285.                 $where =  $nomor_agenda;
  286.                 $data['cetak'] = $this->Model_penyaluran->cetak_info($where);
  287.                 // $this->load->view('penyaluran/save_pdf',$data);
  288.                 $sumber = $this->load->view('penyaluran/info_pdf', $data, TRUE);
  289.                 $html = $sumber;
  290.          
  291.                 $pdf = $this->m_pdf->load();
  292.          
  293.                 $pdf->AddPage('P','','','','',25,25,/*35*/20,10,10,10);
  294.                 $pdf->WriteHTML($html);
  295.                
  296.                 $pdf->Output(/*$dir.*/$pdfFilePath, "I");
  297.                 echo '<br><br><br><br><br><br><br><br><br><br><br><br><br><center>Berkas berhasil di simpan</center>';
  298.                 exit();
  299.                 }
  300.       }
  301.        
  302.     }
  303.    
  304.    
  305.     function hapus($id){
  306.         if($this->auth->is_logged_in() == false)
  307.       {
  308.          redirect('Login');
  309.       }
  310.       else
  311.       {
  312.             if($this->auth->is_user() == false)
  313.           {
  314.              redirect('Login');
  315.  
  316.           }
  317.             else{
  318.                  $id_agenda=decrypt($id);
  319.                 $result=$this->Model_penyaluran->deletedata($id_agenda);      
  320.                 // redirect('list_surat_penyaluran/list_Proses');
  321.                 if($result>=1){
  322.                     $this->session->set_flashdata("alert", "<div class='alert alert-success'><strong>Data Berhasil di Hapus..</strong></div>");
  323.                       header('location:'.base_url().'list_surat_penyaluran/list_proses');
  324.                   }else{
  325.                     $this->session->set_flashdata("alert", "<div class='alert alert-danger'><strong>Data Gagal di hapus..</strong></div>");
  326.                       header('location:'.base_url().'list_surat_penyaluran/list_proses');
  327.                   }
  328.                 }
  329.       }
  330.  
  331.        
  332.     }
  333.   // new tampilan tindak lanjut
  334.   function tindaklanjut_monitor($id){
  335.         if($this->auth->is_logged_in() == false)
  336.       {
  337.          redirect('Login');
  338.       }
  339.       else
  340.       {
  341.             if($this->auth->is_user() == false)
  342.           {
  343.              redirect('Login');
  344.  
  345.           }
  346.             else{
  347.                 $nomor_agenda=decrypt($id);
  348.                 $where =  mysqli_real_escape_string(mysqli_connect(),$nomor_agenda);
  349.                 $data['penyaluran_data'] = $this->Model_penyaluran->lihatdata($where);
  350.                 $data['combo_provinsi']=$this->Model_wilayah->get_provinsi();
  351.                 $data['combo_instansi']=$this->Model_wilayah->get_instansi();
  352.                 $data['disposisi_data'] = $this->Model_penyaluran->data_disposisi($where);
  353.                 $this->load->view('penyaluran/tindaklanjut_monitor',$data);
  354.                 }
  355.       }
  356.    
  357.   }
  358.  
  359.  
  360.   function tindaklanjut($id){
  361.         if($this->auth->is_logged_in() == false)
  362.       {
  363.          redirect('Login');
  364.       }
  365.       else
  366.       {
  367.             if($this->auth->is_user() == false)
  368.           {
  369.              redirect('Login');
  370.  
  371.           }
  372.             else{
  373.                 $nomor_agenda=decrypt($id);
  374.                 $where =  mysqli_real_escape_string(mysqli_connect(),$nomor_agenda);
  375.                 $data['penyaluran_data'] = $this->Model_penyaluran->lihatdata($where);
  376.                 $data['combo_provinsi']=$this->Model_wilayah->get_provinsi();
  377.                 $data['combo_instansi']=$this->Model_wilayah->get_instansi();
  378.                 $data['disposisi_data'] = $this->Model_penyaluran->data_disposisi($where);
  379.                 $this->load->view('penyaluran/tindaklanjut',$data);
  380.                
  381.                 }
  382.       }
  383.    
  384.   }
  385.   function tindaklanjut_koordinasi($id){
  386.         if($this->auth->is_logged_in() == false)
  387.       {
  388.          redirect('Login');
  389.       }
  390.       else
  391.       {
  392.             if($this->auth->is_user() == false)
  393.           {
  394.              redirect('Login');
  395.  
  396.           }
  397.             else{
  398.                 $nomor_agenda=decrypt($id);
  399.         $where =  mysqli_real_escape_string(mysqli_connect(),$nomor_agenda);
  400.         $data['penyaluran_data'] = $this->Model_penyaluran->lihatdata($where);
  401.         $data['combo_provinsi']=$this->Model_wilayah->get_provinsi();
  402.         $data['combo_instansi']=$this->Model_wilayah->get_instansi();
  403.         $data['disposisi_data'] = $this->Model_penyaluran->data_disposisi($where);
  404.         $this->load->view('penyaluran/tindaklanjut_koordinasi',$data);
  405.                 }
  406.       }
  407.    
  408.   }
  409.  
  410.  
  411.  
  412.  
  413.   function upload(){
  414.         if($this->auth->is_logged_in() == false)
  415.       {
  416.          redirect('Login');
  417.       }
  418.       else
  419.       {
  420.             if($this->auth->is_user() == false)
  421.           {
  422.              redirect('Login');
  423.  
  424.           }
  425.             else{
  426.                   $nomor_agenda     = decrypt($this->input->post('id_agenda'));                  
  427.                   $nama_file = str_replace('/','', $nomor_agenda);
  428.                   $nama_file2 = str_replace('.','_',$nama_file);
  429.                   $config = array(
  430.                     'upload_path' => './assets/upload/penyaluran',
  431.                     'allowed_types' => 'pdf',
  432.                     'max_size'      => '100000',
  433.                     'overwrite'       => TRUE
  434.                   );
  435.                   $config['file_name'] = $nama_file2;
  436.                   $this->load->library('upload', $config);
  437.  
  438.                   if (!$this->upload->do_upload('path')){
  439.                        $this->session->set_flashdata("alert", "<div class='alert alert-danger'><strong>Data Gagal di Simpan..</strong></div>");
  440.                       header('location:'.base_url().'list_surat_penyaluran/list_tindak_lanjut');
  441.                   }else{
  442.                     $upload_data = $this->upload->data();
  443.                     $where = array('agenda_terlapor.nomor_agenda' =>  mysqli_real_escape_string(mysqli_connect(),$nomor_agenda));
  444.  
  445.                     $data = array(
  446.                    
  447.                     'fileupload' => $upload_data['file_name']
  448.                    
  449.                     );
  450.                     $result = $this->Model_penyaluran->upload($where,$data,'agenda_terlapor');
  451.                     $data_agenda = array(
  452.                                
  453.                                 'status'  => "2"
  454.                                
  455.                                   );
  456.                     $result2=$this->Model_penyaluran->update_agenda($where,$data_agenda,'agenda_terlapor');
  457.                   if($result2>="1"){
  458.                   $this->session->set_flashdata("alert", "<div class='alert alert-success'><strong>Data Berhasil di Simpan..</strong></div>");
  459.                       header('location:'.base_url().'list_surat_penyaluran/list_tindak_lanjut');
  460.                     }
  461.                   else{
  462.                      $this->session->set_flashdata("alert", "<div class='alert alert-danger'><strong>Data Gagal di Simpan..</strong></div>");
  463.                       header('location:'.base_url().'list_surat_penyaluran/list_tindak_lanjut');
  464.                    
  465.                   }
  466.                 }
  467.  
  468.                 }
  469.       }
  470.    
  471.   }
  472.  
  473.     function list_Proses(){
  474.         if($this->auth->is_logged_in() == false)
  475.       {
  476.          redirect('Login');
  477.       }
  478.       else
  479.       {
  480.             if($this->auth->is_user() == false)
  481.           {
  482.              redirect('Login');
  483.  
  484.           }
  485.             else{
  486.                 //pagination settings
  487.         $where = array(
  488.         'status' => '1',        
  489.         );
  490.        
  491.         $this->load->view('list_surat_penyaluran');
  492.                 }
  493.       }  
  494.     }
  495.    
  496.     public function ajax_list_proses()
  497.   {
  498.     $where ='1';
  499.     $list = $this->Model_penyaluran->get_datatables($where);
  500.     $data = array();
  501.     $no = $_POST['start'];
  502.     foreach ($list as $data_penyaluran) {
  503.       $no++;
  504.       $row = array();
  505.       $row[] = $no;
  506.       $row[] = '<a href="lihat/'.encrypt($data_penyaluran->nomor_agenda).'">'.$data_penyaluran->nomor_agenda.'</a>
  507.                <a id="myBtn" target="_blank" href="cetak_info/'.encrypt($data_penyaluran->nomor_agenda).'">';
  508.       $row[] = date("d/m/Y", strtotime($data_penyaluran->date));
  509.       $row[] = $data_penyaluran->nama_pelapor;
  510.       $row[] = $data_penyaluran->nama_terlapor;
  511.       $row[] = $data_penyaluran->perihal;
  512.       $row[] = $data_penyaluran->tgl_pengerjaan;
  513.       $row[] = '<a style="width:70px" class="label label-danger"><i class="fa fa-refresh"> </i> Proses</a>
  514. ';
  515.       $row[] =  '<a href="edit/'.encrypt($data_penyaluran->nomor_agenda).'" style="width:70px;margin-bottom: 5px" class="btn btn-success btn-sm"><i class="fa fa-pencil-square-o"> </i> Edit</a>
  516.        
  517.        <a class="btn btn-sm btn-danger" style="width:70px;" href="javascript:void(0)" title="Hapus" onclick="delete_data('."'".encrypt($data_penyaluran->nomor_agenda)."'".')"><i class="glyphicon glyphicon-trash"></i> Hapus</a>
  518.  
  519. ';
  520.      
  521.  
  522.  
  523.       $data[] = $row;
  524.     }
  525.  
  526.     $output = array(
  527.             "draw" => $_POST['draw'],
  528.             "recordsTotal" => $this->Model_penyaluran->count_all($where),
  529.             "recordsFiltered" => $this->Model_penyaluran->count_filtered($where),
  530.             "data" => $data,
  531.         );
  532.     //output to json format
  533.     echo json_encode($output);
  534.   }
  535.  
  536.   // LAPORAN SURAT TP5000
  537.   function list_laporan_surat_tp5000(){
  538.         if($this->auth->is_logged_in() == false)
  539.       {
  540.          redirect('Login');
  541.       }
  542.       else
  543.       {
  544.             if($this->auth->is_user() == false)
  545.           {
  546.              redirect('Login');
  547.  
  548.           }
  549.             else{
  550.                 //pagination settings
  551.         $where = array(
  552.         'status' => '1',        
  553.         );
  554.        
  555.         $this->load->view('list_laporan_surat_tp5000');
  556.                 }
  557.       }  
  558.     }
  559.   public function ajax_list_surat_tp5000()
  560.   {
  561.     $where ='2';
  562.     $list = $this->M_rekap->get_datatables($where);
  563.     $data = array();
  564.     $no = $_POST['start'];
  565.     foreach ($list as $data_penyaluran) {
  566.       $no++;
  567.       $row = array();
  568.       $row[] = $no;
  569.       $row[] = $data_penyaluran->no_surat.'<br>'.date("d/m/Y", strtotime($data_penyaluran->date));
  570.       $row[] = $data_penyaluran->nama_pelapor;
  571.       $row[] = $data_penyaluran->nama_terlapor;
  572.       $row[] = $data_penyaluran->alamat_tr;
  573.       $row[] = $data_penyaluran->perihal;
  574.       $row[] = $data_penyaluran->nomor_agenda;
  575.       $row[] = '<b>Asli :</b>'.$data_penyaluran->nama_instansi.'<br><b>Tembusan :</b>'.$data_penyaluran->nama_instansi;
  576.       $row[] = $data_penyaluran->nama_status_surat;
  577.       $data[] = $row;
  578.     }
  579.  
  580.     $output = array(
  581.             "draw" => $_POST['draw'],
  582.             "recordsTotal" => $this->M_rekap->count_all($where),
  583.             "recordsFiltered" => $this->M_rekap->count_filtered($where),
  584.             "data" => $data,
  585.         );
  586.     //output to json format
  587.     echo json_encode($output);
  588.   }
  589.   //END LAPORAN
  590.  
  591.   function list_tindak_lanjut(){
  592.         if($this->auth->is_logged_in() == false)
  593.       {
  594.          redirect('Login');
  595.       }
  596.       else
  597.       {
  598.             if($this->auth->is_user() == false)
  599.           {
  600.              redirect('Login');
  601.  
  602.           }
  603.             else{
  604.                 //pagination settings
  605.         $where = array(
  606.         'status' => '1',
  607.        
  608.        
  609.         );
  610.        
  611.         $this->load->view('list_surat_penyaluran_tindaklanjut');
  612.                 }
  613.       }
  614.      
  615.     }
  616.    public function ajax_list_tindak_lanjut()
  617.   {
  618.     $where ='7';
  619.     $list = $this->Model_penyaluran->get_datatables($where);
  620.     $data = array();
  621.     $no = $_POST['start'];
  622.     foreach ($list as $data_penyaluran) {
  623.       $no++;
  624.       $row = array();
  625.       $row[] = $no;
  626.       // $row[] = '<a href="lihat/'.encrypt($data_penyaluran->nomor_agenda).'">'.$data_penyaluran->nomor_agenda.'</a>';
  627.                
  628.       $row[] = '<a href="lihat/'.encrypt($data_penyaluran->nomor_agenda).'">'.$data_penyaluran->nomor_agenda.'</a>
  629.                <a id="myBtn" target="_blank" href="cetak_info/'.encrypt($data_penyaluran->nomor_agenda).'"  class="btn btn-sm btn-primary active"><i class="fa fa-print"> </i> Cetak Informasi</a>';
  630.       $row[] = date("d/m/Y", strtotime($data_penyaluran->date));
  631.       $row[] = $data_penyaluran->nama_pelapor;
  632.       $row[] = $data_penyaluran->nama_terlapor;
  633.       $row[] = $data_penyaluran->perihal;
  634.       $row[] = $data_penyaluran->tgl_pengerjaan;
  635.       $row[] = $data_penyaluran->nama_status_tindak_lanjut;
  636.       if($data_penyaluran->status_tindak_lanjut=="3"){
  637.         $row[] =  '<center>
  638.        <a href="tindaklanjut_monitor/'.encrypt($data_penyaluran->nomor_agenda).'" style="width:100px;margin-top: 5px" class="btn btn-success btn-sm"><i class="fa fa-pencil-square-o"> </i>Tindak Lanjut</a>
  639.  
  640.        <a class="btn btn-sm btn-primary btn-flat" style="width:100px;margin-top: 5px"  onclick="upload('."'".encrypt($data_penyaluran->nomor_agenda)."'".')"><i class="fa fa-flag-checkered"></i> Upload</a>
  641.        </center>';
  642.       }
  643.       else if($data_penyaluran->status_tindak_lanjut=="2"){
  644.         $row[] =  '<center>
  645.        
  646.        <a href="tindaklanjut_koordinasi/'.encrypt($data_penyaluran->nomor_agenda).'" style="width:100px;margin-top: 5px" class="btn btn-success btn-sm"><i class="fa fa-pencil-square-o"> </i>Tindak Lanjut </a>
  647.  
  648.        <a class="btn btn-sm btn-primary btn-flat" style="width:100px;margin-top: 5px"  onclick="upload('."'".encrypt($data_penyaluran->nomor_agenda)."'".')"><i class="fa fa-flag-checkered"></i> Upload</a>
  649.        </center>';
  650.       }
  651.       else if($data_penyaluran->status_tindak_lanjut=="1"){
  652.         $row[] =  '<center>
  653.        <a href="tindaklanjut/'.encrypt($data_penyaluran->nomor_agenda).'" style="width:100px;margin-top: 5px" class="btn btn-success btn-sm"><i class="fa fa-pencil-square-o"> </i>Tindak Lanjut</a>
  654.  
  655.        <a class="btn btn-sm btn-primary btn-flat" style="width:100px;margin-top: 5px"  onclick="upload('."'".encrypt($data_penyaluran->nomor_agenda)."'".')"><i class="fa fa-flag-checkered"></i> Upload</a>
  656.        </center>';
  657.       }
  658.  
  659.       else{
  660.         $row[] =  '<center><a href="edit/'.encrypt($data_penyaluran->nomor_agenda).'" style="width:70px" class="btn btn-success btn-sm"><i class="fa fa-pencil-square-o"> </i> Edit</a>
  661.        
  662.        </center>';
  663.       }
  664.      
  665.  
  666.  
  667.       $data[] = $row;
  668.     }
  669.  
  670.     $output = array(
  671.             "draw" => $_POST['draw'],
  672.             "recordsTotal" => $this->Model_penyaluran->count_all($where),
  673.             "recordsFiltered" => $this->Model_penyaluran->count_filtered($where),
  674.             "data" => $data,
  675.         );
  676.     //output to json format
  677.     echo json_encode($output);
  678.   }
  679.  
  680.  
  681. function list_arsip(){
  682.         if($this->auth->is_logged_in() == false)
  683.       {
  684.          redirect('Login');
  685.       }
  686.       else
  687.       {
  688.             if($this->auth->is_user() == false)
  689.           {
  690.              redirect('Login');
  691.  
  692.           }
  693.             else{
  694.                 //pagination settings
  695.         $where = array(
  696.         'status' => '1',
  697.        
  698.        
  699.         );
  700.        
  701.         $this->load->view('list_arsip_surat_penyaluran');
  702.                 }
  703.       }
  704.  
  705.  
  706.  
  707.        
  708.     }
  709.  
  710.     function pelapor($id){
  711.  
  712.     if($this->auth->is_logged_in() == false)
  713.       {
  714.          redirect('Login');
  715.       }
  716.       else
  717.       {
  718.             if($this->auth->is_user() == false)
  719.           {
  720.              redirect('Login');
  721.  
  722.           }
  723.             else{
  724.               $nomor_agenda=decrypt($id);
  725.               $where =   mysqli_real_escape_string(mysqli_connect(),$nomor_agenda);
  726.               $data['penyaluran_data'] = $this->Model_penyaluran->lihatdata($where);
  727.               $this->load->view('buatsurat/penyaluran/buat_surat_pelapor', $data);
  728.         }
  729.       }
  730.      
  731.   }
  732.  
  733.   public function monitor($id){
  734.  
  735.     if($this->auth->is_logged_in() == false)
  736.       {
  737.          redirect('Login');
  738.       }
  739.       else
  740.       {
  741.           if($this->auth->is_user() == false)
  742.         {
  743.            redirect('Login');
  744.  
  745.         }
  746.           else{
  747.           $nomor_agenda=decrypt($id);
  748.           $where =   mysqli_real_escape_string(mysqli_connect(),$nomor_agenda);
  749.           $data['penyaluran_data'] = $this->Model_penyaluran->lihatdata($where);
  750.           $this->load->view('buatsurat/penyaluran/buat_surat_penyaluran_monitor', $data);
  751.         }
  752.       }
  753.      
  754.   }
  755.  
  756.   public function koordinasi($id){
  757.  
  758.     if($this->auth->is_logged_in() == false)
  759.       {
  760.          redirect('Login');
  761.       }
  762.       else
  763.       {
  764.           if($this->auth->is_user() == false)
  765.         {
  766.            redirect('Login');
  767.  
  768.         }
  769.         else{
  770.         $nomor_agenda=decrypt($id);
  771.         $where =   mysqli_real_escape_string(mysqli_connect(),$nomor_agenda);
  772.         $data['penyaluran_data'] = $this->Model_penyaluran->lihatdata($where);
  773.         $this->load->view('buatsurat/penyaluran/buat_surat_penyaluran_koordinasi', $data);
  774.         }
  775.       }
  776.      
  777.   }
  778.  
  779.  
  780. public function ajax_list_arsip()
  781.   {
  782.     $where ='2';
  783.     $list = $this->Model_penyaluran->get_datatables($where);
  784.     $data = array();
  785.     $no = $_POST['start'];
  786.     foreach ($list as $data_penyaluran) {
  787.       $no++;
  788.       $row = array();
  789.       $row[] = $no;
  790.       $row[] = '<a href="lihat/'.encrypt($data_penyaluran->nomor_agenda).'">'.$data_penyaluran->nomor_agenda.'</a>
  791.                <b>'.date("d/m/Y", strtotime($data_penyaluran->date)).'</b>
  792.                <a id="myBtn" target="_blank" href="cetak_info/'.encrypt($data_penyaluran->nomor_agenda).'"  class="btn btn-sm btn-primary active"><i class="fa fa-print"> </i> Cetak Informasi</a>';
  793.       $row[] = $data_penyaluran->tgl_pengerjaan;
  794.       $row[] = $data_penyaluran->nama_pelapor;
  795.       $row[] = $data_penyaluran->nama_terlapor;
  796.       $row[] = $data_penyaluran->perihal;
  797.       $row[] = $data_penyaluran->nama_status_tindak_lanjut;
  798.       $row[] =  '<center>
  799.      <a href="tanggapan/'.encrypt($data_penyaluran->nomor_agenda).'" class="btn btn-sm btn-warning btn-flat" style="width:150px;margin-top: 5px">Buat Surat Tanggapan</a>
  800.      </center>';
  801.       $row[] =  '<center>
  802.  
  803.        <a class="btn btn-sm btn-primary btn-flat" style="width:100px;margin-top: 5px"  onclick="upload('."'".encrypt($data_penyaluran->nomor_agenda)."'".')"><i class="fa fa-flag-checkered"></i>Download</a>
  804.        </center>';
  805.       $row[] =  '<center>
  806.      <a href="pelapor/'.encrypt($data_penyaluran->nomor_agenda).'" class="btn btn-sm btn-primary btn-flat" style="width:150px;margin-top: 5px">Buat Surat Pelapor</a>
  807.      <a href="koordinasi/'.encrypt($data_penyaluran->nomor_agenda).'" class="btn btn-sm btn-success btn-flat" style="width:150px;margin-top: 5px">Buat Surat Koordinasi</a>
  808.      <a href="monitor/'.encrypt($data_penyaluran->nomor_agenda).'" class="btn btn-sm btn-danger btn-flat" style="width:150px;margin-top: 5px">Buat Surat Monitor</a>
  809.      </center>';
  810.      
  811.       $data[] = $row;
  812.     }
  813.  
  814.     $output = array(
  815.             "draw" => $_POST['draw'],
  816.             "recordsTotal" => $this->Model_penyaluran->count_all($where),
  817.             "recordsFiltered" => $this->Model_penyaluran->count_filtered($where),
  818.             "data" => $data,
  819.         );
  820.     //output to json format
  821.     echo json_encode($output);
  822.   }
  823.  
  824.  
  825. //   public function ajax_delete($id)
  826. //     {
  827. //         //delete file        
  828. //         $this->Model_penyaluran->deletedata(decrypt($id));
  829. //         echo json_encode(array("status" => TRUE));
  830.    
  831. // }
  832.   public function ajax_delete($id)
  833.     {
  834.         //delete file        
  835.         $this->Model_penyaluran->deletedata(decrypt($id));
  836.         echo json_encode(array("status" => TRUE));
  837.    
  838. }
  839. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement