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

class Users_model extends CI_Model {
    
    /**
     * Constructor
     *
     */
    
    function __construct()
    {
        parent::__construct();
    }
    
    
    // --------------------------------------------------------------------
    
    /**
     * Get Users
     *
     * @access	private
     * @param	array	conditions to fetch data
     * @return	object	object with result set
     */
    function getUsers($conditions=array(),$fields='')
    {
        if(count($conditions)>0)
            $this->db->where($conditions);
        
        $this->db->from('usuario');
        
        $this->db->order_by("usuario.id", "asc");
        
        
        if($fields!='')
            $this->db->select($fields);
        else
            $this->db->select('usuario.id as user_id, REPLACE(REPLACE(usuario.nombre, " ", "_"), ".", "") as user_name,usuario.correo as user_email, 1 as online');
        
        $result = $this->db->get();
        
        return $result;
        
        
    }//End of getUsers Function
}