<?php
class Sidang_list_detil extends CI_Controller {
	function index(){
		$functions = $this->nativesession->get_flash_session('function');
		$enc = $this->nativesession->get_flash_session('enc',TRUE);
		if($this->nativesession->get_flash_session('security')===FALSE){
			redirect('main');
		}

		if($this->session->userdata('is_logged_in') AND empty($enc)){
			redirect('dashboard');
		}

		$id = $this->encrypt->decode(base64_decode($enc));
		$this->showDataDetil($id);

	}

	function showDataDetil($id_jadwal_sidang){
		$this->load->model('sidang_list/m_sidang_list','perkara');
		$result = $this->perkara->get_list_sidang_detil($id_jadwal_sidang);
		$idalurperkara = '';
		$idperkara = '';
		if($result!=''){
			if($result->num_rows()>0){
				foreach ($result->result() as $row) {
					$data['idalurperkara'] = $row->alur_perkara_id;
					$idperkara = $row->perkara_id;
					$data['idperkara'] = $idperkara;
					$data['tanggal_sidang'] = $this->tanggalhelper->convertDayDate($row->tanggal_sidang);
					$data['jam_sidang'] = $row->jam_sidang;
					$data['agenda'] = $row->agenda;
					$data['ruangan'] = $row->ruangan;
					$data['nomor_perkara'] = $row->nomor_perkara;
					$data['pihak1'] = $row->pihak1_text;
					$data['pihak2'] = $row->pihak2_text;
					$data['majelis_hakim'] = $row->majelis_hakim_text;
					$data['panitera_pengganti'] = $row->panitera_pengganti_text;
					$data['keterangan'] = $row->keterangan;
					$data['alur_perkara'] = $row->alur_perkara_id;
					$data['page_title'] = 'JADWAL SIDANG '.strtoupper($this->perkara->getJenisPerkara($row->alur_perkara_id));
				}	
			}
		}

		$result = $this->perkara->getDataPetitumDakwaan($idperkara);
		if($result!=''){
			if($result->num_rows()>0){
				foreach ($result->result() as $row) {
					$data['pasal_dakwaan'] = $row->pasal_dakwaan;
					$data['petitum_dakwaan'] = $row->petitum_dakwaan;
				}
			}
		}

		if($data['idalurperkara']>100){
			$data['data_penahanan'] = $this->perkara->getDataPenahanan($idperkara);
		}
		$this->load->vars($data);
		$this->load->view('jadwal_sidang_list/jadwal_sidang_list_detil');
	}


}