403Webshell
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 :  /wamp/www/sipapbd_2019/application/modules/bidang/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /wamp/www/sipapbd_2019/application/modules/bidang/models/bidang_model.php
<?php
class Bidang_model extends Base_Model {

  var $fieldmap_daftar;
  var $fieldmap_filter;
  var $fieldmap_bidang;
  var $data;

  function __construct()
  {
    parent::__construct();

    $this->fieldmap_daftar = array(
      'ID_FUNGSI',
      'ID_URUSAN',
      'KODE_FUNGSI',
      'NAMA_FUNGSI',
      'KODE_URUSAN',
      'NAMA_URUSAN',
      'KODE_BIDANG',
      'NAMA_BIDANG',
      'LAST_CHANGED',
      'PARAM'
    );

    $this->fieldmap_filter = array(
      'kdf' => 'f.kode_fungsi',
      'nmf' => 'f.nama_fungsi',
      'kdu' => 'u.kode_urusan',
      'nmu' => 'u.nama_urusan',
      'kode' => 'a.kode_bidang',
      'nama' => 'a.nama_bidang',
    );

    $this->fieldmap_bidang = array(
      'id' => 'ID_BIDANG',
      'idf' => 'ID_FUNGSI',
      'idu' => 'ID_URUSAN',
      'kode' => 'KODE_BIDANG',
      'nama' => 'NAMA_BIDANG',
      'last_changed' => 'LAST_CHANGED',
    );
  }

  function fill_data()
  {
    foreach($this->fieldmap_bidang as $key => $value){
      switch ($key){
        case 'last_changed' : $$key = date('d.m.Y.H.i.s');  break;
        default : $$key = $this->input->post($key) ? $this->input->post($key) : NULL;
      }

      if(isset($$key))
        $this->data[$value] = $$key;
    }
  }

  // ----- search advance ---- >>
  function get_data_fields()
  {
    $fields = array(
          'kdf' => array('name' => 'Kode Fungsi', 'kategori'=>'string'),
          'nmf' => array('name' => 'Nama Fungsi', 'kategori'=>'string'),
          'kdu' => array('name' => 'Kode Urusan', 'kategori'=>'string'),
          'nmu' => array('name' => 'Nama Urusan', 'kategori'=>'string'),
          'kode' => array('name' => 'Kode Bidang', 'kategori'=>'string'),
          'nama' => array('name' => 'Nama Bidang', 'kategori'=>'string'),
     );

    return $fields;
  }

  function cek_exist()
  {
    if($this->input->post('id') > 0){
      $this->db->select('count(fa.id_bidang) bidang_exists');
      $this->db->from('bidang fa');
      $this->db->where('fa.id_bidang',$this->input->post('id'));
      $result = $this->db->get()->row_array();
      if($result && $result['BIDANG_EXISTS'] > 0)
      {
        return 1;
      }
      else{
        return 0;
      }
    }
    else{
      return 1;
    }

  }

  function cek_changed()
  {
    if($this->input->post('id') > 0 || $this->input->post('last_changed') !=''){
      $this->db->select('fa.last_changed');
      $this->db->from('bidang fa');
      $this->db->where('fa.id_bidang',$this->input->post('id'));
      $result = $this->db->get()->row_array();
      if($result)
      {
        if($result['LAST_CHANGED'] <= $this->input->post('last_changed')){
          return 1;
        }
        else{
          return $result['LAST_CHANGED'];
        }
      }
      else{
        return 1;
      }
    }
    else{
      return 1;
    }

  }

  // Kode Bidang hanya boleh dipakai sekali
  function check_duplikasi_bidang()
  {
    $id = $this->input->post('id') ? $this->input->post('id') : NULL;
    $idf = $this->input->post('idf') ? $this->input->post('idf') : NULL;
    $idu = $this->input->post('idu') ? $this->input->post('idu') : NULL;
    $kode = $this->input->post('kode') ? $this->input->post('kode') : NULL;

    $this->db->select('count(1) dup')
        ->where('a.kode_bidang', $kode)
        ->where('a.id_urusan', $idu)
        ->where('a.id_bidang <>', $id);
    $rs = $this->db->get('bidang a')->row_array();

    return (integer) $rs['DUP'] < 1;
  }

  /* Simpan data Bidang */
  function insert_bidang()
  {
    $id = $this->data['ID_BIDANG'];

    $this->db->select('1')->from('bidang')->where('id_bidang', $id);
    $rs = $this->db->get()->row_array();

    if ($rs)
    {
      $this->db->where('id_bidang', $id);
      $this->db->update('bidang', $this->data);
      $this->check_trans_status('update bidang failed');
    }
    else
    {
      $id = $this->get_id('g_id_bidang');
      $this->data['ID_BIDANG'] = $id;
      $this->db->insert('bidang', $this->data);
      $this->check_trans_status('insert bidang failed');
    }
    $this->id = $id;
    $this->last_changed = $this->get_last_changed('bidang','id_bidang',$id);
  }

  function save_detail()
  {
    $this->insert_bidang();
  }

  /* query hapus */
  function build_query_hapus($id=0)
  {
    $this->db->where('id_bidang', $id)->delete('bidang');
    $this->check_trans_status('delete bidang failed');
  }

  /* Query daftar */
  function build_query_daftar()
  {
    $this->db->select("
        a.id_bidang,
        f.id_fungsi,
        a.id_urusan,
        f.kode_fungsi,
        f.nama_fungsi,
        u.kode_urusan,
        u.nama_urusan,
        a.kode_bidang,
        a.nama_bidang,
        a.last_changed,
        0 param
    ");
    $this->db->from('fungsi f');
    $this->db->join('bidang a', 'a.id_fungsi = f.id_fungsi', 'left');
    $this->db->join('urusan u', 'u.id_urusan = a.id_urusan', 'left');
    $this->db->order_by('f.kode_fungsi, u.kode_urusan, a.kode_bidang');
  }

  function check_dependency($id)
  {
    $this->db->select("
          (select count(b.ID_BIDANG) from SKPD b where b.ID_BIDANG = a.ID_BIDANG) SKPD_PAKAI,
          (select count(b.ID_BIDANG) from SKPD_BIDANG_TAMBAHAN b where b.ID_BIDANG = a.ID_BIDANG) BIDANG_TAMBAHAN_PAKAI,
    ");
    $this->db->where('a.ID_BIDANG', $id);
    $result = $this->db->get('BIDANG a')->row_array();

    return !($result['SKPD_PAKAI'] > 0 || $result['BIDANG_TAMBAHAN_PAKAI']);
  }

}

Youez - 2016 - github.com/yon3zu
LinuXploit