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 :  D:/wamp/www/sipapbd_xxxx/application/modules/tahun_anggaran/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : D:/wamp/www/sipapbd_xxxx/application/modules/tahun_anggaran/controllers/tahun_anggaran.php
<?php

class Tahun_anggaran extends Admin_Controller {
  public function __construct()
  {
    parent::__construct();
    $this->modul_name = 'tahun_anggaran';
    $this->modul_display = 'Tahun Anggaran';
    $this->view_daftar = 'tahun_anggaran_view';
    $this->load->model('tahun_anggaran_model', 'data_model');
  }

  public function index()
  {
    $this->daftar();
  }

  public function daftar()
  {
    $this->load->model('auth/login_model', 'auth');
    $data['breadcrumbs'] = 'Daftar '.$this->modul_display;
    $data['modul'] = $this->modul_name;
    $data['akses'] = $this->auth->get_level_akses($this->uri->slash_segment(1));
    $data['grid']['fields'] = $this->data_model->get_data_fields();

    $data['main_content'] = $this->view_daftar;
    $this->load->view('layout/template_admin',$data);
  }

  protected function validasi_form()
  {
    $this->form_validation->set_rules('tahun', 'Tahun Anggaran', 'required|trim|max_length[4]|integer|callback__cek_tahun');

    $this->form_validation->set_message('required', '%s belum diisi.');
    $this->form_validation->set_message('__cek_tahun', '%s sudah ada.');
  }

  public function __cek_tahun()
  {
    return $this->data_model->check_tahun();
  }

  public function get_tahun()
  {
    parent::get_daftar();
    $count = $this->data_model->get_data($this->search_param, TRUE);

    $response = (object) NULL;
    $response->sql = $this->db->queries;
    if($count == 0) // tidak ada data
    {
      echo json_encode($response);
      return '';
    }

    $page = $this->page;
    $limit = $this->limit;
    $total_pages = ceil($count/$limit);

    if ($page > $total_pages) $page = $total_pages;
    $start = $limit * $page - $limit;
    if($start < 0) $start = 0;
    $this->search_param['limit'] = array(
        'start' => $start,
        'end' => $limit
    );

    $result = $this->data_model->get_data($this->search_param);

    $response->page = $page;
    $response->total = $total_pages;
    $response->records = $count;
    $response->sql = $this->db->queries;

    $fields = $this->data_model->fieldmap_daftar;
    for($i=0; $i<count($result); $i++)
    {
      $data = array();
      for ($n=0; $n < count($fields); $n++)
      {
        $data[] = $result[$i][$fields[$n]];
      }
      $response->rows[$i]['cell'] = $data;
    }
    echo json_encode($response);
  }

  public function hapus()
  {
    $response = (object) NULL;
    $tahun = (integer) $this->input->post('id');

    if ($this->data_model->tahun == $tahun)
    {
      $response->isSuccess = FALSE;
      $response->message = 'Tahun Anggaran Aktif tidak boleh dihapus.';
      echo json_encode($response);
      return FALSE;
    }

    parent::hapus();
  }

  protected function validasi_status()
  {
    $this->form_validation->set_rules('status', 'Status', 'required|trim|max_length[20]|callback__cek_status');

    $this->form_validation->set_message('required', '%s tidak boleh kosong.');
    $this->form_validation->set_message('__cek_status', '%s sudah ada.');
  }

  public function __cek_status()
  {
    return $this->data_model->check_status();
  }

  public function proses_status()
  {
    $response = (object) NULL;
    $this->load->library('form_validation');

    $this->validasi_status();

    if($this->form_validation->run() == TRUE)
    {
      $this->data_model->fill_data_status();
      $success = $this->data_model->save_data_status();

      if($success){
        $response->isSuccess = TRUE;
        $response->message = 'Status Anggaran berhasil disimpan';
        $response->id = $this->data_model->id;
        $response->sql = $this->db->queries;
      }
      else
      {
        $response->isSuccess = FALSE;
        $response->message = 'Status Anggaran gagal disimpan';
        $response->sql = $this->db->queries;
      }
    }
    else
    {
      $response->isSuccess = FALSE;
      $response->message = validation_errors();
    }

    echo json_encode($response);
  }

  public function get_status($tahun = 0)
  {
    $page = $this->input->post('page') ? $this->input->post('page') : 0; // get the requested page
    $limit = $this->input->post('rows') ? $this->input->post('rows') : 0; // get how many rows we want to have into the grid
    $sidx = $this->input->post('sidx') ? $this->input->post('sidx') : 0; // get index row - i.e. user click to sort
    $sord = $this->input->post('sord') ? $this->input->post('sord') : ''; // get the direction if(!$sidx) $sidx =1;

    $req_param = array (
      'tahun' => $tahun,
      "sort_by" => $sidx,
      "sort_direction" => $sord,
    );
    $count = $this->data_model->get_data_status($req_param, TRUE);

    $response = (object) NULL;
    $response->sql = $this->db->queries;
    if($count == 0) // tidak ada data
    {
      echo json_encode($response);
      return '';
    }

    $total_pages = ceil($count/$limit);
    if ($page > $total_pages) $page = $total_pages;
    $start = $limit * $page - $limit;
    if($start < 0) $start = 0;
    $req_param['limit'] = array(
        'start' => $start,
        'end' => $limit,
    );

    $result = $this->data_model->get_data_status($req_param);

    $response = (object) NULL;
    $response->page = $page;
    $response->total = $total_pages;
    $response->records = $count;
    $response->sql = $this->db->queries;

    $fields = $this->data_model->fieldmap_daftar_status;
    for($i=0; $i<count($result); $i++)
    {
      $data = array();
      for ($n=0; $n < count($fields); $n++)
      {
        switch ($fields[$n])
        {
          case 'TANGGAL_RKA' : ;
          case 'TANGGAL_DPA' : ;
          case 'TANGGAL_APBD' : ;
          case 'TANGGAL_PERKADA' : $data[] = format_date( $result[$i][$fields[$n]] ); break;
          default : $data[] = $result[$i][$fields[$n]];
        }
      }
      $response->rows[$i]['cell'] = $data;
    }
    echo json_encode($response);
  }

  public function hapus_status()
  {
    $response = (object) NULL;
    $tahun = $this->input->post('tahun');
    $status = $this->input->post('status');

    if ($this->data_model->tahun == $tahun && $this->data_model->status == $status)
    {
      $response->isSuccess = FALSE;
      $response->message = 'Status Anggaran Aktif tidak boleh dihapus.';
      echo json_encode($response);
      return FALSE;
    }

    $result = $this->data_model->check_dependency_status($tahun, $status);
    if ($result)
    {
      $this->data_model->delete_data_status($tahun, $status);
      $response->isSuccess = TRUE;
      $response->message = 'Status Anggaran telah dihapus';
    }
    else
    {
      $response->isSuccess = FALSE;
      $response->message = 'Status Anggaran gagal dihapus';
      $response->error = $this->data_model->last_error_message;
    }

    echo json_encode($response);
  }

}

Youez - 2016 - github.com/yon3zu
LinuXploit