
Enviado em 14/04/2015 - 11:50h
Bom dia pessoal
<?php
class Mapos_model extends CI_Model {
function __construct() {
parent::__construct();
}
function get($table,$fields,$where='',$perpage=0,$start=0,$one=false,$array='array'){
$this->db->select($fields);
$this->db->from($table);
$this->db->limit($perpage,$start);
if($where){
$this->db->where($where);
}
$query = $this->db->get();
$result = !$one ? $query->result() : $query->row();
return $result;
}
function getById($id){
$this->db->from('usuarios');
$this->db->select('usuarios.*, permissoes.nome as permissao');
$this->db->join('permissoes', 'permissoes.idPermissao = usuarios.permissoes_id', 'left');
$this->db->where('idUsuarios',$id);
$this->db->limit(1);
return $this->db->get()->row();
}
public function alterarSenha($senha,$oldSenha,$id){
$this->db->where('idUsuarios', $id);
$this->db->limit(1);
$usuario = $this->db->get('usuarios')->row();
$this->db->join('permissoes', 'permissoes.idPermissao = usuarios.permissoes_id', 'left');
$this->db->where('idUsuarios',$id);
$this->db->limit(1);
return $this->db->get()->row();
}
public function alterarSenha($senha,$oldSenha,$id){
$this->db->where('idUsuarios', $id);
$this->db->limit(1);
$usuario = $this->db->get('usuarios')->row();
if($usuario->senha != $oldSenha){
return false;
}
else{
$this->db->set('senha',$senha);
$this->db->where('idUsuarios',$id);
return $this->db->update('usuarios');
}
}
#################################################################### BLOCO ORIGINAL
function pesquisar($termo){
$data = array();
// buscando clientes
$this->db->like('nomeCliente',$termo);
$this->db->limit(5);
$data['clientes'] = $this->db->get('clientes')->result();
#########################################################################
#################### bloco com alterações que preciso ##########################
function pesquisar($termo){
$data = array();
// buscando clientes
$this->db->like('nomeCliente','documento',$termo);
$this->db->limit(5);
$data['clientes'] = $this->db->get('clientes')->result();
LazyDocker – Interface de Usuário em Tempo Real para o Docker
Instalando COSMIC no Linux Mint
Turbinando o Linux Mint: o poder das Nemo Actions
Inteligência Artificial no desenvolvimento de software: quando começar a usar?
O widget do Plasma 6 Área de Notificação
[Resolvido] Algo deu errado ao abrir seu perfil
Quando vocês pararam de testar distros? (14)
Problema com som no laptop (3)
Não estou conseguindo fazer funcionar meu Postfix na versão 2.4 no Deb... (2)









