<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 
Class Verify extends CI_Controller{

	function __Construct()
    {
        parent ::__construct();
		$this->load->model('m_verify');
		$this->load->library('excel');
		//$this->load->library('Pdf');
		$this->load->library('pdf');
		$this->load->helper('pdf_helper');//panggil tcpdf
		$this->load->helper('tgl_indonesia');//helper tanggal indonesia
    	
	}
	
	function no($unik)
	{
			$data['detail']   = $this->m_verify->view($unik);	
			$data[search]='home/isi/form_cari';
			$data[result]='modul/sertifikat/v_verify';
			$this->load->view('home/tmp',$data);
	}
	
	function render($unik)
	{
			$data['detail']   = $this->m_verify->view($unik);
			$this->load->view('modul/sertifikat/render_qr',$data);	
	}
	
	
	function v($unik,$id_acara)
	{
		
			
			//$this->load->view('welcome_message');
			
			$result =$this->db->query("SELECT * FROM tbl_acara
			where id_acara=$id_acara");
			foreach ($result->result_array() as $s)
			$template=$s['template'];
			
			if($template==NULL){
				$data['detail']   = $this->m_verify->view($unik);
				$this->load->view('modul/sertifikat/template_fpmp',$data);
				//$this->load->view('welcome_message');
			}else{
				$data['detail']   = $this->m_verify->view($unik);
				//$this->load->view('modul/sertifikat/tcpdf',$data);
				//$this->load->view('welcome_message');
				$this->load->view('modul/sertifikat/'.$template.'',$data);
			}
			
				
	}
	
	function search()
	{
			$data['detail']   = $this->m_verify->cari();
			$data[search]='home/isi/form_cari';
			$data[result]='modul/sertifikat/hasil_cari';
			$this->load->view('home/tmp',$data);
	}
	
	function search_sert()
	{
		$data['peserta']   = $this->m_verify->cari_sert();
		if($data['peserta']==null) 
		{
		
		$data['notifikasi'] = '
				<center><div class="alert alert-danger">
                <a class="close" data-dismiss="alert" href="#">&times;</a>
                <h3>Peringatan !</h3>
                Data yang anda cari tidak ada atau keywordnya salah<br>
				<a href="javascript:history.back()" class="btn btn-xs btn-warning" type="reset" data-action="collapse">
					<i class="ace-icon fa fa-undo bigger-110"></i>
					Kembali
				</button></a>
				</center>
			 </div>';
			 $this->session->set_flashdata('message', '<center><div class="alert alert-danger">
			 <a class="close" data-dismiss="alert" href="#">&times;</a>
			 <h3>Peringatan !</h3>
			 Data yang anda cari tidak ada atau keywordnya salah<br>
			 <a href="javascript:history.back()" class="btn btn-xs btn-warning" type="reset" data-action="collapse">
				 <i class="ace-icon fa fa-undo bigger-110"></i>
				 Kembali
			 </button></a>
			 </center>
		  </div>');	
			 $data[search]='home/isi/form_cari_sertifikat';
			 $data[result]='admin/notifikasi';
			 $this->load->view('home/tmp',$data);
			
		}else {
			
			$data[search]='home/isi/form_cari_sertifikat';
			$data[result]='modul/sertifikat/hasil_cari_sert';
			$this->load->view('home/tmp',$data);
			}
	}
	
	
}
?>