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

/**
* User Resource Model
*/
class Users_model extends CI_Model
{

    public function get_user_type_code($user_type)
    {
        $this->db->where('user_type',$user_type);
        
        $result=$this->db->get('tbl_user_mtr');
        
        if($result->num_rows()==1)
        {
            return $result->row(0)->type_code;
        }
        else
        {
            return false;
        }
    }
        
    public function user_login($user,$pass)
    {
         //validate
         $this->db->where('username',$user);
         $this->db->where('password',$pass);
         
         $result=$this->db->get('tbl_employee');
         
         if($result->num_rows()==1)
         {
             return $result->row(0)->id;
         }
         else
         {
             return false;
         }
        
    }

    public function get_user_by_user_pass($user,$pass)
    {
        //$this->db->order_by('website_data.sub_menu_id', 'DESC');
        $query=$this->db->get_where('tbl_employee',array('username'=>$user,'password'=>$pass));
        return $query->row_array();        
    }



}