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

class hak_akses_m extends CI_Model{

	function get_hakim_panitera_jurusita_ids($perkara_id){
		try {
			$this->db->select('majelis_hakim_id,panitera_pengganti_id,jurusita_id');
			$this->db->from('perkara_penetapan');
			$this->db->where('perkara_id', $perkara_id);
			return $this->db->get();
		} catch (Exception $e) {
			return '';
		}
	}

	function get_jurusita_delegasi($delegasi_id){
		try {
			$this->db->select('jurusita_id');
			$this->db->from('delegasi_proses_masuk');
			$this->db->where('delegasi_id', $delegasi_id);
			return $this->db->get();
		} catch (Exception $e) {
			return '';
		}
	}

	function get_hakim_panitera_jurusita_ids_keberatan($perkara_id){
		try {
			$this->db->select('majelis_hakim_id,panitera_pengganti_id,jurusita_id');
			$this->db->from('perkara_keberatan');
			$this->db->where('perkara_id', $perkara_id);
			return $this->db->get();
		} catch (Exception $e) {
			return '';
		}
	}

	function get_hakim_panitera_jurusita_ids_verzet($perkara_id){
		try {
			$this->db->select('majelis_hakim_id,panitera_pengganti_id,jurusita_id');
			$this->db->from('perkara_verzet');
			$this->db->where('perkara_id', $perkara_id);

			return $this->db->get();
		} catch (Exception $e) {
			return '';
		}
	}

	function get_hakim_panitera_jurusita_ids_ikrar($perkara_id){
		try {
			$this->db->select('majelis_hakim_id,panitera_pengganti_id,jurusita_id');
			$this->db->from('perkara_ikrar_talak');
			$this->db->where('perkara_id', $perkara_id);

			return $this->db->get();
		} catch (Exception $e) {
			return '';
		}
	}

	function getInfoPerkara($idperkara){
		try {
			$q = $this->db->query('SELECT tanggal_putusan
				FROM v_perkara 
				WHERE perkara_id='.$idperkara.';');
			return $q;
		} catch (Exception $e) {
			return '';
		}
	}

	function getInfoPerkaraVerzet($idperkara){
		try {
			$q = $this->db->query('SELECT putusan_verzet FROM perkara_verzet  WHERE perkara_id='.$idperkara.';');
			return $q;
		} catch (Exception $e) {
			return '';
		}
	}

	function getInfoPerkaraIkrarTalak($idperkara){
		try {
			$q = $this->db->query('SELECT tgl_ikrar_talak FROM perkara_ikrar_talak  WHERE perkara_id='.$idperkara.';');
			return $q;
		} catch (Exception $e) {
			return '';
		}
	}

	function getInfoPerkaraKeberatan($idperkara){
		try {
			$q = $this->db->query('SELECT putusan_keberatan FROM perkara_keberatan WHERE perkara_id='.$idperkara.';');
			return $q;
		} catch (Exception $e) {
			return '';
		}
	}

	function getStatusVerzet($idperkara){
		try {
			$q = $this->db->query('SELECT proses_terakhir_id
				FROM v_perkara 
				WHERE perkara_id='.$idperkara.';');
			return $q;
		} catch (Exception $e) {
			return '';
		}
	}

	function getInfoPerkaraBanding($idperkara){
		try {
			$q = $this->db->query('SELECT putusan_banding
				FROM v_perkara_banding 
				WHERE perkara_id='.$idperkara.';');
			return $q;
		} catch (Exception $e) {
			return '';
		}
	}

	function getInfoPerkaraKasasi($idperkara){
		try {
			$q = $this->db->query('SELECT putusan_kasasi
				FROM v_perkara_kasasi
				WHERE perkara_id='.$idperkara.';');
			return $q;
		} catch (Exception $e) {
			return '';
		}
	}

	function getInfoPerkaraPK($idperkara){
		try {
			$q = $this->db->query('SELECT putusan_pk
				FROM v_perkara_pk
				WHERE perkara_id='.$idperkara.';');
			return $q;
		} catch (Exception $e) {
			return '';
		}
	}

	function getInfoProsesId($perkara_id, $proses_id){
		try {
			$this->db->select('proses_id');
			$this->db->from('perkara_proses');
			$this->db->where('perkara_id', $perkara_id);
			$this->db->where('proses_id', $proses_id);
			return $this->db->get();
		} catch (Exception $e) {
			return '';
		}
	}
    
}