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

/**
* Student Model
*/
class Student_Model extends CI_Model
{
	public $table = 'user';
	public $role_type;
	
	function __construct()
	{
		parent::__construct();

		$this->role_type = $this->db->get_where('user_role',array('role_name'=>'student'))->row()->role_ID;
	}

	public function get($user_ID = NULL)
	{
		if($user_ID !== NULL) {
			$query = $this->db->get_where($this->table,array('user_ID'=>$user_ID,'role_ID'=>$this->role_type));
			return $query->row();
		}
		$query = $this->db->get_where($this->table,array('role_ID'=>$this->role_type));
		return $query->result();
	}
}