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

class convert_insert_m extends CI_Model{

	function getfile($perkara_id){
		if(empty($perkara_id)){
				return '';
			}
		try{
			$query="SELECT amar_putusan_dok FROM perkara_putusan WHERE perkara_id=$perkara_id";
			$query=$this->db->query($query);
			return $query->result_array();

		}catch (Exception $e){
			log_message('error', $e);
		}
	}

	function getfile_Annmous($perkara_id,$dokumen_ref_id_Annmous){
		if(empty($perkara_id)){
				return '';
			}
		try{
			$query="SELECT path_filename FROM dirput_dokumen WHERE perkara_id=$perkara_id AND dokumen_ref_id = $dokumen_ref_id_Annmous";
			//echo $query;exit();
			$query=$this->db->query($query);
			return $query->result_array();

		}catch (Exception $e){
			log_message('error', $e);
		}
	}
	
	function getfile_Annmous_ref($perkara_id){
		if(empty($perkara_id)){
				return '';
			}
		try{
			$query="SELECT path_filename FROM dirput_dokumen WHERE perkara_id=$perkara_id";
			$query=$this->db->query($query);
			return $query->result_array();

		}catch (Exception $e){
			log_message('error', $e);
		}
	}

	
	function get_ref_dirput_putusan($perkara_id,$ref_id){
		if(empty($perkara_id)){
				return '';
			}
		try{
			$query="SELECT b.dokumen_ref_id
				FROM perkara AS a
				LEFT JOIN dirput_dokumen_ref AS b ON a.alur_perkara_id=b.alur_perkara_id
				WHERE b.urutan=$ref_id AND a.perkara_id=$perkara_id";
			$query=$this->db->query($query);
			return $query->result_array();

		}catch (Exception $e){
			log_message('error', $e);
		}
	}

}



/* End of file convert_insert_m.php */
/* Location: ./application/models/api/convert_insert_m.php */