<?php 
class M_staptu extends CI_Model{

	function get_all_staptu(){
		$hsl=$this->db->query("SELECT * FROM tbl_staptu");
		return $hsl;
	}

	function simpan_staptu($nik,$nama,$jenkel,$tmp_lahir,$tgl_lahir,$jabatan,$photo){
		$hsl=$this->db->query("INSERT INTO tbl_staptu (staptu_nik,staptu_nama,staptu_jenkel,staptu_tmp_lahir,staptu_tgl_lahir,staptu_jabatan,staptu_photo) VALUES ('$nik','$nama','$jenkel','$tmp_lahir','$tgl_lahir','$jabatan','$photo')");
		return $hsl;
	}
	function simpan_staptu_tanpa_img($nik,$nama,$jenkel,$tmp_lahir,$tgl_lahir,$jabatan){
		$hsl=$this->db->query("INSERT INTO tbl_staptu (staptu_nik,staptu_nama,staptu_jenkel,staptu_tmp_lahir,staptu_tgl_lahir,staptu_jabatan) VALUES ('$nik','$nama','$jenkel','$tmp_lahir','$tgl_lahir','$jabatan')");
		return $hsl;
	}

	function update_staptu($kode,$nik,$nama,$jenkel,$tmp_lahir,$tgl_lahir,$jabatan,$photo){
		$hsl=$this->db->query("UPDATE tbl_staptu SET staptu_nik='$nik',staptu_nama='$nama',staptu_jenkel='$jenkel',staptu_tmp_lahir='$tmp_lahir',staptu_tgl_lahir='$tgl_lahir',staptu_jabatan='$jabatan',staptu_photo='$photo' WHERE staptu_id='$kode'");
		return $hsl;
	}
	function update_staptu_tanpa_img($kode,$nik,$nama,$jenkel,$tmp_lahir,$tgl_lahir,$jabatan){
		$hsl=$this->db->query("UPDATE tbl_staptu SET staptu_nik='$nik',staptu_nama='$nama',staptu_jenkel='$jenkel',staptu_tmp_lahir='$tmp_lahir',staptu_tgl_lahir='$tgl_lahir',staptu_jabatan='$jabatan' WHERE staptu_id='$kode'");
		return $hsl;
	}
	function hapus_staptu($kode){
		$hsl=$this->db->query("DELETE FROM tbl_staptu WHERE staptu_id='$kode'");
		return $hsl;
	}

	//front-end
	function staptu(){
		$hsl=$this->db->query("SELECT * FROM tbl_staptu");
		return $hsl;
	}
	function staptu_perpage($offset,$limit){
		$hsl=$this->db->query("SELECT * FROM tbl_staptu limit $offset,$limit");
		return $hsl;
	}

}