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

class Manage_new_perkara extends CI_Controller {

	function redir_new_perdata(){
		$this->setParams();
		redirect('add_perdata');
	}
    
    function redir_new_kasasi(){
		$this->setParams();
		$this->nativesession->set_flash_session('tahapan_id', 30);
		redirect('add_perdata');
	}

	function redir_new_pk(){
		$this->setParams();
		$this->nativesession->set_flash_session('tahapan_id', 40);
		redirect('add_perdata');
	}
  
	function redir_new_pidana_lalulintas(){
		$this->setParams();
		redirect('add_lalulintas');
		//redirect('perkara_lalulintas/add_perkara');
	}
	
	function redir_new_grasi(){
		$this->setParams();
		redirect('perkara_grasi/add_grasi');
	}

	function redir_new_pidana(){
		$this->setParams();
		redirect('add_pidana');
	}

	function redir_new_perlawanan(){
		$this->setParams();
		show_404();
	}

	function setParams(){
		$segment = $this->uri->segment_array();
		if(count($segment)!=2){
			redirect('login');
		}
		$this->nativesession->set_flash_session('security', TRUE);
		#$this->nativesession->set_flash_session('url_requested', base_url(uri_string()));
		$enc = $this->encrypt->decode(base64_decode($this->uri->segment(2)));
		#varlist_alur_perkara_id=1;var_tahapan_id=10
		
		$tmp = explode(";", $enc);
		if(count($tmp)<2){
			$tmp_alur_perkara = explode("=", $enc);
			if(count($tmp_alur_perkara)>0){
				$alur_perkara_id = $tmp_alur_perkara[0];
				$this->nativesession->set_flash_session('alur_perkara_id', $alur_perkara_id);
				$this->nativesession->set_flash_session('tahapan_id', 20);
			}else{
				redirect('login');
			}
		}else{
			$tmp_alur_perkara = explode("=", $tmp[0]);
			if(count($tmp_alur_perkara)>1){
				$alur_perkara_id = $tmp_alur_perkara[1];
				$this->nativesession->set_flash_session('alur_perkara_id', $alur_perkara_id);
			}else{
				redirect('login');
			}

			$tmp_tahapan_id = explode("=", $tmp[1]);
			if(count($tmp_tahapan_id)>1){
				$tahapan_id = $tmp_tahapan_id[1];
				$this->nativesession->set_flash_session('tahapan_id', $tahapan_id);
			}else{
				redirect('login');
			}

		}
	}
}
