<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Tab_penetapan_c extends CI_Controller {
	function index(){
		if($this->nativesession->get_flash_session('security')==FALSE){
			redirect('main');
		}

		if($this->session->userdata('is_logged_in')==FALSE){
			redirect('login');
		}
		$data['enc'] = $this->nativesession->get_flash_session('enc');
		$data['idperkara'] = $this->encrypt->decode(base64_decode($data['enc']));
		$this->load->model('penetapan/penetapan_m');
		$data['proses_terakhir_id'] = $this->penetapan_m->get_proses_terakhir($data['idperkara']);
		$data['data_penetapan'] = $this->penetapan_m->get_penetapan($data['idperkara']);		
		$data['data_penetapan_detail'] = $this->penetapan_m->get_penetapan_detail($data['idperkara']);
		$data['data_penunjukan_pp_detail'] = $this->penetapan_m->get_penunjukan_pp_detail($data['idperkara']);
		$data['data_penunjukan_jurusita_detail'] = $this->penetapan_m->get_penunjukan_jurusita_detail($data['idperkara']);
		$data['data_sidang_pertama_detail']=$this->penetapan_m->get_penetapan_sidang_pertama_detail($data['idperkara']);
		$cekPemeriksaanPersiapan = $this->penetapan_m->getDataPemeriksaanPersiapan($data['idperkara']);
		if($cekPemeriksaanPersiapan->num_rows()==0){
			$data['cekPemeriksaanPersiapan']=0;
		} else {
			$data['cekPemeriksaanPersiapan']=1;
		}
		$data['alur_perkara_id']=$this->tanggalhelper->getIDAlurPerkara($data['idperkara']);
		$data['is_perlawanan'] = 0;
		if($data['alur_perkara_id']==9){
			$data['is_perlawanan'] = $this->penetapan_m->getInfoPerlawanan($data['idperkara']);
		}
		$data['idjenisPerkara']=$this->tanggalhelper->getIDJenisPerkara($data['idperkara']);
		$data['ada_data_diversi']=0;
		if ($data['alur_perkara_id']==118){
			$data['ada_data_diversi'] = $this->penetapan_m->getInfoDiversi($data['idperkara'])==1?0:1;
		}

		$this->load->model('diversi/diversi_m');
		$data['datadiversi']=$this->diversi_m->get_data_diversi($data['idperkara']);
		$this->load->view('perkara_tab/penetapan/tab_penetapan_v', $data);
	}
}