<?php
class User_model extends CI_Model
{
	function select_all()
	{
	    $role = array("Operator", "Pimpinan");
	    $this->db->where_in('role', $role);
		$this->db->order_by('nama_lengkap', 'ASC');
		$query = $this->db->get('akun');
		return $query;
	}
	
	function select_by_ID($ID)
	{
		$this->db->where('username', $ID);
		$query = $this->db->get('akun');
		return $query;
	}
	
	function select_by_username_password($username, $password)
	{
		$this->db->where('username', $username);
		$this->db->where('password', md5($password));
		$query = $this->db->get('akun');
		return $query;
	}


	function insert($data)
	{
		$this->db->insert('akun', $data);
	}
	
	function replace($data)
	{
	    $this->db->replace('akun', $data);
	}
	
	function update($data, $where)
	{
	    $this->db->where('username', $where);
	    $this->db->update('akun', $data);
	}
	
	function delete($data)
	{
		$this->db->delete('akun', $data);
	}
}
