<?php
/*
Fungsi : Model untuk modul user
*/
class User_model extends CI_Model {
	/**
	 * Constructor
	 */
	function User_model()
	{
		parent::__construct();
	}
	
/* Insialiasi nama table */

	var $table_user 		= 'master_user';

/*-----------------------USER MODEL---------------------------*/	
	
	/* Check login */
	function check_login($uid)
	{
		$this->db->where('uid', $uid);
		return $this->db->get($this->table_user);
	}
	
	/* Get user menu */
  	function get_user_menu($roleid)
		{	
			$this->db->select('*');
			$this->db->from('master_menu');
			$this->db->join('role_menu', 'role_menu.mid = master_menu.mid');
			$this->db->where('role_menu.roleid', $roleid);
			$this->db->order_by('role_menu.mid','master_menu.pid','ASC');
			$query = $this->db->get();
			
			return $query;
		}
	
	
		
/*-----------------------USER MODEL---------------------------*/	
}