<?php
class Xco_model extends MX_Controller{
	public function __construct(){
		parent::__construct();
	}

	public function listar($texto=''){
		$where 	= ($texto!='')?" AND con_descripcion LIKE '%{$texto}%'":"";
		$query 	= "SELECT * FROM consultorio WHERE con_estado = 0 {$where}";
		return 	$this->db->query($query);
	}

	public function validar($descripcion){
		$this->db->select('con_id')->from('consultorio')->where('con_estado', 0);
		$this->db->where('con_descripcion', $descripcion);
		$query 	= $this->db->get();
		return 	$query->row();
	}

	public function insertar($data){
		$this->db->insert('consultorio', $data);
	}

	public function editar($id, $data){
		$this->db->where('con_id', $id);
		$this->db->update('consultorio', $data);
	}
}