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

class Peserta_model extends CI_Model {

    public function __construct()
	{
		parent::__construct();
		$this->load->database();
	}
	
	public function user2($no_pendaftaran)
	{
		$this->db->select('*');
		$this->db->from('data_siswa');
		$this->db->where('no_pendaftaran', $no_pendaftaran);
		$this->db->order_by('no_pendaftaran','desc');
		$query = $this->db->get();
		return $query->row();		
	}

    //ambil data peserta
	public function listing()
	{

		$this->db->select('*');
		$this->db->from('v_rpt_trans_formulir_web');
		$this->db->order_by('no_pendaftaran','desc');
		$query = $this->db->get();
		return $query->result();			
	}

	//hitung total peserta
	public function total()
	{

		$this->db->select('COUNT(*) AS total');
		$this->db->from('v_rpt_trans_formulir_web');
		$this->db->order_by('no_pendaftaran','desc');
		$query = $this->db->get();
		return $query->row();			
	}

	public function detail($no_pendaftaran)
	{

		$this->db->select('*');
		$this->db->from('v_rpt_trans_formulir_web');
		$this->db->where('no_pendaftaran', $no_pendaftaran);
		$this->db->order_by('no_pendaftaran','desc');
		$query = $this->db->get();
		return $query->row();			
	}

	public function cari($no_pendaftaran)
	{

		$this->db->select('*');
		$this->db->from('data_siswa');
		$this->db->where('no_pendaftaran', $no_pendaftaran);
		$this->db->order_by('no_pendaftaran','desc');
		$query = $this->db->get();
		return $query->row();			
	}

	//ubah peserta
	public function edit($data)
	{
		$this->db->where('no_pendaftaran', $data['no_pendaftaran']);
		$this->db->update('data_siswa', $data);
	}

	//ubah peserta
	public function editjur($data)
	{
		$this->db->where('no_pendaftaran', $data['no_pendaftaran']);
		$this->db->update('data_siswa', $data);
	}


	//ambil data ViewUrut all
	public function ViewUrutAll()
	{

		$this->db->select('*');
		$this->db->from('v_rpt_trans_formulir_web');
		$this->db->order_by('no_pendaftaran','ASC');
		$query = $this->db->get();
		return $query->result();					
	}	


}

/* End of file Peserta_model.php */
/* Location: ./application/models/Peserta_model.php */