code
stringlengths 1
2.01M
| repo_name
stringlengths 3
62
| path
stringlengths 1
267
| language
stringclasses 231
values | license
stringclasses 13
values | size
int64 1
2.01M
|
|---|---|---|---|---|---|
<?php
/**
* Description of ClienteBonusService
*
* @author Magno
*/
class ClienteBonusService {
private $clienteBonusDAO;
function __construct() {
$this->clienteBonusDAO = new ClienteBonusDAO();
}
public function salvar($clienteBonus) {
try {
return $this->clienteBonusDAO->salvar($clienteBonus);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($bonusID, $usuarioID) {
try {
if(!isset ($bonusID) || $bonusID <= 0
|| !isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do ClienteBonus Nao Econtrado!!!");
$this->clienteBonusDAO->excluir($bonusID, $usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0, $bonusID = -1, $usuarioID = -1, $inicio = "", $carregarDependencias = false) {
try {
return $this->clienteBonusDAO->listar($pagina, $bonusID, $usuarioID, $inicio, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "bonusID", $direcao = "DESC", $carregarDependencias = false) {
try {
return $this->clienteBonusDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($bonusID, $usuarioID, $carregarDependencias) {
try {
if(!isset ($bonusID) || $bonusID <= 0
|| !isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do ClienteBonus Nao Econtrado!!!");
return $this->clienteBonusDAO->buscarPorID($bonusID, $usuarioID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($bonusID = -1, $usuarioID = -1, $inicio = "") {
try {
return $this->clienteBonusDAO->total($bonusID, $usuarioID, $inicio);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/ClienteBonusService.class.php
|
PHP
|
asf20
| 2,372
|
<?php
/**
* Description of PacoteLanceService
*
* @author Magno
*/
class PacoteLanceService {
private $pacoteLanceDAO;
public function __construct() {
$this->pacoteLanceDAO = new PacoteLanceDAO();
}
public function salvar($pacoteLance) {
try {
return $this->pacoteLanceDAO->salvar($pacoteLance);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($pacoteLanceID) {
try {
if(!isset ($pacoteLanceID) || $pacoteLanceID <= 0)
throw new Exception("Codigo do PacoteLance Nao Econtrado!!!");
$this->pacoteLanceDAO->excluir($pacoteLanceID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$quantidade = "", $valor = "") {
try {
return $this->pacoteLanceDAO->listar($pagina, $quantidade, $valor);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($pacoteLanceID) {
try {
if(!isset ($pacoteLanceID) || $pacoteLanceID <= 0)
throw new Exception("Codigo do PacoteLance Nao Econtrado!!!");
$this->pacoteLanceDAO->buscarPorID($pacoteLanceID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($quantidade = "", $valor = "") {
try {
return $this->pacoteLanceDAO->total($quantidade, $valor);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/PacoteLanceService.class.php
|
PHP
|
asf20
| 1,708
|
<?php
/**
* Description of VotoService
*
* @author Magno
*/
class VotoService {
private $votoDAO;
function __construct() {
$this->votoDAO = new VotoDAO();
}
public function salvar($voto) {
try {
return $this->votoDAO->salvar($voto);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($enqueteID, $usuarioID) {
try {
if(!isset ($enqueteID) || $enqueteID <= 0
|| !isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Voto Nao Econtrado!!!");
$this->votoDAO->excluir($enqueteID, $usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0, $enqueteID = -1, $usuarioID = -1, $respostaID = "", $carregarDependencias = false) {
try {
return $this->votoDAO->listar($pagina, $enqueteID, $usuarioID, $respostaID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "enqueteID", $direcao = "DESC", $carregarDependencias = false) {
try {
return $this->votoDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($enqueteID, $usuarioID, $carregarDependencias) {
try {
if(!isset ($enqueteID) || $enqueteID <= 0
|| !isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Voto Nao Econtrado!!!");
return $this->votoDAO->buscarPorID($enqueteID, $usuarioID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($enqueteID = -1, $usuarioID = -1, $respostaID = "") {
try {
return $this->votoDAO->total($enqueteID, $usuarioID, $respostaID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/VotoService.class.php
|
PHP
|
asf20
| 2,294
|
<?php
/**
* Description of RespostaService
*
* @author Magno
*/
class RespostaService {
private $respostaDAO;
function __construct() {
$this->respostaDAO = new RespostaDAO();
}
public function salvar($resposta) {
try {
return $this->respostaDAO->salvar($resposta);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($respostaID) {
try {
if(!isset ($respostaID) || $respostaID <= 0)
throw new Exception("Codigo da Resposta Nao Econtrado!!!");
$this->respostaDAO->excluir($respostaID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$descricao = "", $enqueteID = 0, $carregarDependencias = false) {
try {
return $this->respostaDAO->listar($pagina, $descricao, $enqueteID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "respostaID", $direcao = "DESC") {
try {
return $this->respostaDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($respostaID, $carregarDependencias = false) {
try {
if(!isset ($respostaID) || $respostaID <= 0)
throw new Exception("Codigo da Resposta Nao Econtrado!!!");
return $this->respostaDAO->buscarPorID($respostaID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($descricao = "",$enqueteID = 0) {
try {
return $this->respostaDAO->total($descricao, $enqueteID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/RespostaService.class.php
|
PHP
|
asf20
| 2,079
|
<?php
/**
* Description of InformacaoService
*
* @author Magno
*/
class InformacaoService {
private $informacaoDAO;
function __construct() {
$this->informacaoDAO = new InformacaoDAO();
}
public function salvar($informacao) {
try {
return $this->informacaoDAO->salvar($informacao);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($informacaoID) {
try {
if(!isset ($informacaoID) || $informacaoID <= 0)
throw new Exception("Codigo da Informacao Nao Econtrado!!!");
$this->informacaoDAO->excluir($informacaoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0, $tipo = -1, $usuarioID = -1, $statusID = -1, $carregarDependencias = false) {
try {
return $this->informacaoDAO->listar($pagina, $tipo, $usuarioID, $statusID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "informacaoID", $direcao = "DESC", $carregarDependencias = false) {
try {
return $this->informacaoDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($informacaoID, $carregarDependencias = false) {
try {
if(!isset ($informacaoID) || $informacaoID <= 0)
throw new Exception("Codigo da Informacao Nao Econtrado!!!");
return $this->informacaoDAO->buscarPorID($informacaoID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($tipo = -1, $usuarioID = -1, $statusID = -1) {
try {
return $this->informacaoDAO->total($tipo, $usuarioID, $statusID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/InformacaoService.class.php
|
PHP
|
asf20
| 2,219
|
<?php
/**
* Description of BonusService
*
* @author Magno
*/
class BonusService {
private $bonusDAO;
function __construct() {
$this->bonusDAO = new BonusDAO();
}
public function salvar($bonus) {
try {
return $this->bonusDAO->salvar($bonus);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($bonusID) {
try {
if(!isset ($bonusID) || $bonusID <= 0)
throw new Exception("Codigo da Bonus Nao Econtrado!!!");
$this->bonusDAO->excluir($bonusID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$descricao = "") {
try {
return $this->bonusDAO->listar($pagina, $descricao);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "bonusID", $direcao = "DESC") {
try {
return $this->bonusDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($bonusID) {
try {
if(!isset ($bonusID) || $bonusID <= 0)
throw new Exception("Codigo da Bonus Nao Econtrado!!!");
return $this->bonusDAO->buscarPorID($bonusID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($descricao = "") {
try {
return $this->bonusDAO->total($descricao);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/BonusService.class.php
|
PHP
|
asf20
| 1,844
|
<?php
class AdminService {
private $adminDAO;
public function __construct() {
$this->adminDAO = new AdminDAO();
}
public function salvar($admin) {
$conexao = Conexao::getConexao();
$conexao->beginTransaction();
try {
$admin->setSenha(Seguranca::criptografaSenha($admin->getSenha()));
if($admin->getUsuarioID() <= 0){
if($this->exitePorEmail($admin->getEmail()))
throw new Exception("Erro, ja existe um Admin com esse Email!!!");
if($this->exitePorLogin($admin->getLogin()))
throw new Exception("Erro, ja existe um Admin com esse Login!!!");
}
$admin = $this->adminDAO->salvar($admin);
if(!strpos($admin->getMedia()->getCaminho(), Constantes::$IMG_ADM_DEFAULT)){
Util::geraThumb($admin->getMedia()->getCaminho(), Constantes::$TAM_THUMB_IMG);
}
$conexao->commit();
return $admin;
} catch (Exception $err) {
$conexao->rollBack();
throw new Exception($err->getMessage());
}
}
public function excluir($adminID) {
try {
if (!isset($adminID) || $adminID <= 0)
throw new Exception("Codigo do Admin Nao Econtrado!!!");
$this->adminDAO->excluir($adminID);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0, $email = "", $login = "", $statusID = -1, $carregarDependencias = false) {
try {
return $this->adminDAO->listar($pagina, $email, $login, $statusID, $carregarDependencias);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "adminID", $direcao = "DESC", $carregarDependencias = false) {
try {
return $this->adminDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao, $carregarDependencias);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($adminID, $carregarDependencias = false) {
try {
if (!isset($adminID) || $adminID <= 0)
throw new Exception("Codigo do Admin Nao Econtrado!!!");
return $this->adminDAO->buscarPorID($adminID, $carregarDependencias);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($email = "", $login = "", $statusID = -1) {
try {
return $this->adminDAO->total($email, $login, $statusID);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function exitePorEmail($email){
if($this->total($email) > 0) return true;
return false;
}
public function exitePorLogin($login){
if($this->total("",$login) > 0) return true;
return false;
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/AdminService.class.php
|
PHP
|
asf20
| 3,133
|
<?php
/**
* Description of PessoaService
*
* @author Magno
*/
class PessoaService {
private $pessoaDAO;
function __construct() {
$this->pessoaDAO = new PessoaDAO();
}
public function salvar($pessoa) {
try {
return $this->pessoaDAO->salvar($pessoa);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($usuarioID) {
try {
if(!isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Pessoa Nao Econtrado!!!");
$this->pessoaDAO->excluir($usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function existe($usuarioID) {
try {
if(!isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Pessoa Nao Econtrado!!!");
return $this->pessoaDAO->existe($usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$nome = "", $cpf = "", $carregarDependencias = false) {
try {
return $this->pessoaDAO->listar($pagina, $nome, $cpf, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($usuarioID, $carregarDependencias = false) {
try {
if(!isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Pessoa Nao Econtrado!!!");
return $this->pessoaDAO->buscarPorID($usuarioID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function exitePorCpf($cpf){
if($this->total("",$cpf) > 0) return true;
return false;
}
public function total($nome = "", $cpf = "") {
try {
return $this->pessoaDAO->total($nome, $cpf);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/PessoaService.class.php
|
PHP
|
asf20
| 2,153
|
<?php
/**
* Description of CategoriaProdutoService
*
* @author Magno
*/
class CategoriaProdutoService {
private $categoriaProdutoDAO;
public function __construct() {
$this->categoriaProdutoDAO = new CategoriaProdutoDAO();
}
public function salvar($categoriaProduto) {
try {
return $this->categoriaProdutoDAO->salvar($categoriaProduto);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($categoriaProdutoID) {
try {
if(!isset ($categoriaProdutoID) || $categoriaProdutoID <= 0)
throw new Exception("Codigo do CategoriaProduto Nao Econtrado!!!");
$this->categoriaProdutoDAO->excluir($categoriaProdutoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$descricao = "") {
try {
return $this->categoriaProdutoDAO->listar($pagina, $descricao);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($categoriaProdutoID) {
try {
if(!isset ($categoriaProdutoID) || $categoriaProdutoID <= 0)
throw new Exception("Codigo do CategoriaProduto Nao Econtrado!!!");
$this->categoriaProdutoDAO->buscarPorID($categoriaProdutoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($descricao = "") {
try {
return $this->categoriaProdutoDAO->total($descricao);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/CategoriaProdutoService.class.php
|
PHP
|
asf20
| 1,772
|
<?php
/**
* Description of EstadoService
*
* @author Magno
*/
class EstadoService {
private $estadoDAO;
public function __construct() {
$this->estadoDAO = new EstadoDAO();
}
public function salvar($estado) {
try {
return $this->estadoDAO->salvar($estado);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($estadoID) {
try {
if(!isset ($estadoID) || $estadoID <= 0)
throw new Exception("Codigo do Estado Nao Econtrado!!!");
$this->estadoDAO->excluir($estadoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$nome = "", $sigla = "") {
try {
return $this->estadoDAO->listar($pagina,$nome,$sigla);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($estadoID) {
try {
if(!isset ($estadoID) || $estadoID <= 0)
throw new Exception("Codigo do Estado Nao Econtrado!!!");
$this->estadoDAO->buscarPorID($estadoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorSigla($sigla) {
try {
if(!isset ($sigla) || strlen($sigla) <= 0)
throw new Exception("Sigla do Estado Nao Econtrado!!!");
$this->estadoDAO->buscarPorSigla($sigla);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($nome = "",$sigla = "") {
try {
return $this->estadoDAO->total($nome,$sigla);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/EstadoService.class.php
|
PHP
|
asf20
| 1,918
|
<?php
/**
* Description of MediaService
*
* @author Magno
*/
class MediaService {
private $mediaDAO;
public function __construct() {
$this->mediaDAO = new MediaDAO();
}
public function salvar($media) {
try {
return $this->mediaDAO->salvar($media);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($mediaID) {
try {
if(!isset ($mediaID) || $mediaID <= 0)
throw new Exception("Codigo do Media Nao Econtrado!!!");
$this->mediaDAO->excluir($mediaID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$caminho = "") {
try {
return $this->mediaDAO->listar($pagina, $caminho);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($mediaID) {
try {
if(!isset ($mediaID) || $mediaID <= 0)
throw new Exception("Codigo do Media Nao Econtrado!!!");
$this->mediaDAO->buscarPorID($mediaID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($caminho = "") {
try {
return $this->mediaDAO->total($caminho);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/MediaService.class.php
|
PHP
|
asf20
| 1,522
|
<?php
/**
* Description of DepoimentoService
*
* @author Magno
*/
class DepoimentoService {
private $depoimentoDAO;
function __construct() {
$this->depoimentoDAO = new DepoimentoDAO();
}
public function salvar($depoimento) {
try {
return $this->depoimentoDAO->salvar($depoimento);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($depoimentoID) {
try {
if(!isset ($depoimentoID) || $depoimentoID <= 0)
throw new Exception("Codigo da Depoimento Nao Econtrado!!!");
$this->depoimentoDAO->excluir($depoimentoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0, $usuarioID = -1, $statusID = -1, $carregarDependencias = false) {
try {
return $this->depoimentoDAO->listar($pagina, $usuarioID, $statusID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "depoimentoID", $direcao = "DESC", $carregarDependencias = false) {
try {
return $this->depoimentoDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($depoimentoID, $carregarDependencias = false) {
try {
if(!isset ($depoimentoID) || $depoimentoID <= 0)
throw new Exception("Codigo da Depoimento Nao Econtrado!!!");
return $this->depoimentoDAO->buscarPorID($depoimentoID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($usuarioID = -1, $statusID = -1) {
try {
return $this->depoimentoDAO->total($usuarioID, $statusID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/DepoimentoService.class.php
|
PHP
|
asf20
| 2,181
|
<?php
/**
* Description of TiposGenericosService
*
* @author Magno
*/
class TiposGenericosService {
function __construct() {
}
public static function listarTiposInformacao($incluirSelecione = false){
$tipos = array();
if($incluirSelecione)
$tipos[''] = " -- Selecione -- ";
$tipos[Constantes::$INFO_SUGESTAO] = "Sugestão";
$tipos[Constantes::$INFO_RECLAMACAO] = "Reclamação";
$tipos[Constantes::$INFO_IND_PRODUTO] = "Indicação de Produto";
return $tipos;
}
public static function buscarTipoInformacaoPorID($tipo){
switch ($tipo){
case Constantes::$INFO_SUGESTAO : return "Sugestão";
case Constantes::$INFO_RECLAMACAO : return "Reclamação";
case Constantes::$INFO_IND_PRODUTO : return "Indicação de Produto";
default : return "";
}
}
public static function listarTiposLeilao($incluirSelecione = false){
$tipos = array();
if($incluirSelecione)
$tipos[''] = " -- Selecione -- ";
$tipos[Constantes::$LEILAO_SIMPLES] = "Simples";
$tipos[Constantes::$LEILAO_FRETE_GRATIS] = "Frete Grátis";
$tipos[Constantes::$LEILAO_GRATIS] = "Grátis";
$tipos[Constantes::$LEILAO_FRETE_E_GRATIS] = "Frete Grátis e Grátis";
$tipos[Constantes::$LEILAO_DO_USUARIO] = "Do Usuário";
$tipos[Constantes::$LEILAO_VALE_COMPRA] = "Vale Compra";
$tipos[Constantes::$LEILAO_DO_INICIANTE] = "Iniciante";
$tipos[Constantes::$LEILAO_MULTI_PRODUTOS] = "Multiplos Produtos";
return $tipos;
}
public static function buscarTipoLeilaoPorID($tipo){
switch ($tipo){
case Constantes::$LEILAO_SIMPLES : return "Simples";
case Constantes::$LEILAO_FRETE_GRATIS : return "Frete Grátis";
case Constantes::$LEILAO_GRATIS : return "Grátis";
case Constantes::$LEILAO_FRETE_E_GRATIS : return "Frete Grátis e Grátis";
case Constantes::$LEILAO_DO_USUARIO : return "Do Usuário";
case Constantes::$LEILAO_VALE_COMPRA : return "Vale Compra";
case Constantes::$LEILAO_DO_INICIANTE : return "Iniciante";
case Constantes::$LEILAO_MULTI_PRODUTOS : return "Multiplos Produtos";
default : return "";
}
}
public static function listarEstadoCivil($incluirSelecione = false){
$tipos = array();
if($incluirSelecione)
$tipos[''] = " -- Selecione -- ";
$tipos[Constantes::$EST_CV_SOLTEIRO] = "Solteiro";
$tipos[Constantes::$EST_CV_CASADO] = "Casado";
$tipos[Constantes::$EST_CV_DIVORCIADO] = "Divorciado";
return $tipos;
}
public static function buscarEstadoCivilPorID($tipo){
switch ($tipo){
case Constantes::$EST_CV_SOLTEIRO : return "Solteiro";
case Constantes::$EST_CV_CASADO : return "Casado";
case Constantes::$EST_CV_DIVORCIADO : return "Divorciado";
default : return "";
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/TiposGenericosService.class.php
|
PHP
|
asf20
| 3,238
|
<?php
/**
* Description of CompraService
*
* @author Magno
*/
class CompraService {
private $compraDAO;
function __construct() {
$this->compraDAO = new CompraDAO();
}
public function salvar($compra) {
try {
return $this->compraDAO->salvar($compra);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($compraID) {
try {
if(!isset ($compraID) || $compraID <= 0)
throw new Exception("Codigo da Compra Nao Econtrado!!!");
$this->compraDAO->excluir($compraID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0, $pacoteLanceID = -1, $usuarioID = -1, $statusID = -1, $carregarDependencias = false) {
try {
return $this->compraDAO->listar($pagina, $pacoteLanceID, $usuarioID, $statusID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "compraID", $direcao = "DESC") {
try {
return $this->compraDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($compraID, $carregarDependencias = false) {
try {
if(!isset ($compraID) || $compraID <= 0)
throw new Exception("Codigo da Compra Nao Econtrado!!!");
return $this->compraDAO->buscarPorID($compraID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($pacoteLanceID = -1, $usuarioID = -1, $statusID = -1) {
try {
return $this->compraDAO->total($pacoteLanceID, $usuarioID, $statusID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/CompraService.class.php
|
PHP
|
asf20
| 2,105
|
<?php
/**
* Description of MediaProdutoService
*
* @author Magno
*/
class MediaProdutoService {
private $mediaProdutoDAO;
function __construct() {
$this->mediaProdutoDAO = new MediaProdutoDAO();
}
public function salvar($mediaProduto) {
try {
return $this->mediaProdutoDAO->salvar($mediaProduto);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($mediaProdutoID) {
try {
if(!isset ($mediaProdutoID) || $mediaProdutoID <= 0)
throw new Exception("Codigo da MediaProduto Nao Econtrado!!!");
$this->mediaProdutoDAO->excluir($mediaProdutoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$caminho = "", $produtoID = 0, $carregarDependencias = false) {
try {
return $this->mediaProdutoDAO->listar($pagina, $caminho, $produtoID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($mediaProdutoID) {
try {
if(!isset ($mediaProdutoID) || $mediaProdutoID <= 0)
throw new Exception("Codigo da MediaProduto Nao Econtrado!!!");
return $this->mediaProdutoDAO->buscarPorID($mediaProdutoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($caminho = "", $produtoID = 0) {
try {
return $this->mediaProdutoDAO->total($caminho, $produtoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/MediaProdutoService.class.php
|
PHP
|
asf20
| 1,791
|
<?php
/**
* Description of StatusService
*
* @author Magno
*/
class StatusService {
private $statusDAO;
public function __construct() {
$this->statusDAO = new StatusDAO();
}
public function salvar($status) {
try {
return $this->statusDAO->salvar($status);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($statusID) {
try {
if(!isset ($statusID) || $statusID <= 0)
throw new Exception("Codigo do Status Nao Econtrado!!!");
$this->statusDAO->excluir($statusID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$tipo = "") {
try {
return $this->statusDAO->listar($pagina, $tipo);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($statusID) {
try {
if(!isset ($statusID) || $statusID <= 0)
throw new Exception("Codigo do Status Nao Econtrado!!!");
return $this->statusDAO->buscarPorID($statusID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($tipo = "") {
try {
return $this->statusDAO->total($tipo);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/StatusService.class.php
|
PHP
|
asf20
| 1,539
|
<?php
/**
* Description of EmailService
*
* @author Magno
*/
class EmailService {
function __construct() {
}
#por fazer
public function enviarEmail($destino, $conteudo){
return true;
}
public static function existeEmailArray($email, $array){
for ($i = 0; $i < count($array); $i++) {
print_r($array);
echo strtolower($array[$i])." $i<br>";
echo strtolower($email)." <br>";
if(strcmp( strtolower(trim($array[$i])), strtolower(trim($email)) ) == 0)
return true;
}
return false;
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/EmailService.class.php
|
PHP
|
asf20
| 681
|
<?php
/**
* Description of InteresseService
*
* @author Magno
*/
class InteresseService {
private $interesseDAO;
function __construct() {
$this->interesseDAO = new InteresseDAO();
}
public function listarCategoriaProdutoPorCliente($pagina = 0, $usuarioID = -1) {
try {
return $this->interesseDAO->listarCategoriaProdutoPorCliente($pagina, $usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarClientesPorCategoriaProduto($pagina = 0, $categoriaProdutoID = -1) {
try {
return $this->interesseDAO->listarClientesPorCategoriaProduto($pagina, $categoriaProdutoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($categoriaProdutoID = -1, $usuarioID = -1) {
try {
return $this->interesseDAO->total($categoriaProdutoID, $usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/InteresseService.class.php
|
PHP
|
asf20
| 1,099
|
<?php
/**
* Description of CidadeService
*
* @author Magno
*/
class CidadeService {
private $cidadeDAO;
function __construct() {
$this->cidadeDAO = new CidadeDAO();
}
public function salvar($cidade) {
try {
return $this->cidadeDAO->salvar($cidade);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($cidadeID) {
try {
if(!isset ($cidadeID) || $cidadeID <= 0)
throw new Exception("Codigo da Cidade Nao Econtrado!!!");
$this->cidadeDAO->excluir($cidadeID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$nome = "", $estadoID = 0) {
try {
return $this->cidadeDAO->listar($pagina,$nome,$estadoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($cidadeID) {
try {
if(!isset ($cidadeID) || $cidadeID <= 0)
throw new Exception("Codigo da Cidade Nao Econtrado!!!");
return $this->cidadeDAO->buscarPorID($cidadeID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorSiglaEstadoENome($siglaEstado, $nome) {
try {
if(!isset ($siglaEstado) || strlen($siglaEstado) <= 0
|| !isset ($nome) || strlen($nome) <= 0)
throw new Exception("Codigo da Cidade Nao Econtrado!!!");
return $this->cidadeDAO->buscarPorSiglaEstadoENome($siglaEstado, $nome);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($nome = "",$estadoID = 0) {
try {
return $this->cidadeDAO->total($nome,$estadoID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/CidadeService.class.php
|
PHP
|
asf20
| 2,065
|
<?php
/**
* Description of ChatService
*
* @author Magno
*/
class ChatService {
private $chatDAO;
function __construct() {
$this->chatDAO = new ChatDAO();
}
public function salvar($chat) {
try {
return $this->chatDAO->salvar($chat);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function salvarSimples($chatID, $leilaoID, $usuarioID) {
try {
return $this->chatDAO->salvarSimples($chatID, $leilaoID, $usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($chatID) {
try {
if(!isset ($chatID) || $chatID <= 0)
throw new Exception("Codigo do Chat Nao Econtrado!!!");
$this->chatDAO->excluir($chatID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0, $leilaoID = -1, $usuarioID = -1, $carregarDependencias = false) {
try {
return $this->chatDAO->listar($pagina, $leilaoID, $usuarioID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "chatID", $direcao = "DESC", $carregarDependencias = false) {
try {
return $this->chatDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($chatID, $carregarDependencias = false) {
try {
if(!isset ($chatID) || $chatID <= 0)
throw new Exception("Codigo do Chat Nao Econtrado!!!");
return $this->chatDAO->buscarPorID($chatID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($leilaoID = -1, $usuarioID = -1) {
try {
return $this->chatDAO->total($leilaoID, $usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/ChatService.class.php
|
PHP
|
asf20
| 2,306
|
<?php
/**
* Description of EnderecoService
*
* @author Magno
*/
class EnderecoService {
private $enderecoDAO;
function __construct() {
$this->enderecoDAO = new EnderecoDAO();
}
public function salvar($endereco) {
try {
return $this->enderecoDAO->salvar($endereco);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($usuarioID) {
try {
if(!isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Endereco Nao Econtrado!!!");
$this->enderecoDAO->excluir($usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function existe($usuarioID) {
try {
if(!isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Endereco Nao Econtrado!!!");
return $this->enderecoDAO->existe($usuarioID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$cep = "", $cidadeID = 0, $carregarDependencias = false) {
try {
return $this->enderecoDAO->listar($pagina, $cep, $cidadeID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($usuarioID, $carregarDependencias = false) {
try {
if(!isset ($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Endereco Nao Econtrado!!!");
return $this->enderecoDAO->buscarPorID($usuarioID, $carregarDependencias);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($cep = "", $cidadeID = 0) {
try {
return $this->enderecoDAO->total($cep, $cidadeID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/EnderecoService.class.php
|
PHP
|
asf20
| 2,080
|
<?php
/**
* Description of CronometroService
*
* @author Magno
*/
class CronometroService {
private $cronometroDAO;
public function __construct() {
$this->cronometroDAO = new CronometroDAO();
}
public function salvar($cronometro) {
try {
return $this->cronometroDAO->salvar($cronometro);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($cronometroID) {
try {
if(!isset ($cronometroID) || $cronometroID <= 0)
throw new Exception("Codigo do Cronometro Nao Econtrado!!!");
$this->cronometroDAO->excluir($cronometroID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0,$valor = "") {
try {
return $this->cronometroDAO->listar($pagina, $valor);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($cronometroID) {
try {
if(!isset ($cronometroID) || $cronometroID <= 0)
throw new Exception("Codigo do Cronometro Nao Econtrado!!!");
$this->cronometroDAO->buscarPorID($cronometroID);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($valor = "") {
try {
return $this->cronometroDAO->total($valor);
}catch(Exception $err) {
throw new Exception($err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/CronometroService.class.php
|
PHP
|
asf20
| 1,624
|
<?php
class UsuarioService {
private $usuarioDAO;
public function __construct() {
$this->usuarioDAO = new UsuarioDAO();
}
public function salvar($usuario) {
try {
$usuario->setSenha(Seguranca::criptografaSenha($usuario->getSenha()));
if($usuario->getUsuarioID() <= 0){
if($this->exitePorEmail($usuario->getEmail()))
throw new Exception("Erro, ja existe um Usuario com esse Email!!!");
if($this->exitePorLogin($usuario->getLogin()))
throw new Exception("Erro, ja existe um Usuario com esse Login!!!");
}
$usuario = $this->usuarioDAO->salvar($usuario);
if(!strpos($usuario->getMedia()->getCaminho(), Constantes::$IMG_ADM_DEFAULT)){
Util::geraThumb($usuario->getMedia()->getCaminho(), Constantes::$TAM_THUMB_IMG);
}
return $usuario;
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function excluir($usuarioID) {
try {
if (!isset($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Usuario Nao Econtrado!!!");
$this->usuarioDAO->excluir($usuarioID);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listar($pagina = 0, $email = "", $login = "", $status = -1, $carregarDependencias = false) {
try {
return $this->usuarioDAO->listar($pagina, $email, $login, $statusID, $carregarDependencias);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "usuarioID", $direcao = "DESC", $carregarDependencias = false) {
try {
return $this->usuarioDAO->listarPorOrdem($pagina, $tamanho, $ordem, $direcao, $carregarDependencias);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function buscarPorID($usuarioID, $carregarDependencias = false) {
try {
if (!isset($usuarioID) || $usuarioID <= 0)
throw new Exception("Codigo do Usuario Nao Econtrado!!!");
return $this->usuarioDAO->buscarPorID($usuarioID, $carregarDependencias);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function total($email = "", $login = "", $status = -1) {
try {
return $this->usuarioDAO->total($email, $login);
} catch (Exception $err) {
throw new Exception($err->getMessage());
}
}
public function exitePorEmail($email){
if($this->total($email) > 0) return true;
return false;
}
public function exitePorLogin($login){
if($this->total("",$login) > 0) return true;
return false;
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/UsuarioService.class.php
|
PHP
|
asf20
| 3,147
|
<?php
/**
* Description of UploadService
*
* @author Magno
*/
class UploadService {
function __construct() {
}
public static function salvarArquivoSimples($nome, $destino = ""){
//NOME TEMPORÁRIO NO SERVIDOR
$arquivo_temp = @$_FILES[$nome]["tmp_name"];
//NOME DO ARQUIVO NA MÁQUINA DO USUÁRIO
$arquivo_name = @$_FILES[$nome]["name"];
//TAMANHO DO ARQUIVO
$arquivo_size = @$_FILES[$nome]["size"];
//TIPO MIME DO ARQUIVO
$arquivo_type = @$_FILES[$nome]["type"];
$destino = Constantes::$DIR_UPLOAD.$destino;
if(strlen($arquivo_name) <= 0) //Caso nao tenha arquivo
return "";
//CRIANDO DIRETORIO
if(!file_exists($destino))
mkdir ($destino, 0755,true);
$ext = explode(".",$arquivo_name);
$nomeArquivo = md5(uniqid(time()));
if(count($ext) > 0)
$nomeArquivo = $nomeArquivo . "." . $ext[count($ext)-1];
//ENVIA O ARQUIVO PARA A PASTA
if(!copy($arquivo_temp, $destino.$nomeArquivo)){
throw new Exception ("Erro ao Salvar Arquivo no Servidor!!!");
}
return $destino.$nomeArquivo;
}
public static function salvarArquivoCompactado($nome, $destino){
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/service/UploadService.class.php
|
PHP
|
asf20
| 1,337
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/funcoes.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#btBuscar").click(function(){
carregaTabela(1);
})
});
function carregaTabela(pagina){
var descricao = $("#descricao").val().trim();
$("#tbResposta").append('<img src="include/images/ajax-loader.gif"/>');
$("#tbResposta").load("RespostaAction.tabela",
{
descricao : descricao,
pagina : pagina
}
);
}
function reload(){
carregaTabela(1);
}
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Listagem de Respostas</h1></div>
{msg obj=$msg|default:null type="small"}
<div class="columns">
<div class="colx1-left">
{include file="view/resposta/formBusca.tpl"}
<div id="tbResposta">{include file="view/resposta/tabela.tpl"}</div>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/resposta/listar.tpl
|
Smarty
|
asf20
| 1,301
|
<!-- Add the class 'table' -->
<table class="table" cellspacing="0" width="100%">
<thead>
<tr>
<th scope="col">Descrição da Pergunta</th>
<th scope="col">Descrição da Resposta</th>
<th scope="col" class="table-actions">Ações</th>
</tr>
</thead>
<tbody>
{foreach $respostas as $resposta}
<tr>
<td>{$resposta->getEnquete()->getDescricao()}</td>
<td>{$resposta->getDescricao()}</td>
<!-- The class table-actions is designed for action icons -->
<td class="table-actions">
<a href="RespostaAction.editar!respostaID-{$resposta->getRespostaID()},enqueteID-{$resposta->getEnquete()->getEnqueteID()}" title="Editar" class="with-tip"><img alt="edit" src="include/images/icons/fugue/pencil.png" width="16" height="16"/></a>
<a href="javascript:void(0);" onclick="abrirModalConfirmacao('RespostaAction.excluir!respostaID-{$resposta->getRespostaID()}');" title="Deletar" class="with-tip"><img alt="del" src="include/images/icons/fugue/cross-circle.png" width="16" height="16"/></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="view/include/paginacao.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/resposta/tabela.tpl
|
Smarty
|
asf20
| 1,299
|
<form action="" method="post" id="tab-stats" class="form">
<fieldset class="grey-bg collapsed">
<legend><a href="#"> Buscar</a></legend>
<div>
<div class="float-left gutter-right">
{form_input name="descricao" label="Descrição"}
</div>
<div class="float-left gutter-right" style="vertical-align: bottom">
<p>
<label for=""> </label>
{action_button label="Buscar" id="btBuscar" type="button" icon="fugue/magnifier.png"}
</p>
</div>
</div>
</fieldset>
</form>
<br/>
|
0a1b2c3d4e5
|
trunk/leilao/view/resposta/formBusca.tpl
|
Smarty
|
asf20
| 760
|
{msg obj=$msg2|default:null type="small"}
<!-- Add the class 'table' -->
<table class="table" cellspacing="0" width="100%">
<thead>
<tr>
<th scope="col">Descrição da Resposta</th>
<th scope="col" class="table-actions">Ações</th>
</tr>
</thead>
<tbody>
{foreach $respostas as $resposta}
<tr>
<td>{$resposta->getDescricao()}</td>
<!-- The class table-actions is designed for action icons -->
<td class="table-actions">
<a href="javascript:void(0);" onclick="excluirResposta({$resposta->getRespostaID()});" title="Deletar" class="with-tip"><img alt="del" src="include/images/icons/fugue/cross-circle.png" width="16" height="16"/></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="view/include/paginacao.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/resposta/tabelaSimples.tpl
|
Smarty
|
asf20
| 920
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/jquery.validate.min.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#frmCadResposta").validate({
rules: {
descricao: {
required: true
}
}
});
$("#btsalvarResposta").click(function(){
var enqueteID = $("#enqueteID").val();
var respostaID = $("#respostaID").val();
var descricao = $("#descricao").val().trim();
$("#tbResposta").append('<img src="include/images/ajax-loader.gif"/>');
$("#tbResposta").load("RespostaAction.salvar",
{
descricao : descricao,
enqueteID : enqueteID,
respostaID: respostaID
}
,function(){
$("#respostaID").val(0);
$("#descricao").val('');
});
})
});
function excluirResposta(respostaID){
var enqueteID = $("#enqueteID").val();
$("#tbResposta").append('<img src="include/images/ajax-loader.gif"/>');
$("#tbResposta").load("RespostaAction.excluirAjax",
{
enqueteID : enqueteID,
respostaID: respostaID
}
);
}
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Cadastro de Resposta</h1></div>
{msg obj=$msg|default:null type="small"}
{display_errors errors=$errosValidacao|default:null}
<div class="columns">
<div class="colx1-left">
<!-- Add the class 'form' -->
<form id="frmCadResposta" action="" class="form" method="post">
<input type="hidden" name="respostaID" id="respostaID" value="{$respostaID|default:0}" />
<input type="hidden" name="enqueteID" id="enqueteID" value="{$enqueteID|default:0}" />
<fieldset>
<legend>Dados da Enquete</legend>
<p>
<label class="required" for="descricao">Descrição:</label>
<input type="text" class="full-width" title="" value="{$descricao|default:''}" name="descricao" id="descricao" style="width: 80%">
<a title="Salvar Resposta" href="javascript:void(0);" id="btsalvarResposta" class="with-tip">
<img alt="add" src="include/images/icons/fugue/plus-circle.png" width="16" height="16"/>
</a>
</p>
</fieldset>
<fieldset>
<legend>Respostas Cadastradas</legend>
{if !isset($respostas)} {$respostas = array()} {/if}
<div id="tbResposta">{include file="view/resposta/tabelaSimples.tpl"}</div>
</fieldset>
<div class="btAction">
{action_button label="Limpar" type="reset" class="grey"}
{action_button label="Salvar" type="submit"}
</div>
</form>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/resposta/cadastro.tpl
|
Smarty
|
asf20
| 3,423
|
{literal}
<script type="text/javascript">
$().ready(function() {
//mascara
$("#cepEnd").mask("99999-999",{placeholder:"_"});
});
</script>
{/literal}
{form_input name="cepEnd" label="Cep" title="ex: 64000-000" required=true extra="onblur=\"getEndereco();\"" value="{$cepEnd|default:''}"}
{form_input name="numeroEnd" label="Número" title="ex: 1000" required=true extra="maxlength=\"7\"" value="{$numeroEnd|default:''}"}
{form_input name="complementoEnd" label="Complemento" title="ex: Bloco F, Ap. 125" value="{$complementoEnd|default:''}"}
{form_input name="logradouroEnd" label="Logradouro" title="ex: Rua José do Santos" required=true value="{$logradouroEnd|default:''}"}
{form_input name="bairroEnd" label="Bairro" title="ex: Monte Castelo" required=true alue="{$bairroEnd|default:''}"}
{form_input name="cidadeEnd" label="Cidade" title="ex: Teresina" required=true extra="maxlength=\"0\"" value="{$cidadeEnd|default:''}"}
{form_input name="estadoEnd" label="Estado" title="ex: PI" required=true extra="maxlength=\"0\"" value="{$estadoEnd|default:''}"}
|
0a1b2c3d4e5
|
trunk/leilao/view/endereco/formSimples.tpl
|
Smarty
|
asf20
| 1,111
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/funcoes.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#btBuscar").click(function(){
carregaTabela(1);
})
});
function carregaTabela(pagina){
var email = $("#email").val().trim();
var login = $("#login").val().trim();
var statusID = $("#statusID").val();
$("#tbAdmin").append('<img src="include/images/ajax-loader.gif"/>');
$("#tbAdmin").load("AdminAction.tabela",
{
email : email,
login : login,
statusID : statusID,
pagina : pagina
}
);
}
function reload(){
carregaTabela(1);
}
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Listagem de Administradores</h1></div>
{msg obj=$msg|default:null type="small"}
<div class="columns">
<div class="colx1-left">
{include file="view/usuario/formBusca.tpl"}
<div id="tbAdmin">{include file="view/usuario/tabela.tpl"}</div>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/pacoteLance/listar.tpl
|
Smarty
|
asf20
| 1,477
|
{form_input name="quantidade" label="Quantidade" required=true value="{$quantidade|default:''}"}
{form_input name="valor" label="Valor" required=true}
|
0a1b2c3d4e5
|
trunk/leilao/view/pacoteLance/form.tpl
|
Smarty
|
asf20
| 153
|
<!-- Add the class 'table' -->
<table class="table" cellspacing="0" width="100%">
<thead>
<tr>
<th scope="col">Email</th>
<th scope="col">Login</th>
<th scope="col">Imagem</th>
<th scope="col">Data de Criação</th>
<th scope="col">Situação</th>
<th scope="col" class="table-actions">Ações</th>
</tr>
</thead>
<tbody>
{foreach $admins as $admin}
<tr>
<td>{$admin->getEmail()}</td>
<td>{$admin->getLogin()}</td>
<td><a href="#"><small><img src="{$admin->getMedia()->getCaminhoMini()}" width="16" height="16" class="picto"></small></a></td>
<td>{$admin->getDataCriacao()}</td>
<td>{$admin->getStatus()->getDescricao()}</td>
<!-- The class table-actions is designed for action icons -->
<td class="table-actions">
<a href="AdminAction.editar!adminID-{$admin->getUsuarioID()}" title="Editar" class="with-tip"><img alt="edit" src="include/images/icons/fugue/pencil.png" width="16" height="16"/></a>
<a href="javascript:void(0);" onclick="abrirModalConfirmacao('AdminAction.excluir!adminID-{$admin->getUsuarioID()}');" title="Deletar" class="with-tip"><img alt="del" src="include/images/icons/fugue/cross-circle.png" width="16" height="16"/></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="view/include/paginacao.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/pacoteLance/tabela.tpl
|
Smarty
|
asf20
| 1,549
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/jquery.validate.min.js"></script>
<script type="text/javascript">
$().ready(function() {
var usuarioID = $("#usuarioID").val();
$("#frmCadPacoteLance").validate({
rules: {
login: {
required: true,
minlength: 5,
remote:{
url: "UsuarioAction.validaLogin",
type: "post",
data: {
usuarioID : usuarioID
}
}
},
senha: {
required: true,
minlength: 5
},
r_senha: {
required: true,
minlength: 5,
equalTo: "#senha"
},
email: {
required: true,
email: true,
remote:{
url: "UsuarioAction.validaEmail",
type: "post",
data: {
usuarioID : usuarioID
}
}
},
media: {
accept: "gif|jpg|jpeg|png"
}
}
});
});
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Cadastro de Pacotes de Lances</h1></div>
{msg obj=$msg|default:null type="small"}
{display_errors errors=$errosValidacao|default:null}
<div class="columns">
<div class="colx1-left">
<!-- Add the class 'form' -->
<form id="frmCadPacoteLance" action="PacoteLanceAction.salvar" class="form" method="post" enctype="multipart/form-data">
<input type="hidden" name="usuarioID" id="usuarioID" value="{$usuarioID|default:0}" />
<fieldset>
<legend>Dados de Acesso</legend>
{include file="view/pacoteLance/form.tpl"}
</fieldset>
<fieldset>
<legend>Imagem</legend>
{include file="view/media/formImagem.tpl"}
</fieldset>
<div class="btAction">
{action_button label="Limpar" type="reset" class="grey"}
{action_button label="Salvar" type="submit" icon="fugue/tick-circle.png"}
</div>
</form>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/pacoteLance/cadastro.tpl
|
Smarty
|
asf20
| 3,018
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>System error</title>
<meta charset="utf-8">
<meta name="robots" content="none">
{literal}
<!-- Mobile metas -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<!-- Global stylesheets -->
<link href="include/css/reset.css" rel="stylesheet" type="text/css">
<link href="include/css/common.css" rel="stylesheet" type="text/css">
<link href="include/css/form.css" rel="stylesheet" type="text/css">
<link href="include/css/standard.css" rel="stylesheet" type="text/css">
<link href="include/css/special-pages.css" rel="stylesheet" type="text/css">
<!-- Custom styles -->
<link href="include/css/simple-lists.css" rel="stylesheet" type="text/css">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="include/favicon.ico">
<link rel="icon" type="image/png" href="include/favicon-large.png">
<!-- Generic libs -->
<script type="text/javascript" src="include/js/html5.js"></script><!-- this has to be loaded before anything else -->
<script type="text/javascript" src="include/js/jquery.js"></script>
<!-- Template core functions -->
<script type="text/javascript" src="include/js/common.js"></script>
<script type="text/javascript" src="include/js/standard.js"></script>
<!--[if lte IE 8]><script type="text/javascript" src="include/js/standard.ie.js"></script><![endif]-->
<script type="text/javascript" src="include/js/jquery.tip.js"></script>
<!-- Template custom styles libs -->
<script type="text/javascript" src="include/js/list.js"></script>
<!-- Ajax error report -->
<script type="text/javascript">
$(document).ready(function()
{
$('#send-report').submit(function(event)
{
// Stop full page load
event.preventDefault();
var submitBt = $(this).find('button[type=submit]');
submitBt.disableBt();
// Target url
var target = $(this).attr('action');
if (!target || target == '')
{
// Page url without hash
target = document.location.href.match(/^([^#]+)/)[1];
}
// Request
var data = {
a: $('#a').val(),
report: $('#report').val(),
description: $('#description').val(),
sender: $('#sender').val()
};
// Send
$.ajax({
url: target,
dataType: 'json',
type: 'POST',
data: data,
success: function(data, textStatus, XMLHttpRequest)
{
if (data.valid)
{
$('#send-report').removeBlockMessages().blockMessage('Report sent, thank you for your help!', {type: 'success'});
}
else
{
// Message
$('#send-report').removeBlockMessages().blockMessage('An unexpected error occured, please try again', {type: 'error'});
submitBt.enableBt();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
// Message
$('#send-report').removeBlockMessages().blockMessage('Error while contacting server, please try again', {type: 'error'});
submitBt.enableBt();
}
});
// Message
$('#send-report').removeBlockMessages().blockMessage('Please wait, sending report...', {type: 'loading'});
});
});
</script>
{/literal}
</head>
<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page error-bg red dark">
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie or .ie7 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<section id="error-desc">
<ul class="action-tabs with-children-tip children-tip-left">
<li><a href="javascript:history.back()" title="Go back"><img src="include/images/icons/fugue/navigation-180.png" width="16" height="16"></a></li>
<li><a href="javascript:window.location.reload()" title="Reload page"><img src="include/images/icons/fugue/arrow-circle.png" width="16" height="16"></a></li>
</ul>
<ul class="action-tabs right with-children-tip children-tip-right">
<li><a href="#" title="Show/hide<br>error details" onClick="$(document.body).toggleClass('with-log'); return false;">
<img src="include/images/icons/fugue/application-monitor.png" width="16" height="16">
</a></li>
</ul>
<div class="block-border"><div class="block-content">
<h1>Admin</h1>
<div class="block-header">System error</div>
<h2>Error description</h2>
<h5>Message</h5>
<p>{$mensagem}</p>
<p><b>Event type:</b> error<br>
<b>Page:</b> {$arquivo}</p>
<form class="form" id="send-report" method="post" action="sendReport.html">
<fieldset class="grey-bg no-margin collapse">
<legend><a href="#">Report error</a></legend>
<p>
<label for="description" class="light float-left">To report this error, please explain how it happened and click below:</label>
<textarea name="description" id="description" class="full-width" rows="4"></textarea>
</p>
<p>
<label for="report-sender" class="grey">Your e-mail address (optional)</label>
<span class="float-left"><button type="submit" class="full-width">Report</button></span>
<input type="text" name="sender" id="sender" value="" class="full-width">
</p>
</fieldset>
</form>
</div></div>
</section>
<section id="error-log">
<div class="block-border"><div class="block-content">
<h1>Error in {$classe}</h1>
<div class="fieldset grey-bg with-margin">
<p><b>Message</b><br>
Undefined variable: test</p>
</div>
<ul class="picto-list">
<li class="icon-tag-small"><b>Php error level:</b> 256</li>
<li class="icon-doc-small"><b>File:</b> {$arquivo}</li>
<li class="icon-pin-small"><b>Line:</b> 51</li>
</ul>
<ul class="collapsible-list with-bg">
<li class="close">
<b class="toggle"></b>
<span><b>Context:</b></span>
<ul class="with-icon no-toggle-icon">
<li class="close">
<b class="toggle"></b>
<span><b>$options:</b> array(5)</span>
<ul>
<li><span><b>'id_user':</b> 42</span></li>
<li><span><b>'logged':</b> false</span></li>
<li class="close">
<b class="toggle"></b>
<span><b>'groups':</b> array(3)</span>
<ul>
<li><span><b>0:</b> 4</span></li>
<li><span><b>1:</b> 5</span></li>
<li><span><b>2:</b> 12</span></li>
</ul>
</li>
<li><span><b>'resetPassword':</b> false</span></li>
<li><span><b>'mail':</b> 'name@domaine.com'</span></li>
</ul>
</li>
<li><span><b>$i:</b> 12</span></li>
<li><span><b>$id_user:</b> 42</span></li>
</ul>
</li>
</ul>
<h2>Stack backtrace</h2>
<ul class="picto-list icon-top with-line-spacing">
<li>{$pilha}</li>
</ul>
</div></div>
</section>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
|
0a1b2c3d4e5
|
trunk/leilao/view/erros/error.tpl
|
Smarty
|
asf20
| 7,243
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>Constellation Admin Skin</title>
<meta charset="utf-8">
<!-- Mobile metas -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<!-- Global stylesheets -->
<link href="../css/reset.css" rel="stylesheet" type="text/css">
<link href="../css/common.css" rel="stylesheet" type="text/css">
<link href="../css/form.css" rel="stylesheet" type="text/css">
<link href="../css/standard.css" rel="stylesheet" type="text/css">
<link href="../css/special-pages.css" rel="stylesheet" type="text/css">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link rel="icon" type="image/png" href="../favicon-large.png">
<!-- Generic libs -->
<script type="text/javascript" src="../js/html5.js"></script><!-- this has to be loaded before anything else -->
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<!-- Template core functions -->
<script type="text/javascript" src="../js/jquery.tip.js"></script>
</head>
<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page code-page dark">
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie or .ie7 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<h1>401</h1>
<p>Unauthorized</p>
<section>
<ul class="action-tabs with-children-tip children-tip-left">
<li><a href="javascript:history.back()" title="Go back"><img src="../images/icons/fugue/navigation-180.png" width="16" height="16"></a></li>
</ul>
<ul class="action-tabs right with-children-tip children-tip-right">
<li><a href="../index.html" title="Go to homepage"><img src="../images/icons/fugue/home.png" width="16" height="16"></a></li>
</ul>
<div class="block-content no-title dark-bg">
Invalid or missing authentication
</div>
</section>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
|
0a1b2c3d4e5
|
trunk/leilao/view/erros/401.tpl
|
Smarty
|
asf20
| 2,173
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>Constellation Admin Skin</title>
<meta charset="utf-8">
<!-- Mobile metas -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<!-- Global stylesheets -->
<link href="../css/reset.css" rel="stylesheet" type="text/css">
<link href="../css/common.css" rel="stylesheet" type="text/css">
<link href="../css/form.css" rel="stylesheet" type="text/css">
<link href="../css/standard.css" rel="stylesheet" type="text/css">
<link href="../css/special-pages.css" rel="stylesheet" type="text/css">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link rel="icon" type="image/png" href="../favicon-large.png">
<!-- Generic libs -->
<script type="text/javascript" src="../js/html5.js"></script><!-- this has to be loaded before anything else -->
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<!-- Template core functions -->
<script type="text/javascript" src="../js/jquery.tip.js"></script>
</head>
<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page code-page dark">
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie or .ie7 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<h1>400</h1>
<p>Bad request</p>
<section>
<ul class="action-tabs with-children-tip children-tip-left">
<li><a href="javascript:history.back()" title="Go back"><img src="../images/icons/fugue/navigation-180.png" width="16" height="16"></a></li>
</ul>
<ul class="action-tabs right with-children-tip children-tip-right">
<li><a href="../index.html" title="Go to homepage"><img src="../images/icons/fugue/home.png" width="16" height="16"></a></li>
</ul>
<div class="block-content no-title dark-bg">
Invalid request or bad syntax
</div>
</section>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
|
0a1b2c3d4e5
|
trunk/leilao/view/erros/400.tpl
|
Smarty
|
asf20
| 2,168
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>System error</title>
<meta charset="utf-8">
<meta name="robots" content="none">
<!-- Mobile metas -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<!-- Global stylesheets -->
<link href="../css/reset.css" rel="stylesheet" type="text/css">
<link href="../css/common.css" rel="stylesheet" type="text/css">
<link href="../css/form.css" rel="stylesheet" type="text/css">
<link href="../css/standard.css" rel="stylesheet" type="text/css">
<link href="../css/special-pages.css" rel="stylesheet" type="text/css">
<!-- Custom styles -->
<link href="../css/simple-lists.css" rel="stylesheet" type="text/css">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link rel="icon" type="image/png" href="../favicon-large.png">
<!-- Generic libs -->
<script type="text/javascript" src="../js/html5.js"></script><!-- this has to be loaded before anything else -->
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../js/old-browsers.js"></script> <!-- remove if you do not need older browsers detection -->
<!-- Template core functions -->
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/standard.js"></script>
<!--[if lte IE 8]><script type="text/javascript" src="../js/standard.ie.js"></script><![endif]-->
<script type="text/javascript" src="../js/jquery.tip.js"></script>
<!-- Template custom styles libs -->
<script type="text/javascript" src="../js/list.js"></script>
</head>
<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page error-bg red dark">
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie or .ie7 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<section id="error-desc">
<ul class="action-tabs with-children-tip children-tip-left">
<li><a href="javascript:history.go(-2)" title="Go back"><img src="../images/icons/fugue/navigation-180.png" width="16" height="16"></a></li>
</ul>
<div class="block-border"><div class="block-content">
<h1>Admin</h1>
<div class="block-header">Error report</div>
<h2>Report sent</h2>
<h5>Message</h5>
<p>Thank you for sending the error report. If you provided your email address, we'll contact you as soon as the bug has been fixed.</p>
<p><a href="javascript:history.go(-2);" title="Return to previous page" class="button">Return to previous page</a></p>
</div></div>
</section>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
|
0a1b2c3d4e5
|
trunk/leilao/view/erros/sendReport.tpl
|
Smarty
|
asf20
| 2,908
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>Constellation Admin Skin</title>
<meta charset="utf-8">
<!-- Mobile metas -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<!-- Global stylesheets -->
<link href="../css/reset.css" rel="stylesheet" type="text/css">
<link href="../css/common.css" rel="stylesheet" type="text/css">
<link href="../css/form.css" rel="stylesheet" type="text/css">
<link href="../css/standard.css" rel="stylesheet" type="text/css">
<link href="../css/special-pages.css" rel="stylesheet" type="text/css">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link rel="icon" type="image/png" href="../favicon-large.png">
<!-- Generic libs -->
<script type="text/javascript" src="../js/html5.js"></script><!-- this has to be loaded before anything else -->
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<!-- Template core functions -->
<script type="text/javascript" src="../js/jquery.tip.js"></script>
</head>
<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page code-page dark">
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie or .ie7 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<h1>500</h1>
<p>Internal server error</p>
<section>
<ul class="action-tabs with-children-tip children-tip-left">
<li><a href="javascript:history.back()" title="Go back"><img src="../images/icons/fugue/navigation-180.png" width="16" height="16"></a></li>
</ul>
<ul class="action-tabs right with-children-tip children-tip-right">
<li><a href="../index.html" title="Go to homepage"><img src="../images/icons/fugue/home.png" width="16" height="16"></a></li>
</ul>
<div class="block-content no-title dark-bg">
Please contact your system administrator
</div>
</section>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
|
0a1b2c3d4e5
|
trunk/leilao/view/erros/500.tpl
|
Smarty
|
asf20
| 2,189
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>Constellation Admin Skin</title>
<meta charset="utf-8">
<!-- Mobile metas -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<!-- Global stylesheets -->
<link href="../css/reset.css" rel="stylesheet" type="text/css">
<link href="../css/common.css" rel="stylesheet" type="text/css">
<link href="../css/form.css" rel="stylesheet" type="text/css">
<link href="../css/standard.css" rel="stylesheet" type="text/css">
<link href="../css/special-pages.css" rel="stylesheet" type="text/css">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link rel="icon" type="image/png" href="../favicon-large.png">
<!-- Generic libs -->
<script type="text/javascript" src="../js/html5.js"></script><!-- this has to be loaded before anything else -->
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<!-- Template core functions -->
<script type="text/javascript" src="../js/jquery.tip.js"></script>
</head>
<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page code-page dark">
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie or .ie7 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<h1>403</h1>
<p>Forbidden</p>
<section>
<ul class="action-tabs with-children-tip children-tip-left">
<li><a href="javascript:history.back()" title="Go back"><img src="../images/icons/fugue/navigation-180.png" width="16" height="16"></a></li>
</ul>
<ul class="action-tabs right with-children-tip children-tip-right">
<li><a href="../index.html" title="Go to homepage"><img src="../images/icons/fugue/home.png" width="16" height="16"></a></li>
</ul>
<div class="block-content no-title dark-bg">
You can not access the requested page
</div>
</section>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
|
0a1b2c3d4e5
|
trunk/leilao/view/erros/403.tpl
|
Smarty
|
asf20
| 2,174
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>Constellation Admin Skin</title>
<meta charset="utf-8">
<!-- Mobile metas -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<!-- Global stylesheets -->
<link href="../css/reset.css" rel="stylesheet" type="text/css">
<link href="../css/common.css" rel="stylesheet" type="text/css">
<link href="../css/form.css" rel="stylesheet" type="text/css">
<link href="../css/standard.css" rel="stylesheet" type="text/css">
<link href="../css/special-pages.css" rel="stylesheet" type="text/css">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link rel="icon" type="image/png" href="../favicon-large.png">
<!-- Generic libs -->
<script type="text/javascript" src="../js/html5.js"></script><!-- this has to be loaded before anything else -->
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<!-- Template core functions -->
<script type="text/javascript" src="../js/jquery.tip.js"></script>
</head>
<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page code-page dark">
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie or .ie7 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<h1>503</h1>
<p>Service Unavailable</p>
<section>
<ul class="action-tabs with-children-tip children-tip-left">
<li><a href="javascript:history.back()" title="Go back"><img src="../images/icons/fugue/navigation-180.png" width="16" height="16"></a></li>
</ul>
<ul class="action-tabs right with-children-tip children-tip-right">
<li><a href="../index.html" title="Go to homepage"><img src="../images/icons/fugue/home.png" width="16" height="16"></a></li>
</ul>
<div class="block-content no-title dark-bg">
Probably updating, please try again later
</div>
</section>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
|
0a1b2c3d4e5
|
trunk/leilao/view/erros/503.tpl
|
Smarty
|
asf20
| 2,188
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>Constellation Admin Skin</title>
<meta charset="utf-8">
<!-- Mobile metas -->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<!-- Global stylesheets -->
<link href="../css/reset.css" rel="stylesheet" type="text/css">
<link href="../css/common.css" rel="stylesheet" type="text/css">
<link href="../css/form.css" rel="stylesheet" type="text/css">
<link href="../css/standard.css" rel="stylesheet" type="text/css">
<link href="../css/special-pages.css" rel="stylesheet" type="text/css">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link rel="icon" type="image/png" href="../favicon-large.png">
<!-- Generic libs -->
<script type="text/javascript" src="../js/html5.js"></script><!-- this has to be loaded before anything else -->
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<!-- Template core functions -->
<script type="text/javascript" src="../js/jquery.tip.js"></script>
</head>
<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page code-page dark">
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie or .ie7 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->
<h1>404</h1>
<p>Page not found</p>
<section>
<ul class="action-tabs on-form with-children-tip children-tip-left">
<li><a href="javascript:history.back()" title="Go back"><img src="../images/icons/fugue/navigation-180.png" width="16" height="16"></a></li>
</ul>
<ul class="action-tabs right on-form with-children-tip children-tip-right">
<li><a href="../index.html" title="Go to homepage"><img src="../images/icons/fugue/home.png" width="16" height="16"></a></li>
</ul>
<form class="block-content no-title dark-bg form" method="post" action="">
<input type="text" name="s" id="s" value="">
<button type="submit">Search</button>
</form>
</section>
<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
</body>
</html>
|
0a1b2c3d4e5
|
trunk/leilao/view/erros/404.tpl
|
Smarty
|
asf20
| 2,283
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/funcoes.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#btBuscar").click(function(){
carregaTabela(1);
})
});
function carregaTabela(pagina){
var email = $("#email").val().trim();
var login = $("#login").val().trim();
var statusID = $("#statusID").val();
$("#tbAdmin").append('<img src="include/images/ajax-loader.gif"/>');
$("#tbAdmin").load("AdminAction.tabela",
{
email : email,
login : login,
statusID : statusID,
pagina : pagina
}
);
}
function reload(){
carregaTabela(1);
}
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Listagem de Administradores</h1></div>
{msg obj=$msg|default:null type="small"}
<div class="columns">
<div class="colx1-left">
{include file="view/usuario/formBusca.tpl"}
<div id="tbAdmin">{include file="view/usuario/tabela.tpl"}</div>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/admin/listar.tpl
|
Smarty
|
asf20
| 1,477
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/jquery.validate.min.js"></script>
<script type="text/javascript">
$().ready(function() {
var usuarioID = $("#usuarioID").val();
$("#frmCadAdmin").validate({
rules: {
login: {
required: true,
minlength: 5,
remote:{
url: "UsuarioAction.validaLogin",
type: "post",
data: {
usuarioID : usuarioID
}
}
},
senha: {
required: true,
minlength: 5
},
r_senha: {
required: true,
minlength: 5,
equalTo: "#senha"
},
email: {
required: true,
email: true,
remote:{
url: "UsuarioAction.validaEmail",
type: "post",
data: {
usuarioID : usuarioID
}
}
},
media: {
accept: "gif|jpg|jpeg|png"
}
}
});
});
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Cadastro de Administradores</h1></div>
{msg obj=$msg|default:null type="small"}
{display_errors errors=$errosValidacao|default:null}
<div class="columns">
<div class="colx1-left">
<!-- Add the class 'form' -->
<form id="frmCadAdmin" action="AdminAction.salvar" class="form" method="post" enctype="multipart/form-data">
<input type="hidden" name="usuarioID" id="usuarioID" value="{$usuarioID|default:0}" />
<fieldset>
<legend>Dados de Acesso</legend>
{include file="view/usuario/formSimples.tpl"}
</fieldset>
<fieldset>
<legend>Imagem</legend>
{include file="view/media/formImagem.tpl"}
</fieldset>
<div class="btAction">
{action_button label="Limpar" type="reset" class="grey"}
{action_button label="Salvar" type="submit" icon="fugue/tick-circle.png"}
</div>
</form>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/admin/cadastro.tpl
|
Smarty
|
asf20
| 2,999
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{literal}
<script type="text/javascript">
$().ready(function() {
$("#estadoID").change(function(){
estadoID = $("#estadoID").val();
if(estadoID > 0){
$("#cbCidade").append('<img src="include/images/ajax-loader.gif"/>');
$("#cbCidade").load("CidadeAction.listarComboAjax",{estadoID:estadoID});
}
else
$("#cidadeID").empty();
})
})
</script>
{/literal}
{html_options name=estadoID id=estadoID options=$estados|default:array() selected=$estadoID|default:'' disabled="true"}
|
0a1b2c3d4e5
|
trunk/leilao/view/estado/combo.tpl
|
Smarty
|
asf20
| 764
|
{form_input name="media" label="Imagem" title="Imagem" type="file"}
<label for="media" class="error" style="display: none;">* Forneça um arquivo com a extensão válida</label>
|
0a1b2c3d4e5
|
trunk/leilao/view/media/formImagem.tpl
|
Smarty
|
asf20
| 178
|
{form_input name="media" label="Media" title="Imagem ou Vídeo" type="file"}
|
0a1b2c3d4e5
|
trunk/leilao/view/media/formSimples.tpl
|
Smarty
|
asf20
| 76
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
<table class="table" cellspacing="0" width="100%">
<thead>
<tr>
<!-- This is a special cell for loading statuses - see below for more -->
<th class="black-cell"><span class="loading"></span></th>
<th scope="col">
<!-- Table sorting arrows -->
<span class="column-sort">
<a href="#" title="Sort up" class="sort-up active"></a>
<a href="#" title="Sort down" class="sort-down"></a>
</span>
ID
</th>
<th scope="col">Descrição</th>
<th scope="col">Tipo</th>
<th scope="col">
Valor
</th>
<th scope="col" class="table-actions">Actions</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6"><img src="include/images/icons/fugue/arrow-curve-000-left.png" width="16" height="16" class="picto"> <b>Total:</b> 6 records found</td>
</tr>
</tfoot>
<tbody>
{foreach from=$rsBonus key=bonus item=i}
<tr>
<th scope="row" class="table-check-cell"><input type="checkbox" name="selected[]" id="table-selected-1" value="1"></th>
<td>{$bonus.bonusID}</td>
<td>{$bonus.descricao}</td>
<td><a href="#"><small><img src="include/images/icons/fugue/image.png" width="16" height="16" class="picto"> jpg | 12 Ko</small></a></td>
<td>02-05-2010</td>
<!-- The class table-actions is designed for action icons -->
<td class="table-actions">
<a href="#" title="Edit" class="with-tip"><img src="include/images/icons/fugue/pencil.png" width="16" height="16"></a>
<a href="#" title="Delete" class="with-tip"><img src="include/images/icons/fugue/cross-circle.png" width="16" height="16"></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/bonus/listar.tpl
|
Smarty
|
asf20
| 2,178
|
<!-- Add the class 'table' -->
<table class="table" cellspacing="0" width="100%">
<thead>
<tr>
<th scope="col">Email</th>
<th scope="col">Login</th>
<th scope="col">Imagem</th>
<th scope="col">Data de Criação</th>
<th scope="col">Situação</th>
<th scope="col" class="table-actions">Ações</th>
</tr>
</thead>
<tbody>
{foreach $admins as $admin}
<tr>
<td>{$admin->getEmail()}</td>
<td>{$admin->getLogin()}</td>
<td><a href="#"><small><img src="{$admin->getMedia()->getCaminhoMini()}" width="16" height="16" class="picto"></small></a></td>
<td>{$admin->getDataCriacao()}</td>
<td>{$admin->getStatus()->getDescricao()}</td>
<!-- The class table-actions is designed for action icons -->
<td class="table-actions">
<a href="AdminAction.editar!adminID-{$admin->getUsuarioID()}" title="Editar" class="with-tip"><img alt="edit" src="include/images/icons/fugue/pencil.png" width="16" height="16"/></a>
<a href="javascript:void(0);" onclick="openModal();" title="Deletar" class="with-tip"><img alt="del" src="include/images/icons/fugue/cross-circle.png" width="16" height="16"/></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="view/include/paginacao.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/bonus/tabela.tpl
|
Smarty
|
asf20
| 1,483
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/jquery.validate.min.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#frmCadBonus").validate({
rules: {
descricao: {
required: true
},
valor: {
required: true
}
}
});
});
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Cadastro de Bônus</h1></div>
{display_errors errors=$errosValidacao|default:null}
<div class="columns">
<div class="colx1-left">
<!-- Add the class 'form' -->
<form id="frmCadBonus" action="BonusAction.salvar" class="form" method="post">
<input type="hidden" name="bonusID" id="bonusID" value="{$bonusID|default:0}" />
<fieldset>
<legend>Dados do Bônus</legend>
{form_input name="descricao" label="Descrição" required=true value="{$descricao|default:''}"}
{form_input name="valor" label="Valor R$" required=true value="{$valor|default:'0,00'}"}
</fieldset>
<div class="btAction">
{action_button label="Limpar" type="reset" class="grey"}
{action_button label="Salvar" type="submit"}
</div>
</form>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/bonus/cadastro.tpl
|
Smarty
|
asf20
| 1,816
|
{literal}
<script type="text/javascript">
$().ready(function() {
//mascara
$("#cpf").mask("999.999.999-99",{placeholder:"_"});
$("#dataNascimento").mask("99/99/9999",{placeholder:"_"});
$("#telefone").mask("(99)9999-9999",{placeholder:"_"});
});
</script>
{/literal}
{form_input name="nome" label="Nome" title="ex: João da Silca" required=true value="{$nome|default:''}"}
{form_input name="cpf" label="Cpf" title="ex: 000.000.000-00" required=true value="{$cpf|default:''}"}
{form_input name="dataNascimento" label="Data de Nascimento" title="ex: 10/10/2000" required=true value="{$dataNascimento|default:''}"}
{form_input name="telefone" label="Telefone" title="ex: (00) 0000-0000" value="{$telefone|default:''}"}
<p>
<label class="required">Sexo</label>
<input type="radio" value="1" {if isset($sexo) && $sexo eq 1} checked="true" {/if} id="sexoMasculino" name="sexo"/> <label for="sexoMasculino">Masculino</label>
<input type="radio" value="2" id="sexoFeminino" name="sexo"/> <label for="sexoFeminino">Femenino</label>
<label for="sexo" class="error" style="display: none;">Esse campo é obrigatório.</label>
</p>
<p>
<label for="estadosCivis" class="required">Estado Civil:</label>
<div id="estadosCivis">{html_options name=estadoCivil id=estadoCivil options=$estadosCivil|default:array() selected=$estadoCivil|default:''}</div>
</p>
|
0a1b2c3d4e5
|
trunk/leilao/view/pessoa/formSimples.tpl
|
Smarty
|
asf20
| 1,456
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/funcoes.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#btBuscar").click(function(){
carregaTabela(1);
})
});
function carregaTabela(pagina){
var email = $("#email").val().trim();
var statusID = $("#statusID").val();
$("#tbConvite").append('<img src="include/images/ajax-loader.gif"/>');
$("#tbConvite").load("ConviteAction.tabela",
{
email : email,
statusID : statusID,
pagina : pagina
}
);
}
function reload(){
carregaTabela(1);
}
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Listagem de Convites</h1></div>
{msg obj=$msg|default:null type="small"}
<div class="columns">
<div class="colx1-left">
{include file="view/convite/formBusca.tpl"}
<div id="tbConvite">{include file="view/convite/tabela.tpl"}</div>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/convite/listar.tpl
|
Smarty
|
asf20
| 1,435
|
<!-- Add the class 'table' -->
<table class="table" cellspacing="0" width="100%">
<thead>
<tr>
<th scope="col">Cliente Origem</th>
<th scope="col">Email Destino</th>
<th scope="col">Mensagem</th>
<th scope="col">Cliente Destino</th>
<th scope="col">Situação</th>
<th scope="col" class="table-actions">Ações</th>
</tr>
</thead>
<tbody>
{foreach $convites as $convite}
<tr>
<td>{$convite->getCliente()->getPessoa()->getNome()}</td>
<td>{$convite->getEmail()}</td>
<td>{$convite->getMensagem()}</td>
{if $convite->getConvidado() != null}
<td>{$convite->getConvidado()->getPessoa()->getNome()}</td>
{else}
<td> </td>
{/if}
<td>{$convite->getStatus()->getDescricao()}</td>
<!-- The class table-actions is designed for action icons -->
<td class="table-actions">
<a href="javascript:void(0);" onclick="abrirModalConfirmacao('ConviteAction.excluir!conviteID-{$convite->getConviteID()}');" title="Deletar" class="with-tip"><img alt="del" src="include/images/icons/fugue/cross-circle.png" width="16" height="16"/></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="view/include/paginacao.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/convite/tabela.tpl
|
Smarty
|
asf20
| 1,558
|
<form action="" method="post" id="tab-stats" class="form">
<fieldset class="grey-bg collapsed">
<legend><a href="#"> Buscar</a></legend>
<div>
<div class="float-left gutter-right">
{form_input name="email" label="Email"}
</div>
<div class="float-left gutter-right">
<label for="statusID">Situação:</label>
{html_options name=statusID id=statusID options=$status}
</div>
<div class="float-left gutter-right" style="vertical-align: bottom">
<p>
<label for=""> </label>
{action_button label="Buscar" id="btBuscar" type="button" icon="fugue/magnifier.png"}
</p>
</div>
</div>
</fieldset>
</form>
<br/>
|
0a1b2c3d4e5
|
trunk/leilao/view/convite/formBusca.tpl
|
Smarty
|
asf20
| 1,006
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="include/js/funcoes.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#frmCadConvite").validate({
rules: {
emails: {
required: true
},
mensagem: {
required: true
}
}
});
limitarCampo('mensagem', 200, 'countMensagem');
});
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Enviar Convites para Amigos</h1></div>
{msg obj=$msg|default:null type="small" autoClose=false}
{display_errors errors=$errosValidacao|default:null}
<div class="columns">
<div class="colx1-left">
<!-- Add the class 'form' -->
<form id="frmCadConvite" action="ConviteAction.salvar" class="form" method="post">
<fieldset>
<legend>Email dos seus Amigos</legend>
{msg conteudo="Preencha cada email em uma linha" type="small" autoClose=false}
<p>
<textarea cols="" rows="5" name="emails" id="emails" class="full-width">{$emails|default:''}</textarea>
</p>
</fieldset>
<fieldset>
<legend>Mensagem</legend>
<p>
<textarea cols="" rows="5" name="mensagem" id="mensagem" class="full-width">{$mensagem|default:''}</textarea>
</p>
<p style="text-align: right"><label id="countMensagem" class="inline">200</label> Caractere(s) Disponiveis</p>
</fieldset>
<div class="btAction">
{action_button label="Limpar" type="reset" class="grey"}
{action_button label="Salvar" type="submit"}
</div>
</form>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/convite/cadastro.tpl
|
Smarty
|
asf20
| 2,449
|
{html_options name=cidadeID id=cidadeID options=$cidades|default:array() selected=$cidadeID|default:'' disabled="true"}
|
0a1b2c3d4e5
|
trunk/leilao/view/cidade/combo.tpl
|
Smarty
|
asf20
| 119
|
{if isset($numPaginas) && $numPaginas > 1}
<ul class="controls-buttons" style="text-align: center">
{$anterior = $pagina-1}
{if $anterior <= 0}
{$anterior = 1}
{/if}
<li>
<a class="with-tip" title="Anterior" href="javascript:void(0);" onclick="carregaTabela({$anterior})">
<img alt="" width="16" height="16" src="include/images/icons/fugue/navigation-180.png">
</a>
</li>
{for $pg=1 to $numPaginas}
{$click = "carregaTabela({$pg});"}
{$style = ""}
{if $pg eq $pagina}
{$click=""}
{$style = "current"}
{/if}
<li><a class="with-tip {$style}" title="Página {$pg}" href="javascript:void(0);" onclick="{$click}">{$pg}</a></li>
{/for}
{$proxima = $pagina+1}
{if $proxima >= $numPaginas}
{$proxima = $numPaginas}
{/if}
<li>
<a class="with-tip" title="Próxima" href="javascript:void(0);" onclick="carregaTabela({$proxima})">
<img alt="" width="16" height="16" src="include/images/icons/fugue/navigation.png">
</a>
</li>
<li class="sep"></li>
<li>
<a class="with-tip" title="Recarregar" href="javascript:void(0);" onclick="reload()">
<img alt="" width="16" height="16" src="include/images/icons/fugue/arrow-circle.png">
</a>
</li>
</ul>
{/if}
|
0a1b2c3d4e5
|
trunk/leilao/view/include/paginacao.tpl
|
Smarty
|
asf20
| 1,653
|
{form_input name="email" label="Email" required=true title="ex: mail@mail.com" value="{$email|default:''}"}
{form_input name="login" label="Login" required=true value="{$login|default:''}"}
{form_input name="senha" label="Senha" required=true type="password"}
{form_input name="r_senha" label="Confirmação de Senha" required=true type="password"}
|
0a1b2c3d4e5
|
trunk/leilao/view/usuario/formSimples.tpl
|
Smarty
|
asf20
| 352
|
<!-- Add the class 'table' -->
<table class="table" cellspacing="0" width="100%">
<thead>
<tr>
<th scope="col">Email</th>
<th scope="col">Login</th>
<th scope="col">Imagem</th>
<th scope="col">Data de Criação</th>
<th scope="col">Situação</th>
<th scope="col" class="table-actions">Ações</th>
</tr>
</thead>
<tbody>
{foreach $admins as $admin}
<tr>
<td>{$admin->getEmail()}</td>
<td>{$admin->getLogin()}</td>
<td><a href="#"><small><img src="{$admin->getMedia()->getCaminhoMini()}" width="16" height="16" class="picto"></small></a></td>
<td>{$admin->getDataCriacao()}</td>
<td>{$admin->getStatus()->getDescricao()}</td>
<!-- The class table-actions is designed for action icons -->
<td class="table-actions">
<a href="AdminAction.editar!adminID-{$admin->getUsuarioID()}" title="Editar" class="with-tip"><img alt="edit" src="include/images/icons/fugue/pencil.png" width="16" height="16"/></a>
<a href="javascript:void(0);" onclick="abrirModalConfirmacao('AdminAction.excluir!adminID-{$admin->getUsuarioID()}');" title="Deletar" class="with-tip"><img alt="del" src="include/images/icons/fugue/cross-circle.png" width="16" height="16"/></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="view/include/paginacao.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/usuario/tabela.tpl
|
Smarty
|
asf20
| 1,549
|
<form action="" method="post" id="tab-stats" class="form">
<fieldset class="grey-bg collapsed">
<legend><a href="#"> Buscar</a></legend>
<div>
<div class="float-left gutter-right">
{form_input name="email" label="Email"}
</div>
<div class="float-left gutter-right">
{form_input name="login" label="Login"}
</div>
<div class="float-left gutter-right">
<label for="statusID">Situação:</label>
{html_options name=statusID id=statusID options=$status}
</div>
<div class="float-left gutter-right" style="vertical-align: bottom">
<p>
<label for=""> </label>
{action_button label="Buscar" id="btBuscar" type="button" icon="fugue/magnifier.png"}
</p>
</div>
</div>
</fieldset>
</form>
<br/>
|
0a1b2c3d4e5
|
trunk/leilao/view/usuario/formBusca.tpl
|
Smarty
|
asf20
| 1,138
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/funcoes.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#btBuscar").click(function(){
carregaTabela(1);
})
});
function carregaTabela(pagina){
var email = $("#email").val().trim();
var login = $("#login").val().trim();
var statusID = $("#statusID").val();
$("#tbCliente").append('<img src="include/images/ajax-loader.gif"/>');
$("#tbCliente").load("ClienteAction.tabela",
{
email : email,
login : login,
statusID : statusID,
pagina : pagina
}
);
}
function reload(){
carregaTabela(1);
}
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Listagem de Clientes</h1></div>
{msg obj=$msg|default:null type="small"}
<div class="columns">
<div class="colx1-left">
{include file="view/usuario/formBusca.tpl"}
<div id="tbCliente">{include file="view/cliente/tabela.tpl"}</div>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/cliente/listar.tpl
|
Smarty
|
asf20
| 1,490
|
<!-- Add the class 'table' -->
<table class="table" cellspacing="0" width="100%">
<thead>
<tr>
<th scope="col">Nome</th>
<th scope="col">Email</th>
<th scope="col">Login</th>
<th scope="col">Número de Lances</th>
<th scope="col">Data de Criação</th>
<th scope="col">Cidade (UF)</th>
<th scope="col">Situação</th>
<th scope="col" class="table-actions">Ações</th>
</tr>
</thead>
<tbody>
{foreach $clientes as $cliente}
<tr>
<td>{$cliente->getPessoa()->getNome()}</td>
<td>{$cliente->getEmail()}</td>
<td>{$cliente->getLogin()}</td>
<td>{$cliente->getNumLances()} lance(s)</td>
<td>{$cliente->getDataCriacao()}</td>
<td>{$cliente->getPessoa()->getEndereco()->getCidade()->getNome()} ({$cliente->getPessoa()->getEndereco()->getCidade()->getEstado()->getSigla()})</td>
<td>{$cliente->getStatus()->getDescricao()}</td>
<!-- The class table-actions is designed for action icons -->
<td class="table-actions">
<a href="ClienteAction.editar!clienteID-{$cliente->getUsuarioID()}" title="Editar" class="with-tip"><img alt="edit" src="include/images/icons/fugue/pencil.png" width="16" height="16"/></a>
<a href="javascript:void(0);" onclick="abrirModalConfirmacao('ClienteAction.excluir!clienteID-{$cliente->getUsuarioID()}');" title="Deletar" class="with-tip"><img alt="del" src="include/images/icons/fugue/cross-circle.png" width="16" height="16"/></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="view/include/paginacao.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/cliente/tabela.tpl
|
Smarty
|
asf20
| 1,832
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="include/js/funcoes.js"></script>
<script type="text/javascript" src="include/js/jquery.maskedinput.js" language="javascript"></script>
<script type="text/javascript">
$().ready(function() {
var usuarioID = $("#usuarioID").val();
$("#frmCadCliente").validate({
rules: {
login: {
required: true,
minlength: 5,
remote:{
url: "UsuarioAction.validaLogin",
type: "post",
data: {
usuarioID : usuarioID
}
}
},
senha: {
required: true,
minlength: 5
},
r_senha: {
required: true,
minlength: 5,
equalTo: "#senha"
},
email: {
required: true,
email: true,
remote:{
url: "UsuarioAction.validaEmail",
type: "post",
data: {
usuarioID : usuarioID
}
}
},
media: {
accept: "gif|jpg|jpeg|png"
},
cepEnd: {
required: true
},
logradouroEnd: {
required: true
},
numeroEnd: {
required: true
},
bairroEnd: {
required: true
},
estadoEnd: {
required: true
},
cidadeEnd: {
required: true
},
nome: {
required: true
},
cpf: {
required: true
},
dataNascimento: {
required: true
},
estadoCivil: {
required: true
},
telefone: {
required: true
},
sexo: {
required: true
}
}
});
});
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Cadastro de Clientes</h1></div>
{msg obj=$msg|default:null type="small"}
{display_errors errors=$errosValidacao|default:null}
<div class="columns">
<div class="colx1-left">
<!-- Add the class 'form' -->
<form id="frmCadCliente" action="ClienteAction.salvar" class="form" method="post" enctype="multipart/form-data">
<input type="hidden" name="usuarioID" id="usuarioID" value="{$usuarioID|default:0}" />
<fieldset>
<legend>Dados de Acesso</legend>
{include file="view/usuario/formSimples.tpl"}
<p>
<input type="checkbox" name="avisosPorEmail" id="avisosPorEmail" value="1" {if isset($avisosPorEmail) && $avisosPorEmail eq 1} checked="true" {/if}/>
<label for="avisosPorEmail" class="inline">Notificações Por Email</label>
</p>
</fieldset>
<fieldset>
<legend>Imagem</legend>
{include file="view/media/formImagem.tpl"}
</fieldset>
<fieldset>
<legend>Dados Pessoais</legend>
{include file="view/pessoa/formSimples.tpl"}
</fieldset>
<fieldset>
<legend>Endereço</legend>
{include file="view/endereco/formSimples.tpl"}
</fieldset>
<div class="btAction">
{action_button label="Limpar" type="reset" class="grey"}
{action_button label="Salvar" type="submit"}
</div>
</form>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/cliente/cadastro.tpl
|
Smarty
|
asf20
| 5,629
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/funcoes.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#btBuscar").click(function(){
carregaTabela(1);
})
});
function carregaTabela(pagina){
var inicio = $("#inicio").val().trim();
var descricao = $("#descricao").val().trim();
var statusID = $("#statusID").val();
$("#tbEnquete").append('<img src="include/images/ajax-loader.gif"/>');
$("#tbEnquete").load("EnqueteAction.tabela",
{
inicio : inicio,
descricao : descricao,
statusID : statusID,
pagina : pagina
}
);
}
function reload(){
carregaTabela(1);
}
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Listagem de Enquetes</h1></div>
{msg obj=$msg|default:null type="small"}
<div class="columns">
<div class="colx1-left">
{include file="view/enquete/formBusca.tpl"}
<div id="tbEnquete">{include file="view/enquete/tabela.tpl"}</div>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/enquete/listar.tpl
|
Smarty
|
asf20
| 1,465
|
<!-- Add the class 'table' -->
<table class="table" cellspacing="0" width="100%">
<thead>
<tr>
<th scope="col">Descrição</th>
<th scope="col">Data de Inicio</th>
<th scope="col">Data Final</th>
<th scope="col">Situação</th>
<th scope="col" class="table-actions">Ações</th>
</tr>
</thead>
<tbody>
{foreach $enquetes as $enquete}
<tr>
<td>{$enquete->getDescricao()}</td>
<td>{$enquete->getInicio()}</td>
<td>{$enquete->getFim()}</td>
<td>{$enquete->getStatus()->getDescricao()}</td>
<!-- The class table-actions is designed for action icons -->
<td class="table-actions">
<a href="EnqueteAction.editar!enqueteID-{$enquete->getEnqueteID()}" title="Editar" class="with-tip"><img alt="edit" src="include/images/icons/fugue/pencil.png" width="16" height="16"/></a>
<a href="RespostaAction.cadastro!enqueteID-{$enquete->getEnqueteID()}" title="Cadastrar Resposta" class="with-tip"><img alt="add" src="include/images/icons/fugue/plus-circle.png" width="16" height="16"/></a>
<a href="RespostaAction.listar!enqueteID-{$enquete->getEnqueteID()}" title="Listar Respostas" class="with-tip"><img alt="list" src="include/images/icons/fugue/document-text.png" width="16" height="16"/></a>
<a href="javascript:void(0);" onclick="abrirModalConfirmacao('EnqueteAction.excluir!enqueteID-{$enquete->getEnqueteID()}');" title="Deletar" class="with-tip"><img alt="del" src="include/images/icons/fugue/cross-circle.png" width="16" height="16"/></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="view/include/paginacao.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/enquete/tabela.tpl
|
Smarty
|
asf20
| 1,829
|
<form action="" method="post" id="tab-stats" class="form">
<fieldset class="grey-bg collapsed">
<legend><a href="#"> Buscar</a></legend>
<div>
<div class="float-left gutter-right">
{form_input name="inicio" label="Inicio"}
</div>
<div class="float-left gutter-right">
{form_input name="descricao" label="Descrição"}
</div>
<div class="float-left gutter-right">
<label for="statusID">Situação:</label>
{html_options name=statusID id=statusID options=$status}
</div>
<div class="float-left gutter-right" style="vertical-align: bottom">
<p>
<label for=""> </label>
{action_button label="Buscar" id="btBuscar" type="button" icon="fugue/magnifier.png"}
</p>
</div>
</div>
</fieldset>
</form>
<br/>
|
0a1b2c3d4e5
|
trunk/leilao/view/enquete/formBusca.tpl
|
Smarty
|
asf20
| 1,150
|
{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}
{literal}
<script type="text/javascript" src="include/js/jquery.validate.min.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#frmCadEnquete").validate({
rules: {
descricao: {
required: true
},
fim: {
required: true
}
}
});
});
</script>
{/literal}
<div id="content" class="block-border">
<div class="block-content">
<div class="h1 with-menu"><h1>Cadastro de Enquete</h1></div>
{display_errors errors=$errosValidacao|default:null}
<div class="columns">
<div class="colx1-left">
<!-- Add the class 'form' -->
<form id="frmCadEnquete" action="EnqueteAction.salvar" class="form" method="post">
<input type="hidden" name="enqueteID" id="enqueteID" value="{$enqueteID|default:0}" />
<fieldset>
<legend>Dados da Enquete</legend>
{form_input name="descricao" label="Descrição" required=true value="{$descricao|default:''}"}
{form_input name="fim" label="Duração (Dias)" required=true value="{$valor|default:''}"}
</fieldset>
<div class="btAction">
{action_button label="Limpar" type="reset" class="grey"}
{action_button label="Salvar" type="submit"}
</div>
</form>
</div>
</div>
</div>
</div>
{include file="layout/footer.tpl"}
|
0a1b2c3d4e5
|
trunk/leilao/view/enquete/cadastro.tpl
|
Smarty
|
asf20
| 1,726
|
<?php
#if (!function_exists('__autoload')) {
function loadClass($class) {
if (strpos($class,'DAO')) {
require_once("dao/".$class.".class.php");
}else if (strpos($class,'Service')) {
require_once("service/".$class.".class.php");
}else if (strpos($class,'Bean')) {
require_once("model/".$class.".class.php");
}else if (strpos($class,'ction')) {
require_once("action/".$class.".class.php");
}else if (strpos($class,'Meta')) {
require_once("meta/".$class.".class.php");
}else if (strpos($class,'REL')) {
require_once("relatorio/".$class.".class.php");
}else if (strpos($class,'Validator')) {
require_once("include/php/validator/".$class.".class.php");
}
}
#}
spl_autoload_register('loadClass');
?>
|
0a1b2c3d4e5
|
trunk/leilao/autoload.php
|
PHP
|
asf20
| 892
|
<?php
/**
* Description of LeilaoDAO
*
* @author Magno
*/
class LeilaoDAO {
private $conexao;
private $cronometroDAO;
private $mediaDAO;
private $tipoLeilaoDAO;
private $statusDAO;
private $adminDAO;
private $produtoDAO;
private $lancesDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->cronometroDAO = new CronometroDAO();
$this->mediaDAO = new MediaDAO();
$this->tipoLeilaoDAO = new TipoLeilaoDAO();
$this->adminDAO = new AdminDAO();
$this->statusDAO = new StatusDAO();
$this->produtoDAO = new ProdutoDAO();
$this->lancesDAO = new LanceDAO();
}
public function salvar($leilao) {
try {
if ($leilao->getLeilaoID() != null && $leilao->getLeilaoID() > 0) {
$statment = $this->conexao->prepare("UPDATE leilao SET
inicio = :inicio,
mediaID = :mediaID,
usuarioID = :usuarioID,
tipoLeilaoID = :tipoLeilaoID,
cronometroID = :cronometroID,
statusID = :statusID
WHERE leilaoID = :leilaoID");
} else {
$statment = $this->conexao->prepare("INSERT INTO leilao(leilaoID,inicio,mediaID,usuarioID,tipoLeilaoID,cronometroID,statusID)
VALUES (:leilaoID,:inicio,:mediaID,:usuarioID,:tipoLeilaoID,:cronometroID,:statusID);");
}
if ($statment->execute($leilao->toBD())) {
if ($leilao->getLeilaoID() == null || $leilao->getLeilaoID() <= 0)
$leilao->setLeilaoID($this->conexao->lastInsertId());
return $leilao;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro LeilaoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro LeilaoDAO:" . $err->getMessage());
}
}
public function excluir($leilaoID) {
try {
$statment = $this->conexao->prepare("DELETE FROM leilao WHERE leilaoID = :leilaoID");
$statment->bindParam(':leilaoID', $leilaoID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro LeilaoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro LeilaoDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $inicio = "", $tipoLeilaoID = -1, $cronometroID = -1, $statusID = -1, $usuarioID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($inicio, $tipoLeilaoID, $cronometroID, $statusID, $usuarioID);
$leilaos = array();
$statment = $this->conexao->query("SELECT * FROM leilao u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$leilao = new LeilaoBean($row['leilaoID'], $row['inicio']);
$leilao->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$leilao->setCronometro($this->cronometroDAO->buscarPorID($row['cronometroID']));
$leilao->setTipoLeilao($this->tipoLeilaoDAO->buscarPorID($row['tipoLeilaoID']));
$leilao->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
$leilao->setAdmin($this->adminDAO->buscarPorID($row['adminDAO']));
$leilao->setProdutos($this->produtoDAO->listar(0, "", 0, $row['leilaoID'], 0, false));
$leilao->setLances($this->lancesDAO->listar(0, $row['leilaoID'], 0, false));
}
$leilaos[] = $leilao;
}
return $leilaos;
} catch (PDOException $err) {
throw new Exception("Erro LeilaoDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "leilaoID", $direcao = "ASC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$leilaos = array();
$statment = $this->conexao->query("SELECT * FROM leilao u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$leilao = new LeilaoBean($row['leilaoID'], $row['inicio']);
$leilao->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$leilao->setCronometro($this->cronometroDAO->buscarPorID($row['cronometroID']));
$leilao->setTipoLeilao($this->tipoLeilaoDAO->buscarPorID($row['tipoLeilaoID']));
$leilao->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
$leilao->setAdmin($this->adminDAO->buscarPorID($row['adminDAO']));
$leilao->setProdutos($this->produtoDAO->listar(0, "", 0, $row['leilaoID'], 0, false));
$leilao->setLances($this->lancesDAO->listar(0, $row['leilaoID'], 0, false));
}
$leilaos[] = $leilao;
}
return $leilaos;
} catch (PDOException $err) {
throw new Exception("Erro LeilaoDAO:" . $err->getMessage());
}
}
public function buscarPorID($leilaoID, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM leilao WHERE leilaoID = $leilaoID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['leilaoID']) && $row['leilaoID'] > 0) {
$leilao = new LeilaoBean($row['leilaoID'], $row['inicio']);
$leilao->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$leilao->setCronometro($this->cronometroDAO->buscarPorID($row['cronometroID']));
$leilao->setTipoLeilao($this->tipoLeilaoDAO->buscarPorID($row['tipoLeilaoID']));
$leilao->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
$leilao->setAdmin($this->adminDAO->buscarPorID($row['adminDAO']));
$leilao->setProdutos($this->produtoDAO->listar(0, "", 0, $row['leilaoID'], 0, false));
$leilao->setLances($this->lancesDAO->listar(0, $row['leilaoID'], 0, false));
}
return $leilao;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro LeilaoDAO:" . $err->getMessage());
}
}
protected function getWhere($inicio = "", $tipoLeilaoID = -1, $cronometroID = -1, $statusID = -1, $usuarioID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($inicio) && strlen($inicio) > 0) {
$where = $where . " AND u.inicio = '$inicio' ";
}
if (isset($tipoLeilaoID) && $tipoLeilaoID > 0) {
$where = $where . " AND u.tipoLeilaoID = $tipoLeilaoID ";
}
if (isset($cronometroID) && $cronometroID > 0) {
$where = $where . " AND u.cronometroID = $cronometroID ";
}
if (isset($statusID) && $statusID > 0) {
$where = $where . " AND u.statusID = $statusID ";
}
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.tipoLeilaoID = $tipoLeilaoID ";
}
return $where;
}
public function total($inicio = "", $tipoLeilaoID = -1, $cronometroID = -1, $statusID = -1, $usuarioID = -1) {
try {
$where = $this->getWhere($inicio, $tipoLeilaoID, $cronometroID, $statusID, $usuarioID);
$total = $this->conexao->query("SELECT COUNT(u.leilaoID) total FROM leilao u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro LeilaoDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/LeilaoDAO.class.php
|
PHP
|
asf20
| 8,204
|
<?php
/**
* Description of LanceDAO
*
* @author Magno
*/
class LanceDAO {
private $conexao;
private $leilaoDAO;
private $clienteDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->leilaoDAO = new LeilaoDAO();
$this->clienteDAO = new ClienteDAO();
}
public function salvarSimples($lanceID,$leilaoID,$usuarioID){
try {
$statment = $this->conexao->prepare("INSERT INTO lance(lanceID,leilaoID,usuarioID)
VALUES ($lanceID,$leilaoID,$usuarioID);");
return $statment->execute();
} catch (PDOException $err) {
throw new Exception("Erro LanceDAO:" . $err->getMessage());
}
}
public function salvar($lance) {
try {
if ($lance->getLanceID() != null && $lance->getLanceID() > 0) {
//não tem edição
return $lance;
} else {
$statment = $this->conexao->prepare("INSERT INTO lance(lanceID,leilaoID,usuarioID)
VALUES (:lanceID,:leilaoID,:usuarioID);");
}
if ($statment->execute($lance->toBD())) {
if ($lance->getLanceID() == null || $lance->getLanceID() <= 0)
$lance->setLanceID($this->conexao->lastInsertId());
return $lance;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro LanceDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro LanceDAO:" . $err->getMessage());
}
}
public function excluir($lanceID) {
try {
$statment = $this->conexao->prepare("DELETE FROM lance WHERE lanceID = :lanceID");
$statment->bindParam(':lanceID', $lanceID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro LanceDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro LanceDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $leilaoID = -1, $usuarioID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($leilaoID, $usuarioID);
$lances = array();
$statment = $this->conexao->query("SELECT * FROM lance u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$lance = new LanceBean($row['lanceID'], $row['data']);
if($carregarDependencias){
$lance->setLeilao($this->leilaoDAO->buscarPorID($row['leilaoID']));
$lance->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
}
$lances[] = $lance;
}
return $lances;
} catch (PDOException $err) {
throw new Exception("Erro LanceDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "lanceID", $direcao = "DESC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$lances = array();
$statment = $this->conexao->query("SELECT * FROM lance u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$lance = new LanceBean($row['lanceID'], $row['data']);
if($carregarDependencias){
$lance->setLeilao($this->leilaoDAO->buscarPorID($row['leilaoID']));
$lance->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
}
$lances[] = $lance;
}
return $lances;
} catch (PDOException $err) {
throw new Exception("Erro LanceDAO:" . $err->getMessage());
}
}
public function buscarPorID($lanceID, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM lance WHERE lanceID = $lanceID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['lanceID']) && $row['lanceID'] > 0) {
$lance = new LanceBean($row['lanceID'], $row['data']);
if($carregarDependencias){
$lance->setLeilao($this->leilaoDAO->buscarPorID($row['leilaoID']));
$lance->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
}
return $lance;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro LanceDAO:" . $err->getMessage());
}
}
protected function getWhere($leilaoID = -1,$usuarioID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($leilaoID) && $leilaoID > 0) {
$where = $where . " AND u.leilaoID = $leilaoID ";
}
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuarioID = $usuarioID ";
}
return $where;
}
public function total($leilaoID = -1,$usuarioID = -1) {
try {
$where = $this->getWhere($leilaoID, $usuarioID);
$total = $this->conexao->query("SELECT COUNT(u.lanceID) total FROM lance u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro LanceDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/LanceDAO.class.php
|
PHP
|
asf20
| 5,684
|
<?php
/**
* Description of PessoaDAO
*
* @author Magno
*/
class EnderecoDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($endereco) {
try {
if($this->existe($endereco->getPessoa()->getCliente()->getUsuarioID())) {
$statment = $this->conexao->prepare("UPDATE endereco SET
logradouro = :logradouro,
numero = :numero,
complemento = :complemento,
bairro = :bairro,
cep = :cep,
cidadeID = :cidadeID
WHERE usuarioID = :usuarioID");
}else {
$statment = $this->conexao->prepare("INSERT INTO endereco(usuarioID,logradouro,numero,complemento,bairro,cep,cidadeID) VALUES (:usuarioID,:logradouro,:numero,:complemento,:bairro,:cep,:cidadeID);");
}
if($statment->execute($endereco->toBD())) {
return $endereco;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro EnderecoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro EnderecoDAO:".$err->getMessage());
}
}
public function excluir($usuarioID) {
try {
$statment = $this->conexao->prepare("DELETE FROM endereco WHERE usuarioID = :usuarioID");
$statment->bindParam(':usuarioID',$usuarioID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro EnderecoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro EnderecoDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$cep = "", $cidadeID = 0, $carregarDependencias = false) {
try {
$cidadeDAO = new CidadeDAO();
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($cep,$cidadeID);
$enderecos = array();
$statment = $this->conexao->query( "SELECT * FROM endereco c $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row ) {
$endereco = new EnderecoBean(null, $row['logradouro'], $row['numero'], $row['complemento'], $row['bairro'], $row['cep']);
if($carregarDependencias){
$endereco->setCidade($cidadeDAO->buscarPorID($row['cidadeID'],$carregarDependencias));
}
$enderecos[] = $endereco;
}
return $enderecos;
}catch(PDOException $err) {
throw new Exception("Erro EnderecoDAO:".$err->getMessage());
}
}
public function buscarPorID($usuarioID, $carregarDependencias = false) {
try {
$cidadeDAO = new CidadeDAO();
$row = $this->conexao->query("SELECT * FROM endereco WHERE usuarioID = $usuarioID ")->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['usuarioID']) && $row['usuarioID'] > 0) {
$endereco = new EnderecoBean(null, $row['logradouro'], $row['numero'], $row['complemento'], $row['bairro'], $row['cep']);
if($carregarDependencias){
$endereco->setCidade($cidadeDAO->buscarPorID($row['cidadeID'],$carregarDependencias));
}
return $endereco;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro EnderecoDAO:".$err->getMessage());
}
}
public function existe($usuarioID){
if($this->buscarPorID($usuarioID) != null)
return true;
return false;
}
private function getWhere($cep = "",$cidadeID = 0) {
$where = " WHERE 1 = 1 ";
if (isset ($cep) && strlen($cep) > 0) {
$where = $where." AND c.cep = '$cep' ";
}
if (isset ($cidadeID) && $cidadeID > 0) {
$where = $where." AND c.cidadeID = $cidadeID ";
}
return $where;
}
public function total($cep = "",$cidadeID = 0) {
try {
$where = $this->getWhere($cep,$cidadeID);
$total = $this->conexao->query( "SELECT COUNT(c.usuarioID) total FROM endereco c $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro EnderecoDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/EnderecoDAO.class.php
|
PHP
|
asf20
| 4,661
|
<?php
/**
* Description of ClienteDAO
*
* @author Magno
*/
class ClienteDAO extends UsuarioDAO{
protected $conexao;
protected $mediaDAO;
protected $statusDAO;
private $pessoaDAO;
private $informacaoDAO;
private $depoimentoDAO;
private $compraDAO;
private $conviteDAO;
private $clienteBonusDAO;
private $interesseDAO;
private $votoDAO;
private $lanceDAO;
private $join = " SELECT * FROM cliente a INNER JOIN usuario u ON a.usuarioID = u.usuarioID ";
public function __construct() {
parent::__construct();
$this->conexao = Conexao::getConexao();
$this->pessoaDAO = new PessoaDAO();
}
public function salvar($cliente) {
try {
$cliente->setUsuario(parent::salvar($cliente->getUsuario()));
if($this->existe($cliente->getUsuarioID())) {
$statment = $this->conexao->prepare("UPDATE cliente SET
numLances = :numLances,
avisosPorEmail = :avisosPorEmail
WHERE usuarioID = :usuarioID");
}else {
$statment = $this->conexao->prepare("INSERT INTO cliente(usuarioID,numLances,avisosPorEmail) VALUES (:usuarioID,:numLances,:avisosPorEmail);");
}
if($statment->execute($cliente->toBD())) {
$cliente->getPessoa()->setCliente($cliente);
$cliente->setPessoa($this->pessoaDAO->salvar($cliente->getPessoa()));
return $cliente;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro ClienteDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro ClienteDAO:".$err->getMessage());
}
}
public function excluir($usuarioID) {
try {
parent::excluir($usuarioID);
}catch(PDOException $err) {
throw new Exception("Erro ClienteDAO:".$err->getMessage());
}
}
public function listar($pagina = 0, $email = "", $login = "", $statusID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = parent::getWhere($email, $login, $statusID);
$clientes = array();
$statment = $this->conexao->query( $this->join.$where. " $limite " );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row ) {
$usuarioID = $row['usuarioID'];
$cliente = new ClienteBean($usuarioID, $row['login'], $row['senha'], $row['email'], $row['ip'], Util::dateToString($row['dataCriacao'])
,null,null,$row['numLances'], $row['avisosPorEmail']);
$cliente->setStatus($this->statusDAO->buscarPorID($row['statusID']));
$cliente->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
$cliente->setPessoa($this->pessoaDAO->buscarPorID($usuarioID, true));
if($carregarDependencias){
$this->instanciaDependencias();
$cliente->setInformacoes($this->informacaoDAO->listar(0, 0, $usuarioID, 0, false));
$cliente->setDepoimentos($this->depoimentoDAO->listar(0, $usuarioID, 0, false));
$cliente->setCompras($this->compraDAO->listar(0, 0, $usuarioID, 0, false));
$cliente->setVotos($this->votoDAO->listar(0, 0, $usuarioID, 0, false));
$cliente->setClienteBonus($this->clienteBonusDAO->listar(0, 0, $usuarioID, "", false));
$cliente->setInteresses($this->interesseDAO->listarCategoriaProdutoPorCliente(0, $usuarioID));
$cliente->setConvites($this->conviteDAO->listar(0, "", $usuarioID, 0, false));
$cliente->setLances($this->lanceDAO->listar(0, 0, $usuarioID, false));
}
$clientes[] = $cliente;
}
return $clientes;
}catch(PDOException $err) {
throw new Exception("Erro ClienteDAO:".$err->getMessage());
}
}
public function buscarPorID($usuarioID, $carregarDependencias = false) {
try {
$row = $this->conexao->query( $this->join." WHERE a.usuarioID = $usuarioID ")->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['usuarioID']) && $row['usuarioID'] > 0) {
$usuarioID = $row['usuarioID'];
$cliente = new ClienteBean($usuarioID, $row['login'], $row['senha'], $row['email'], $row['ip'], Util::dateToString($row['dataCriacao'])
,null,null,$row['numLances'], $row['avisosPorEmail']);
$cliente->setStatus($this->statusDAO->buscarPorID($row['statusID']));
$cliente->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
$cliente->setPessoa($this->pessoaDAO->buscarPorID($usuarioID, true));
if($carregarDependencias){
$this->instanciaDependencias();
$cliente->setInformacoes($this->informacaoDAO->listar(0, 0, $usuarioID, 0, false));
$cliente->setDepoimentos($this->depoimentoDAO->listar(0, $usuarioID, 0, false));
$cliente->setCompras($this->compraDAO->listar(0, 0, $usuarioID, 0, false));
$cliente->setVotos($this->votoDAO->listar(0, 0, $usuarioID, 0, false));
$cliente->setClienteBonus($this->clienteBonusDAO->listar(0, 0, $usuarioID, "", false));
$cliente->setInteresses($this->interesseDAO->listarCategoriaProdutoPorCliente(0, $usuarioID));
$cliente->setConvites($this->conviteDAO->listar(0, "", $usuarioID, 0, false));
$cliente->setLances($this->lanceDAO->listar(0, 0, $usuarioID, false));
}
return $cliente;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro ClienteDAO:".$err->getMessage());
}
}
public function existe($usuarioID){
try {
$row = $this->conexao->query( $this->join." WHERE a.usuarioID = $usuarioID ")->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['usuarioID']) && $row['usuarioID'] > 0) {
return true;
}else {
return false;
}
}catch(PDOException $err) {
throw new Exception("Erro ClienteDAO:".$err->getMessage());
}
}
private function instanciaDependencias(){
$this->informacaoDAO = new InformacaoDAO();
$this->depoimentoDAO = new DepoimentoDAO();
$this->compraDAO = new CompraDAO();
$this->conviteDAO = new ConviteDAO();
$this->clienteBonusDAO = new ClienteBonusDAO();
$this->interesseDAO = new InteresseDAO();
$this->votoDAO = new VotoDAO();
$this->lanceDAO = new LanceDAO();
}
public function total($email = "", $login = "", $statusID = -1) {
try {
$where = parent::getWhere($email, $login, $statusID);
$total = $this->conexao->query(" SELECT COUNT(a.usuarioID) FROM cliente a INNER JOIN usuario u ON a.usuarioID = u.usuarioID " .$where)->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro ClienteDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/ClienteDAO.class.php
|
PHP
|
asf20
| 7,691
|
<?php
/**
* Description of StatusDAO
*
* @author Magno
*/
class StatusDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($status) {
try {
if($status->getStatusID() != null && $status->getStatusID() > 0) {
$statment = $this->conexao->prepare("UPDATE status SET
descricao = :descricao,
tipo = :tipo
WHERE statusID = :statusID");
}else {
$statment = $this->conexao->prepare("INSERT INTO status(statusID,descricao,tipo) VALUES (:statusID,:descricao,:tipo);");
}
if($statment->execute($status->toBD())) {
if($status->getStatusID() == null || $status->getStatusID() <= 0)
$status->setStatusID($this->conexao->lastInsertId());
return $status;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro StatusDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro StatusDAO:".$err->getMessage());
}
}
public function excluir($statusID) {
try {
$statment = $this->conexao->prepare("DELETE FROM status WHERE statusID = :statusID");
$statment->bindParam(':statusID',$statusID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro StatusDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro StatusDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$tipo = -1) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($tipo);
$statuss = array();
$statment = $this->conexao->query( "SELECT * FROM status e $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row )
$statuss[] = new StatusBean($row['statusID'], $row['descricao'], $row['tipo']);
return $statuss;
}catch(PDOException $err) {
throw new Exception("Erro StatusDAO:".$err->getMessage());
}
}
public function buscarPorID($statusID) {
try {
$row = $this->conexao->query( "SELECT * FROM status WHERE statusID = $statusID " )->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['statusID']) && $row['statusID'] > 0) {
$status = new StatusBean($row['statusID'], $row['descricao'], $row['tipo']);
return $status;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro StatusDAO:".$err->getMessage());
}
}
private function getWhere($tipo = -1) {
$where = " WHERE 1 = 1 ";
if (isset ($tipo) && $tipo > 0) {
$where = $where." AND e.tipo = $tipo ";
}
return $where;
}
public function total($tipo = -1) {
try {
$where = $this->getWhere($tipo);
$total = $this->conexao->query( "SELECT COUNT(e.statusID) total FROM status e $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro StatusDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/StatusDAO.class.php
|
PHP
|
asf20
| 3,514
|
<?php
/**
* Description of LoginDAO
*
* @author Magno
*/
class LoginDAO {
private $conexao;
private $usuarioDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->usuarioDAO = new UsuarioDAO();
}
public function salvar($login) {
try {
if ($login->getLoginID() != null && $login->getLoginID() > 0) {
//nao vai ter edição
return $login;
} else {
$ip = $_SERVER['REMOTE_ADDR'];
$statment = $this->conexao->prepare("INSERT INTO login(loginID,data,ip,usuarioID)
VALUES (:loginID,:data,'$ip',:usuarioID);");
}
if ($statment->execute($login->toBD())) {
if ($login->getLoginID() == null || $login->getLoginID() <= 0)
$login->setLoginID($this->conexao->lastInsertId());
return $login;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro LoginDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro LoginDAO:" . $err->getMessage());
}
}
public function excluir($loginID) {
try {
$statment = $this->conexao->prepare("DELETE FROM login WHERE loginID = :loginID");
$statment->bindParam(':loginID', $loginID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro LoginDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro LoginDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $usuarioID = -1) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($usuarioID);
$logins = array();
$statment = $this->conexao->query("SELECT * FROM login u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$login = new LoginBean($row['loginID'], $row['data'], $row['ip']);
$login->setUsuario($this->usuarioDAO->buscarPorID($row['usuarioID']));
$logins[] = $login;
}
return $logins;
} catch (PDOException $err) {
throw new Exception("Erro LoginDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "loginID", $direcao = "ASC") {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$logins = array();
$statment = $this->conexao->query("SELECT * FROM login u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$login = new LoginBean($row['loginID'], $row['data'], $row['ip']);
$login->setUsuario($this->usuarioDAO->buscarPorID($row['usuarioID']));
$logins[] = $login;
}
return $logins;
} catch (PDOException $err) {
throw new Exception("Erro LoginDAO:" . $err->getMessage());
}
}
public function buscarPorID($loginID) {
try {
$row = $this->conexao->query("SELECT * FROM login WHERE loginID = $loginID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['loginID']) && $row['loginID'] > 0) {
$login = new LoginBean($row['loginID'], $row['data'], $row['ip'], $row['ip']);
$login->setUsuario($this->usuarioDAO->buscarPorID($row['usuarioID']));
return $login;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro LoginDAO:" . $err->getMessage());
}
}
private function getWhere($usuarioID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuarioID = $usuarioID ";
}
return $where;
}
public function total($usuarioID = -1) {
try {
$where = $this->getWhere($usuarioID);
$total = $this->conexao->query("SELECT COUNT(u.loginID) total FROM login u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro LoginDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/LoginDAO.class.php
|
PHP
|
asf20
| 4,523
|
<?php
/**
* Description of PessoaDAO
*
* @author Magno
*/
class BonusDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($bonus) {
try {
if($bonus->getBonusID() != null && $bonus->getBonusID() > 0) {
$statment = $this->conexao->prepare("UPDATE bonus SET
descricao = :descricao,
valor = :valor
WHERE bonusID = :bonusID");
}else {
$statment = $this->conexao->prepare("INSERT INTO bonus(bonusID,descricao,valor) VALUES (:bonusID,:descricao,:valor);");
}
if($statment->execute($bonus->toBD())) {
if($bonus->getBonusID() == null || $bonus->getBonusID() <= 0)
$bonus->setBonusID($this->conexao->lastInsertId());
return $bonus;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro BonusDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro BonusDAO:".$err->getMessage());
}
}
public function excluir($bonusID) {
try {
$statment = $this->conexao->prepare("DELETE FROM bonus WHERE bonusID = :bonusID");
$statment->bindParam(':bonusID',$bonusID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro BonusDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro BonusDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$descricao = "") {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($descricao);
$bonuss = array();
$statment = $this->conexao->query( "SELECT * FROM bonus e $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row )
$bonuss[] = new BonusBean($row['bonusID'], $row['descricao'], $row['valor']);
return $bonuss;
}catch(PDOException $err) {
throw new Exception("Erro BonusDAO:".$err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "bonusID", $direcao = "DESC") {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$bonuss = array();
$statment = $this->conexao->query("SELECT * FROM bonus e ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$bonuss[] = new BonusBean($row['bonusID'], $row['descricao'], $row['valor']);
}
return $bonuss;
} catch (PDOException $err) {
throw new Exception("Erro EnqueteDAO:" . $err->getMessage());
}
}
public function buscarPorID($bonusID) {
try {
$row = $this->conexao->query( "SELECT * FROM bonus WHERE bonusID = $bonusID " )->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['bonusID']) && $row['bonusID'] > 0) {
$bonus = new BonusBean($row['bonusID'], $row['descricao'], $row['valor']);
return $bonus;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro BonusDAO:".$err->getMessage());
}
}
private function getWhere($descricao = "") {
$where = " WHERE 1 = 1 ";
if (isset ($descricao) && strlen($descricao) > 0) {
$where = $where." AND e.descricao = '$descricao' ";
}
return $where;
}
public function total($descricao = "") {
try {
$where = $this->getWhere($descricao);
$total = $this->conexao->query( "SELECT COUNT(e.bonusID) total FROM bonus e $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro BonusDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/BonusDAO.class.php
|
PHP
|
asf20
| 4,203
|
<?php
/**
* Description of TipoLeilaoDAO
*
* @author Magno
*/
class TipoLeilaoDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($tipoLeilao) {
try {
if($tipoLeilao->getTipoLeilaoID() != null && $tipoLeilao->getTipoLeilaoID() > 0) {
$statment = $this->conexao->prepare("UPDATE tipoLeilao SET
descricao = :descricao
WHERE tipoLeilaoID = :tipoLeilaoID");
}else {
$statment = $this->conexao->prepare("INSERT INTO tipoLeilao(tipoLeilaoID,descricao) VALUES (:tipoLeilaoID,:descricao);");
}
if($statment->execute($tipoLeilao->toBD())) {
if($tipoLeilao->getTipoLeilaoID() == null || $tipoLeilao->getTipoLeilaoID() <= 0)
$tipoLeilao->setTipoLeilaoID($this->conexao->lastInsertId());
return $tipoLeilao;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro TipoLeilaoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro TipoLeilaoDAO:".$err->getMessage());
}
}
public function excluir($tipoLeilaoID) {
try {
$statment = $this->conexao->prepare("DELETE FROM tipoLeilao WHERE tipoLeilaoID = :tipoLeilaoID");
$statment->bindParam(':tipoLeilaoID',$tipoLeilaoID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro TipoLeilaoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro TipoLeilaoDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$descricao = "") {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($descricao);
$tipoLeilaos = array();
$statment = $this->conexao->query( "SELECT * FROM tipoLeilao e $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row )
$tipoLeilaos[] = new TipoLeilaoBean($row['tipoLeilaoID'], $row['descricao'], $row['sigla']);
return $tipoLeilaos;
}catch(PDOException $err) {
throw new Exception("Erro TipoLeilaoDAO:".$err->getMessage());
}
}
public function buscarPorID($tipoLeilaoID) {
try {
$row = $this->conexao->query( "SELECT * FROM tipoLeilao WHERE tipoLeilaoID = $tipoLeilaoID " )->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['tipoLeilaoID']) && $row['tipoLeilaoID'] > 0) {
$tipoLeilao = new TipoLeilaoBean($row['tipoLeilaoID'], $row['descricao'], $row['sigla']);
return $tipoLeilao;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro TipoLeilaoDAO:".$err->getMessage());
}
}
private function getWhere($descricao = "") {
$where = " WHERE 1 = 1 ";
if (isset ($descricao) && strlen($descricao) > 0) {
$where = $where." AND e.descricao = '$descricao' ";
}
return $where;
}
public function total($descricao = "") {
try {
$where = $this->getWhere($descricao);
$total = $this->conexao->query( "SELECT COUNT(e.tipoLeilaoID) total FROM tipoLeilao e $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro TipoLeilaoDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/TipoLeilaoDAO.class.php
|
PHP
|
asf20
| 3,730
|
<?php
/**
* Description of ConviteDAO
*
* @author Magno
*/
class ConviteDAO {
private $conexao;
private $statusDAO;
private $clienteDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->statusDAO = new StatusDAO();
$this->clienteDAO = new ClienteDAO();
}
public function salvar($convite) {
try {
if ($convite->getConviteID() != null && $convite->getConviteID() > 0) {
$statment = $this->conexao->prepare("UPDATE convite SET
email = :email,
mensagem = :mensagem,
usuarioID = :usuarioID,
convidadoID = :convidadoID,
statusID = :statusID
WHERE conviteID = :conviteID");
} else {
$statment = $this->conexao->prepare("INSERT INTO convite(conviteID,email,mensagem,usuarioID,convidadoID,statusID)
VALUES (:conviteID,:email,:mensagem,:usuarioID,:convidadoID,:statusID);");
}
if ($statment->execute($convite->toBD())) {
if ($convite->getConviteID() == null || $convite->getConviteID() <= 0)
$convite->setConviteID($this->conexao->lastInsertId());
return $convite;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro ConviteDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro ConviteDAO:" . $err->getMessage());
}
}
public function excluir($conviteID) {
try {
$statment = $this->conexao->prepare("DELETE FROM convite WHERE conviteID = :conviteID");
$statment->bindParam(':conviteID', $conviteID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro ConviteDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro ConviteDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $email = "", $usuarioID = -1, $statusID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($email, $usuarioID, $statusID);
$convites = array();
$statment = $this->conexao->query("SELECT * FROM convite u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$convite = new ConviteBean($row['conviteID'], $row['email'], $row['mensagem']);
$convite->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$convite->setCliente ($this->clienteDAO->buscarPorID($row['usuarioID']));
if(isset ($row['convidadoID']) && $row['convidadoID'] > 0)
$convite->setConvidado($this->clienteDAO->buscarPorID($row['convidadoID']));
}
$convites[] = $convite;
}
return $convites;
} catch (PDOException $err) {
throw new Exception("Erro ConviteDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "conviteID", $direcao = "ASC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$convites = array();
$statment = $this->conexao->query("SELECT * FROM convite u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$convite = new ConviteBean($row['conviteID'], $row['email'], $row['mensagem']);
$convite->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$convite->setCliente ($this->clienteDAO->buscarPorID($row['usuarioID']));
if(isset ($row['convidadoID']) && $row['convidadoID'] > 0)
$convite->setConvidado($this->clienteDAO->buscarPorID($row['convidadoID']));
}
$convites[] = $convite;
}
return $convites;
} catch (PDOException $err) {
throw new Exception("Erro ConviteDAO:" . $err->getMessage());
}
}
public function buscarPorID($conviteID, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM convite WHERE conviteID = $conviteID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['conviteID']) && $row['conviteID'] > 0) {
$convite = new ConviteBean($row['conviteID'], $row['email'], $row['mensagem']);
$convite->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$convite->setCliente ($this->clienteDAO->buscarPorID($row['usuarioID']));
if(isset ($row['convidadoID']) && $row['convidadoID'] > 0)
$convite->setConvidado($this->clienteDAO->buscarPorID($row['convidadoID']));
}
return $convite;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro ConviteDAO:" . $err->getMessage());
}
}
private function getWhere($email = "", $usuarioID = -1, $statusID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuario = $usuarioID ";
}
if (isset($email) && strlen($email) > 0) {
$where = $where . " AND u.email like '%$email%' ";
}
if (isset($statusID) && $statusID > 0) {
$where = $where . " AND u.statusID = $statusID ";
}
return $where;
}
public function total($email = "", $usuarioID = -1, $statusID = -1) {
try {
$where = $this->getWhere($email, $usuarioID, $statusID);
$total = $this->conexao->query("SELECT COUNT(u.conviteID) total FROM convite u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro ConviteDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/ConviteDAO.class.php
|
PHP
|
asf20
| 6,508
|
<?php
/**
* Description of MediaDAO
*
* @author Magno
*/
class MediaDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($media) {
try {
if($media->getMediaID() != null && $media->getMediaID() > 0) {
$statment = $this->conexao->prepare("UPDATE media SET
caminho = :caminho
WHERE mediaID = :mediaID");
}else {
$statment = $this->conexao->prepare("INSERT INTO media(mediaID,caminho) VALUES (:mediaID,:caminho);");
}
if($statment->execute($media->toBD())) {
if($media->getMediaID() == null || $media->getMediaID() <= 0)
$media->setMediaID($this->conexao->lastInsertId());
return $media;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro MediaDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro MediaDAO:".$err->getMessage());
}
}
public function excluir($mediaID) {
try {
$statment = $this->conexao->prepare("DELETE FROM media WHERE mediaID = :mediaID");
$statment->bindParam(':mediaID',$mediaID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro MediaDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro MediaDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$caminho = "") {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($caminho);
$medias = array();
$statment = $this->conexao->query( "SELECT * FROM media e $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row )
$medias[] = new MediaBean($row['mediaID'], $row['caminho']);
return $medias;
}catch(PDOException $err) {
throw new Exception("Erro MediaDAO:".$err->getMessage());
}
}
public function buscarPorID($mediaID) {
try {
$row = $this->conexao->query( "SELECT * FROM media WHERE mediaID = $mediaID " )->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['mediaID']) && $row['mediaID'] > 0) {
$media = new MediaBean($row['mediaID'], $row['caminho']);
return $media;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro MediaDAO:".$err->getMessage());
}
}
private function getWhere($caminho = "") {
$where = " WHERE 1 = 1 ";
if (isset ($caminho) && strlen($caminho) > 0) {
$where = $where." AND e.caminho = '$caminho' ";
}
return $where;
}
public function total($caminho = "") {
try {
$where = $this->getWhere($caminho);
$total = $this->conexao->query( "SELECT COUNT(e.mediaID) total FROM media e $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro MediaDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/MediaDAO.class.php
|
PHP
|
asf20
| 3,418
|
<?php
/**
* Description of PessoaDAO
*
* @author Magno
*/
class PessoaDAO {
private $conexao;
private $enderecoDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->enderecoDAO = new EnderecoDAO();
}
public function salvar($pessoa) {
try {
if($this->existe($pessoa->getCliente()->getUsuarioID())) {
$statment = $this->conexao->prepare("UPDATE pessoa SET
nome = :nome,
cpf = :cpf,
sexo = :sexo,
dataNascimento = :dataNascimento,
estadoCivil = :estadoCivil,
telefone = :telefone
WHERE usuarioID = :usuarioID");
}else {
$statment = $this->conexao->prepare("INSERT INTO pessoa(usuarioID,nome,cpf,sexo,dataNascimento,estadoCivil,telefone)
VALUES (:usuarioID,:nome,:cpf,:sexo,:dataNascimento,:estadoCivil,:telefone);");
}
if($statment->execute($pessoa->toBD())) {
$pessoa->getEndereco()->setPessoa($pessoa);
$pessoa->setEndereco($this->enderecoDAO->salvar($pessoa->getEndereco()));
return $pessoa;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro PessoaDAO: ".$erros[2]);
}
}catch(PDOExestadoCiviltion $err) {
throw new ExestadoCiviltion("Erro PessoaDAO:".$err->getMessage());
}
}
public function excluir($usuarioID) {
try {
$statment = $this->conexao->prepare("DELETE FROM pessoa WHERE usuarioID = :usuarioID");
$statment->bindParam(':usuarioID',$usuarioID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new ExestadoCiviltion("Erro PessoaDAO: ".$erros[2]);
}
}catch(PDOExestadoCiviltion $err) {
throw new ExestadoCiviltion("Erro PessoaDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$nome = "", $cpf = "", $carregarDependencias = false) {
try {
$cidadeDAO = new CidadeDAO();
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($nome,$cpf);
$pessoas = array();
$statment = $this->conexao->query( "SELECT * FROM pessoa c $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row ) {
$pessoa = new PessoaBean(null, $row['nome'], $row['cpf'], $row['sexo'], Util::dateToString($row['dataNascimento']), $row['estadoCivil'], $row['telefone']);
if($carregarDependencias){
$pessoa->setEndereco($this->enderecoDAO->buscarPorID($row['usuarioID'],$carregarDependencias));
}
$pessoas[] = $pessoa;
}
return $pessoas;
}catch(PDOExestadoCiviltion $err) {
throw new ExestadoCiviltion("Erro PessoaDAO:".$err->getMessage());
}
}
public function buscarPorID($usuarioID, $carregarDependencias = false) {
try {
$cidadeDAO = new CidadeDAO();
$row = $this->conexao->query("SELECT * FROM pessoa WHERE usuarioID = $usuarioID ")->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['usuarioID']) && $row['usuarioID'] > 0) {
$pessoa = new PessoaBean(null, $row['nome'], $row['cpf'], $row['sexo'], Util::dateToString($row['dataNascimento']), $row['estadoCivil'], $row['telefone']);
if($carregarDependencias){
$pessoa->setEndereco($this->enderecoDAO->buscarPorID($row['usuarioID'],$carregarDependencias));
}
return $pessoa;
}else {
return null;
}
}catch(PDOExestadoCiviltion $err) {
throw new ExestadoCiviltion("Erro PessoaDAO:".$err->getMessage());
}
}
public function existe($usuarioID){
if($this->buscarPorID($usuarioID) != null)
return true;
return false;
}
private function getWhere($nome = "",$cpf = "") {
$where = " WHERE 1 = 1 ";
if (isset ($nome) && strlen($nome) > 0) {
$where = $where." AND c.nome like '%$nome%' ";
}
if (isset ($cpf) && $cpf > 0) {
$where = $where." AND c.cpf = '$cpf' ";
}
return $where;
}
public function total($nome = "",$cpf = "") {
try {
$where = $this->getWhere($nome,$cpf);
$total = $this->conexao->query( "SELECT COUNT(c.usuarioID) total FROM pessoa c $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOExestadoCiviltion $err) {
throw new ExestadoCiviltion("Erro PessoaDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/PessoaDAO.class.php
|
PHP
|
asf20
| 5,025
|
<?php
/**
* Description of CategoriaProdutoDAO
*
* @author Magno
*/
class RespostaDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($resposta) {
try {
$enqueteDAO = new EnqueteDAO();
if($resposta->getEnquete()->getEnqueteID() == null || $resposta->getEnquete()->getEnqueteID() <= 0)
$resposta->setEnquete($enqueteDAO->salvar($resposta->getEnquete()));
if($resposta->getRespostaID() != null && $resposta->getRespostaID() > 0) {
$statment = $this->conexao->prepare("UPDATE resposta SET
descricao = :descricao,
enqueteID = :enqueteID
WHERE respostaID = :respostaID");
}else {
$statment = $this->conexao->prepare("INSERT INTO resposta(respostaID,descricao,enqueteID) VALUES (:respostaID,:descricao,:enqueteID);");
}
if($statment->execute($resposta->toBD())) {
if($resposta->getRespostaID() == null || $resposta->getRespostaID() <= 0)
$resposta->setRespostaID($this->conexao->lastInsertId());
return $resposta;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro RespostaDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro RespostaDAO:".$err->getMessage());
}
}
public function excluir($respostaID) {
try {
$statment = $this->conexao->prepare("DELETE FROM resposta WHERE respostaID = :respostaID");
$statment->bindParam(':respostaID',$respostaID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro RespostaDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro RespostaDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$descricao = "", $enqueteID = 0, $carregarDependencias = false) {
try {
$enqueteDAO = new EnqueteDAO();
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($descricao,$enqueteID);
$respostas = array();
$statment = $this->conexao->query( "SELECT * FROM resposta c $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row ) {
$resposta = new RespostaBean($row['respostaID'], $row['descricao']);
if($carregarDependencias){
$resposta->setEnquete($enqueteDAO->buscarPorID($row['enqueteID']));
}
$respostas[] = $resposta;
}
return $respostas;
}catch(PDOException $err) {
throw new Exception("Erro RespostaDAO:".$err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "respostaID", $direcao = "DESC") {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$respostas = array();
$statment = $this->conexao->query("SELECT * FROM resposta c ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$resposta = new RespostaBean($row['respostaID'], $row['descricao']);
/*if($carregarDependencias){
$resposta->setEnquete($enqueteDAO->buscarPorID($row['enqueteID']));
}*/
$respostas[] = $resposta;
}
return $respostas;
} catch (PDOException $err) {
throw new Exception("Erro EnqueteDAO:" . $err->getMessage());
}
}
public function buscarPorID($respostaID, $carregarDependencias = false) {
try {
$enqueteDAO = new EnqueteDAO();
$row = $this->conexao->query("SELECT * FROM resposta WHERE respostaID = $respostaID ")->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['respostaID']) && $row['respostaID'] > 0) {
$resposta = new RespostaBean($row['respostaID'], $row['descricao']);
if($carregarDependencias){
$resposta->setEnquete($enqueteDAO->buscarPorID($row['enqueteID']));
}
return $resposta;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro RespostaDAO:".$err->getMessage());
}
}
private function getWhere($descricao="",$enqueteID = 0) {
$where = " WHERE 1 = 1 ";
if (isset ($descricao) && strlen($descricao) > 0) {
$where = $where." AND c.descricao = '$descricao' ";
}
if (isset ($enqueteID) && $enqueteID > 0) {
$where = $where." AND c.enqueteID = $enqueteID ";
}
return $where;
}
public function total($descricao = "",$enqueteID = 0) {
try {
$where = $this->getWhere($descricao, $enqueteID);
$total = $this->conexao->query( "SELECT COUNT(c.respostaID) total FROM resposta c $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro RespostaDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/RespostaDAO.class.php
|
PHP
|
asf20
| 5,463
|
<?php
/**
* Description of ProdutoDAO
*
* @author Magno
*/
class ProdutoDAO {
private $conexao;
private $leilaoDAO;
private $mediaProdutoDAO;
private $catProDAO;
private $statusDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->leilaoDAO = new LeilaoDAO();
$this->mediaProdutoDAO = new MediaProdutoDAO();
$this->catProDAO = new CategoriaProdutoDAO();
$this->statusDAO = new StatusDAO();
}
public function salvar($produto) {
try {
if ($produto->getProdutoID() != null && $produto->getProdutoID() > 0) {
$statment = $this->conexao->prepare("UPDATE produto SET
descricao = :descricao,
valorMercado = :valorMercado,
peso = :peso,
categoriaProdutoID = :categoriaProdutoID,
leilaoID = :leilaoID,
statusID = :statusID
WHERE produtoID = :produtoID");
} else {
$statment = $this->conexao->prepare("INSERT INTO produto(produtoID,descricao,valorMercado,peso,categoriaProdutoID,leilaoID,statusID)
VALUES (:produtoID,:descricao,:valorMercado,:peso,:categoriaProdutoID,:leilaoID,:statusID);");
}
if ($statment->execute($produto->toBD())) {
if ($produto->getProdutoID() == null || $produto->getProdutoID() <= 0)
$produto->setProdutoID($this->conexao->lastInsertId());
return $produto;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro ProdutoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro ProdutoDAO:" . $err->getMessage());
}
}
public function excluir($produtoID) {
try {
$statment = $this->conexao->prepare("DELETE FROM produto WHERE produtoID = :produtoID");
$statment->bindParam(':produtoID', $produtoID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro ProdutoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro ProdutoDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $descricao = "", $categoriaProdutoID = -1, $leilaoID = -1, $statusID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($descricao, $categoriaProdutoID, $leilaoID, $statusID);
$produtos = array();
$statment = $this->conexao->query("SELECT * FROM produto u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$produto = new ProdutoBean($row['produtoID'], $row['descricao'], $row['peso'], $row['valorMercado']);
$produto->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$produto->setLeilao($this->leilaoDAO->buscarPorID($row['leilaoID']));
$produto->setCategoriaProduto($this->catProDAO->buscarPorID($row['categoriaProdutoID']));
$produto->setMediaProdutos($this->mediaProdutoDAO->listar(0, "", $row['produtoID']));
}
$produtos[] = $produto;
}
return $produtos;
} catch (PDOException $err) {
throw new Exception("Erro ProdutoDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "produtoID", $direcao = "ASC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$produtos = array();
$statment = $this->conexao->query("SELECT * FROM produto u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$produto = new ProdutoBean($row['produtoID'], $row['descricao'], $row['peso'], $row['valorMercado']);
$produto->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$produto->setLeilao($this->leilaoDAO->buscarPorID($row['leilaoID']));
$produto->setCategoriaProduto($this->catProDAO->buscarPorID($row['categoriaProdutoID']));
$produto->setMediaProdutos($this->mediaProdutoDAO->listar(0, "", $row['produtoID']));
}
$produtos[] = $produto;
}
return $produtos;
} catch (PDOException $err) {
throw new Exception("Erro ProdutoDAO:" . $err->getMessage());
}
}
public function buscarPorID($produtoID, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM produto WHERE produtoID = $produtoID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['produtoID']) && $row['produtoID'] > 0) {
$produto = new ProdutoBean($row['produtoID'], $row['descricao'], $row['peso'], $row['valorMercado']);
$produto->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$produto->setLeilao($this->leilaoDAO->buscarPorID($row['leilaoID']));
$produto->setCategoriaProduto($this->catProDAO->buscarPorID($row['categoriaProdutoID']));
$produto->setMediaProdutos($this->mediaProdutoDAO->listar(0, "", $row['produtoID']));
}
return $produto;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro ProdutoDAO:" . $err->getMessage());
}
}
protected function getWhere($descricao = "", $categoriaProdutoID = -1, $leilaoID = -1, $statusID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($descricao) && strlen($descricao) > 0) {
$where = $where . " AND u.descricao like '%$descricao%' ";
}
if (isset($categoriaProdutoID) && $categoriaProdutoID > 0) {
$where = $where . " AND u.categoriaProdutoID = $categoriaProdutoID ";
}
if (isset($leilaoID) && $leilaoID > 0) {
$where = $where . " AND u.leilaoID = $leilaoID ";
}
if (isset($statusID) && $statusID > 0) {
$where = $where . " AND u.statusID = $statusID ";
}
return $where;
}
public function total($descricao = "", $categoriaProdutoID = -1, $leilaoID = -1, $statusID = -1) {
try {
$where = $this->getWhere($descricao, $categoriaProdutoID, $leilaoID, $statusID);
$total = $this->conexao->query("SELECT COUNT(u.produtoID) total FROM produto u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro ProdutoDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/ProdutoDAO.class.php
|
PHP
|
asf20
| 7,248
|
<?php
/**
* Description of CronometroDAO
*
* @author Magno
*/
class CronometroDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($cronometro) {
try {
if($cronometro->getCronometroID() != null && $cronometro->getCronometroID() > 0) {
$statment = $this->conexao->prepare("UPDATE cronometro SET
valor = :valor
WHERE cronometroID = :cronometroID");
}else {
$statment = $this->conexao->prepare("INSERT INTO cronometro(cronometroID,valor) VALUES (:cronometroID,:valor);");
}
if($statment->execute($cronometro->toBD())) {
if($cronometro->getCronometroID() == null || $cronometro->getCronometroID() <= 0)
$cronometro->setCronometroID($this->conexao->lastInsertId());
return $cronometro;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro CronometroDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro CronometroDAO:".$err->getMessage());
}
}
public function excluir($cronometroID) {
try {
$statment = $this->conexao->prepare("DELETE FROM cronometro WHERE cronometroID = :cronometroID");
$statment->bindParam(':cronometroID',$cronometroID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro CronometroDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro CronometroDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$valor = -1) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($valor);
$cronometros = array();
$statment = $this->conexao->query( "SELECT * FROM cronometro e $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row )
$cronometros[] = new CronometroBean($row['cronometroID'], $row['valor'], $row['sigla']);
return $cronometros;
}catch(PDOException $err) {
throw new Exception("Erro CronometroDAO:".$err->getMessage());
}
}
public function buscarPorID($cronometroID) {
try {
$row = $this->conexao->query( "SELECT * FROM cronometro WHERE cronometroID = $cronometroID " )->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['cronometroID']) && $row['cronometroID'] > 0) {
$cronometro = new CronometroBean($row['cronometroID'], $row['valor'], $row['sigla']);
return $cronometro;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro CronometroDAO:".$err->getMessage());
}
}
private function getWhere($valor = -1) {
$where = " WHERE 1 = 1 ";
if (isset ($valor) && $valor > 0) {
$where = $where." AND e.valor = $valor ";
}
return $where;
}
public function total($valor = -1) {
try {
$where = $this->getWhere($valor);
$total = $this->conexao->query( "SELECT COUNT(e.cronometroID) total FROM cronometro e $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro CronometroDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/CronometroDAO.class.php
|
PHP
|
asf20
| 3,660
|
<?php
/**
* Description of ChatDAO
*
* @author Magno
*/
class ChatDAO {
private $conexao;
private $leilaoDAO;
private $clienteDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->leilaoDAO = new LeilaoDAO();
$this->clienteDAO = new ClienteDAO();
}
public function salvarSimples($chatID,$leilaoID,$usuarioID){
try {
$statment = $this->conexao->prepare("INSERT INTO chat(lanceID,leilaoID,usuarioID)
VALUES ($chatID,$leilaoID,$usuarioID);");
return $statment->execute();
} catch (PDOException $err) {
throw new Exception("Erro LanceDAO:" . $err->getMessage());
}
}
public function salvar($chat) {
try {
if ($chat->getChatID() != null && $chat->getChatID() > 0) {
//não tem edição
return $chat;
} else {
$statment = $this->conexao->prepare("INSERT INTO chat(chatID,leilaoID,usuarioID,mensagem)
VALUES (:chatID,:leilaoID,:usuarioID,:mensagem);");
}
if ($statment->execute($chat->toBD())) {
if ($chat->getChatID() == null || $chat->getChatID() <= 0)
$chat->setChatID($this->conexao->lastInsertId());
return $chat;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro ChatDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro ChatDAO:" . $err->getMessage());
}
}
public function excluir($chatID) {
try {
$statment = $this->conexao->prepare("DELETE FROM chat WHERE chatID = :chatID");
$statment->bindParam(':chatID', $chatID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro ChatDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro ChatDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $leilaoID = -1, $usuarioID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($leilaoID, $usuarioID);
$chats = array();
$statment = $this->conexao->query("SELECT * FROM chat u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$chat = new ChatBean($row['chatID'], $row['data']);
if($carregarDependencias){
$chat->setLeilao($this->leilaoDAO->buscarPorID($row['leilaoID']));
$chat->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
}
$chats[] = $chat;
}
return $chats;
} catch (PDOException $err) {
throw new Exception("Erro ChatDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "chatID", $direcao = "DESC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$chats = array();
$statment = $this->conexao->query("SELECT * FROM chat u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$chat = new ChatBean($row['chatID'], $row['data']);
if($carregarDependencias){
$chat->setLeilao($this->leilaoDAO->buscarPorID($row['leilaoID']));
$chat->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
}
$chats[] = $chat;
}
return $chats;
} catch (PDOException $err) {
throw new Exception("Erro ChatDAO:" . $err->getMessage());
}
}
public function buscarPorID($chatID, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM chat WHERE chatID = $chatID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['chatID']) && $row['chatID'] > 0) {
$chat = new ChatBean($row['chatID'], $row['data']);
if($carregarDependencias){
$chat->setLeilao($this->leilaoDAO->buscarPorID($row['leilaoID']));
$chat->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
}
return $chat;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro ChatDAO:" . $err->getMessage());
}
}
protected function getWhere($leilaoID = -1,$usuarioID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($leilaoID) && $leilaoID > 0) {
$where = $where . " AND u.leilaoID = $leilaoID ";
}
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuarioID = $usuarioID ";
}
return $where;
}
public function total($leilaoID = -1,$usuarioID = -1) {
try {
$where = $this->getWhere($leilaoID, $usuarioID);
$total = $this->conexao->query("SELECT COUNT(u.chatID) total FROM chat u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro ChatDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/ChatDAO.class.php
|
PHP
|
asf20
| 5,600
|
<?php
/**
* Description of InteresseDAO
*
* @author Magno
*/
class InteresseDAO {
private $conexao;
private $categoriaProdutoDAO;
private $clienteDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->categoriaProdutoDAO = new CategoriaProdutoDAO();
$this->clienteDAO = new ClienteDAO();
}
public function salvar($interesse) {
try {
if ($this->existe($interesse->getCategoriaProduto()->getCategoriaProdutoID(), $interesse->getCliente()->getUsuarioID())) {
//não tem edição
return $interesse;
} else {
$statment = $this->conexao->prepare("INSERT INTO interesse(categoriaProdutoID,usuarioID)
VALUES (:categoriaProdutoID,:usuarioID);");
}
if ($statment->execute($interesse->toBD())) {
if ($interesse->getInteresseID() == null || $interesse->getInteresseID() <= 0)
$interesse->setInteresseID($this->conexao->lastInsertId());
return $interesse;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro InteresseDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro InteresseDAO:" . $err->getMessage());
}
}
public function excluir($categoriaProdutoID, $usuarioID) {
try {
$statment = $this->conexao->prepare("DELETE FROM interesse WHERE categoriaProdutoID = :categoriaProdutoID AND usuarioID = :usuarioID");
$statment->bindParam(':categoriaProdutoID', $categoriaProdutoID);
$statment->bindParam(':usuarioID', $usuarioID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro InteresseDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro InteresseDAO:" . $err->getMessage());
}
}
public function listarCategoriaProdutoPorCliente($pagina = 0, $usuarioID = -1) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere(-1, $usuarioID);
$categoriaProduto = array();
$statment = $this->conexao->query("SELECT * FROM interesse u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$bn = $this->categoriaProdutoDAO->buscarPorID($row['categoriaProdutoID']);
$categoriaProduto[] = $bn;
}
return $categoriaProduto;
} catch (PDOException $err) {
throw new Exception("Erro InteresseDAO:" . $err->getMessage());
}
}
public function listarClientesPorCategoriaProduto($pagina = 0, $categoriaProdutoID = -1) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($categoriaProdutoID, -1);
$clientes = array();
$statment = $this->conexao->query("SELECT * FROM interesse u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$cli = $this->clienteDAO->buscarPorID($row['usuarioID'], false);
$clientes[] = $cli;
}
return $clientes;
} catch (PDOException $err) {
throw new Exception("Erro InteresseDAO:" . $err->getMessage());
}
}
public function existe($categoriaProdutoID = -1, $usuarioID = -1){
if($this->buscarPorID($categoriaProdutoID, $usuarioID) != null)
return true;
return false;
}
private function getWhere($categoriaProdutoID = -1, $usuarioID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($categoriaProdutoID) && $categoriaProdutoID > 0) {
$where = $where . " AND u.categoriaProdutoID = $categoriaProdutoID ";
}
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuarioID = $usuarioID ";
}
return $where;
}
public function total($categoriaProdutoID = -1, $usuarioID = -1) {
try {
$where = $this->getWhere($categoriaProdutoID, $usuarioID);
$total = $this->conexao->query("SELECT COUNT(u.interesseID) total FROM interesse u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro InteresseDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/InteresseDAO.class.php
|
PHP
|
asf20
| 4,590
|
<?php
/**
* Description of CompraDAO
*
* @author Magno
*/
class CompraDAO {
private $conexao;
private $statusDAO;
private $clienteDAO;
private $pacoteLanceDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->statusDAO = new StatusDAO();
$this->clienteDAO = new ClienteDAO();
$this->pacoteLanceDAO = new PacoteLanceDAO();
}
public function salvar($compra) {
try {
if ($compra->getCompraID() != null && $compra->getCompraID() > 0) {
$statment = $this->conexao->prepare("UPDATE compra SET
valor = :valor,
pacoteLanceID = :pacoteLanceID,
usuarioID = :usuarioID,
statusID = :statusID
WHERE compraID = :compraID");
} else {
$ip = $_SERVER['REMOTE_ADDR'];
$statment = $this->conexao->prepare("INSERT INTO compra(compraID,valor,ip,pacoteLanceID,usuarioID,statusID)
VALUES (:compraID,:valor,'$ip',:pacoteLanceID,:usuarioID,:statusID);");
}
if ($statment->execute($compra->toBD())) {
if ($compra->getCompraID() == null || $compra->getCompraID() <= 0)
$compra->setCompraID($this->conexao->lastInsertId());
return $compra;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro CompraDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro CompraDAO:" . $err->getMessage());
}
}
public function excluir($compraID) {
try {
$statment = $this->conexao->prepare("DELETE FROM compra WHERE compraID = :compraID");
$statment->bindParam(':compraID', $compraID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro CompraDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro CompraDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $pacoteLanceID = -1, $usuarioID = -1, $statusID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($pacoteLanceID, $usuarioID, $statusID);
$compras = array();
$statment = $this->conexao->query("SELECT * FROM compra u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$compra = new CompraBean($row['compraID'], $row['data'], $row['ip'], $row['valor']);
$compra->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$compra->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
$compra->setPacoteLance($this->pacoteLanceDAO->buscarPorID($row['pacoteLanceID']));
}
$compras[] = $compra;
}
return $compras;
} catch (PDOException $err) {
throw new Exception("Erro CompraDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "compraID", $direcao = "ASC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$compras = array();
$statment = $this->conexao->query("SELECT * FROM compra u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$compra = new CompraBean($row['compraID'], $row['data'], $row['ip'], $row['valor']);
$compra->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$compra->setCliente ($this->clienteDAO->buscarPorID($row['usuarioID']));
$compra->setPacoteLance($this->pacoteLanceDAO->buscarPorID($row['pacoteLanceID']));
}
$compras[] = $compra;
}
return $compras;
} catch (PDOException $err) {
throw new Exception("Erro CompraDAO:" . $err->getMessage());
}
}
public function buscarPorID($compraID, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM compra WHERE compraID = $compraID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['compraID']) && $row['compraID'] > 0) {
$compra = new CompraBean($row['compraID'], $row['data'], $row['ip'], $row['valor']);
$compra->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$compra->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
$compra->setPacoteLance($this->pacoteLanceDAO->buscarPorID($row['pacoteLanceID']));
}
return $compra;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro CompraDAO:" . $err->getMessage());
}
}
private function getWhere($pacoteLanceID = -1, $usuarioID = -1, $statusID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($pacoteLanceID) && $pacoteLanceID > 0) {
$where = $where . " AND u.pacoteLanceID = $pacoteLanceID ";
}
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuario = $usuarioID ";
}
if (isset($statusID) && $statusID > 0) {
$where = $where . " AND u.statusID = $statusID ";
}
return $where;
}
public function total($pacoteLanceID = -1, $usuarioID = -1, $statusID = -1) {
try {
$where = $this->getWhere($pacoteLanceID, $usuarioID, $statusID);
$total = $this->conexao->query("SELECT COUNT(u.compraID) total FROM compra u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro CompraDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/CompraDAO.class.php
|
PHP
|
asf20
| 6,355
|
<?php
/**
* Description of InformacaoDAO
*
* @author Magno
*/
class InformacaoDAO {
private $conexao;
private $statusDAO;
private $clienteDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->statusDAO = new StatusDAO();
$this->clienteDAO = new ClienteDAO();
}
public function salvar($informacao) {
try {
if ($informacao->getInformacaoID() != null && $informacao->getInformacaoID() > 0) {
$statment = $this->conexao->prepare("UPDATE informacao SET
descricao = :descricao,
tipo = :tipo,
usuarioID = :usuarioID,
statusID = :statusID
WHERE informacaoID = :informacaoID");
} else {
$statment = $this->conexao->prepare("INSERT INTO informacao(informacaoID,descricao,tipo,usuarioID,statusID)
VALUES (:informacaoID,:descricao,:tipo,:usuarioID:,statusID);");
}
if ($statment->execute($informacao->toBD())) {
if ($informacao->getInformacaoID() == null || $informacao->getInformacaoID() <= 0)
$informacao->setInformacaoID($this->conexao->lastInsertId());
return $informacao;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro InformacaoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro InformacaoDAO:" . $err->getMessage());
}
}
public function excluir($informacaoID) {
try {
$statment = $this->conexao->prepare("DELETE FROM informacao WHERE informacaoID = :informacaoID");
$statment->bindParam(':informacaoID', $informacaoID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro InformacaoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro InformacaoDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $tipo = -1, $usuarioID = -1, $statusID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($tipo, $usuarioID, $statusID);
$informacaos = array();
$statment = $this->conexao->query("SELECT * FROM informacao u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$informacao = new InformacaoBean($row['informacaoID'], $row['descricao'], $row['data'], $row['tipo']);
$informacao->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias)
$informacao->setCliente ($this->clienteDAO->buscarPorID($row['usuarioID']));
$informacaos[] = $informacao;
}
return $informacaos;
} catch (PDOException $err) {
throw new Exception("Erro InformacaoDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "informacaoID", $direcao = "ASC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$informacaos = array();
$statment = $this->conexao->query("SELECT * FROM informacao u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$informacao = new InformacaoBean($row['informacaoID'], $row['descricao'], $row['data'], $row['tipo']);
$informacao->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias)
$informacao->setCliente ($this->clienteDAO->buscarPorID($row['usuarioID']));
$informacaos[] = $informacao;
}
return $informacaos;
} catch (PDOException $err) {
throw new Exception("Erro InformacaoDAO:" . $err->getMessage());
}
}
public function buscarPorID($informacaoID, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM informacao WHERE informacaoID = $informacaoID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['informacaoID']) && $row['informacaoID'] > 0) {
$informacao = new InformacaoBean($row['informacaoID'], $row['descricao'], $row['data'], $row['tipo']);
$informacao->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias)
$informacao->setCliente ($this->clienteDAO->buscarPorID($row['usuarioID']));
return $informacao;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro InformacaoDAO:" . $err->getMessage());
}
}
private function getWhere($tipo = -1, $usuarioID = -1, $statusID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuario = $usuarioID ";
}
if (isset($tipo) && $tipo > 0) {
$where = $where . " AND u.tipo = $tipo ";
}
if (isset($statusID) && $statusID > 0) {
$where = $where . " AND u.statusID = $statusID ";
}
return $where;
}
public function total($tipo = -1, $usuarioID = -1, $statusID = -1) {
try {
$where = $this->getWhere($tipo, $usuarioID, $statusID);
$total = $this->conexao->query("SELECT COUNT(u.informacaoID) total FROM informacao u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro InformacaoDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/InformacaoDAO.class.php
|
PHP
|
asf20
| 6,061
|
<?php
/**
* Description of AdminDAO
*
* @author Magno
*/
class AdminDAO extends UsuarioDAO{
protected $conexao;
protected $mediaDAO;
protected $statusDAO;
private $join = " SELECT * FROM admin a INNER JOIN usuario u ON a.usuarioID = u.usuarioID ";
public function __construct() {
parent::__construct();
$this->conexao = Conexao::getConexao();
}
public function salvar($admin) {
try {
$admin->setUsuario(parent::salvar($admin->getUsuario()));
if($this->existe($admin->getUsuarioID())) {
return $admin;
}else {
$statment = $this->conexao->prepare("INSERT INTO admin(usuarioID) VALUES (".$admin->getUsuarioID().");");
}
if($statment->execute()) {
return $admin;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro AdminDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro AdminDAO:".$err->getMessage());
}
}
public function excluir($usuarioID) {
try {
parent::excluir($usuarioID);
}catch(PDOException $err) {
throw new Exception("Erro AdminDAO:".$err->getMessage());
}
}
public function listar($pagina = 0, $email = "", $login = "", $statusID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = parent::getWhere($email, $login, $statusID);
$admins = array();
$statment = $this->conexao->query( $this->join.$where. " $limite " );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row ) {
$admin = new AdminBean($row['usuarioID'], $row['login'], $row['senha'], $row['email'], $row['ip'], Util::dateTimeToString($row['dataCriacao']));
$admin->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias)
$admin->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
$admins[] = $admin;
}
return $admins;
}catch(PDOException $err) {
throw new Exception("Erro AdminDAO:".$err->getMessage());
}
}
public function buscarPorID($usuarioID, $carregarDependencias = false) {
try {
$row = $this->conexao->query( $this->join." WHERE a.usuarioID = $usuarioID ")->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['usuarioID']) && $row['usuarioID'] > 0) {
$admin = new AdminBean($row['usuarioID'], $row['login'], $row['senha'], $row['email'], $row['ip'], Util::dateTimeToString($row['dataCriacao']));
$admin->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias)
$admin->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
return $admin;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro AdminDAO:".$err->getMessage());
}
}
public function existe($usuarioID){
if($this->buscarPorID($usuarioID) == null)
return false;
return true;
}
public function total($email = "", $login = "", $statusID = -1) {
try {
$where = parent::getWhere($email, $login, $statusID);
$total = $this->conexao->query( " SELECT COUNT(a.usuarioID) FROM admin a INNER JOIN usuario u ON a.usuarioID = u.usuarioID " .$where )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro AdminDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/AdminDAO.class.php
|
PHP
|
asf20
| 3,879
|
<?php
/**
* Description of CategoriaProdutoDAO
*
* @author Magno
*/
class CidadeDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($cidade) {
try {
$estadoDAO = new EstadoDAO();
if($cidade->getEstado()->getEstadoID() == null || $cidade->getEstado()->getEstadoID() <= 0)
$cidade->setEstado($estadoDAO->salvar($cidade->getEstado()));
if($cidade->getCidadeID() != null && $cidade->getCidadeID() > 0) {
$statment = $this->conexao->prepare("UPDATE cidade SET
nome = :nome,
estadoID = :estadoID
WHERE cidadeID = :cidadeID");
}else {
$statment = $this->conexao->prepare("INSERT INTO cidade(cidadeID,nome,estadoID) VALUES (:cidadeID,:nome,:estadoID);");
}
if($statment->execute($cidade->toBD())) {
if($cidade->getCidadeID() == null || $cidade->getCidadeID() <= 0)
$cidade->setCidadeID($this->conexao->lastInsertId());
return $cidade;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro CidadeDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro CidadeDAO:".$err->getMessage());
}
}
public function excluir($cidadeID) {
try {
$statment = $this->conexao->prepare("DELETE FROM cidade WHERE cidadeID = :cidadeID");
$statment->bindParam(':cidadeID',$cidadeID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro CidadeDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro CidadeDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$nome = "", $estadoID = 0) {
try {
$estadoDAO = new EstadoDAO();
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($nome,$estadoID);
$cidades = array();
$statment = $this->conexao->query( "SELECT * FROM cidade c $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row ) {
$cidade = new CidadeBean($row['cidadeID'], $row['nome']);
$cidade->setEstado($estadoDAO->buscarPorID($row['estadoID']));
$cidades[] = $cidade;
}
return $cidades;
}catch(PDOException $err) {
throw new Exception("Erro CidadeDAO:".$err->getMessage());
}
}
public function buscarPorID($cidadeID) {
try {
$estadoDAO = new EstadoDAO();
$row = $this->conexao->query("SELECT * FROM cidade WHERE cidadeID = $cidadeID ")->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['cidadeID']) && $row['cidadeID'] > 0) {
$cidade = new CidadeBean($row['cidadeID'], $row['nome']);
$cidade->setEstado($estadoDAO->buscarPorID($row['estadoID']));
return $cidade;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro CidadeDAO:".$err->getMessage());
}
}
public function buscarPorSiglaEstadoENome($siglaEstado, $nome) {
try {
$estadoDAO = new EstadoDAO();
$row = $this->conexao->query("SELECT c.* FROM estado e INNER JOIN cidade c
on c.estadoID = e.estadoID WHERE e.sigla = '$siglaEstado' AND c.nome = '$nome'")->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['cidadeID']) && $row['cidadeID'] > 0) {
$cidade = new CidadeBean($row['cidadeID'], $row['nome']);
$cidade->setEstado($estadoDAO->buscarPorID($row['estadoID']));
return $cidade;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro CidadeDAO:".$err->getMessage());
}
}
private function getWhere($nome="",$estadoID = 0) {
$where = " WHERE 1 = 1 ";
if (isset ($nome) && strlen($nome) > 0) {
$where = $where." AND c.nome = '$nome' ";
}
if (isset ($estadoID) && $estadoID > 0) {
$where = $where." AND c.estadoID = $estadoID ";
}
return $where;
}
public function total($nome = "",$estadoID = 0) {
try {
$where = $this->getWhere($nome);
$total = $this->conexao->query( "SELECT COUNT(c.cidadeID) total FROM cidade c $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro CidadeDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/CidadeDAO.class.php
|
PHP
|
asf20
| 5,188
|
<?php
/**
* Description of MediaProdutoDAO
*
* @author Magno
*/
class MediaProdutoDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($mediaProduto) {
try {
if($mediaProduto->getMediaProdutoID() != null && $mediaProduto->getMediaProdutoID() > 0) {
$statment = $this->conexao->prepare("UPDATE mediaProduto SET
caminho = :caminho,
produtoID = :produtoID
WHERE mediaProdutoID = :mediaProdutoID");
}else {
$statment = $this->conexao->prepare("INSERT INTO mediaProduto(mediaProdutoID,caminho,produtoID) VALUES (:mediaProdutoID,:caminho,:produtoID);");
}
if($statment->execute($mediaProduto->toBD())) {
if($mediaProduto->getMediaProdutoID() == null || $mediaProduto->getMediaProdutoID() <= 0)
$mediaProduto->setMediaProdutoID($this->conexao->lastInsertId());
return $mediaProduto;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro MediaProdutoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro MediaProdutoDAO:".$err->getMessage());
}
}
public function excluir($mediaProdutoID) {
try {
$statment = $this->conexao->prepare("DELETE FROM mediaProduto WHERE mediaProdutoID = :mediaProdutoID");
$statment->bindParam(':mediaProdutoID',$mediaProdutoID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro MediaProdutoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro MediaProdutoDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$caminho = "", $produtoID = 0, $carregarDependencias = false) {
try {
$produtoDAO = new ProdutoDAO();
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($caminho,$produtoID);
$mediaProdutos = array();
$statment = $this->conexao->query( "SELECT * FROM mediaProduto c $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row ) {
$mediaProduto = new MediaProdutoBean($row['mediaProdutoID'], $row['caminho']);
if($carregarDependencias)
$mediaProduto->setProduto($produtoDAO->buscarPorID($row['produtoID']));
$mediaProdutos[] = $mediaProduto;
}
return $mediaProdutos;
}catch(PDOException $err) {
throw new Exception("Erro MediaProdutoDAO:".$err->getMessage());
}
}
public function buscarPorID($mediaProdutoID, $carregarDependencias = false) {
try {
$produtoDAO = new ProdutoDAO();
$row = $this->conexao->query("SELECT * FROM mediaProduto WHERE mediaProdutoID = $mediaProdutoID ")->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['mediaProdutoID']) && $row['mediaProdutoID'] > 0) {
$mediaProduto = new MediaProdutoBean($row['mediaProdutoID'], $row['caminho']);
if($carregarDependencias)
$mediaProduto->setProduto($produtoDAO->buscarPorID($row['produtoID']));
return $mediaProduto;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro MediaProdutoDAO:".$err->getMessage());
}
}
private function getWhere($caminho="",$produtoID = 0) {
$where = " WHERE 1 = 1 ";
if (isset ($caminho) && strlen($caminho) > 0) {
$where = $where." AND c.caminho = '$caminho' ";
}
if (isset ($produtoID) && $produtoID > 0) {
$where = $where." AND c.produtoID = $produtoID ";
}
return $where;
}
public function total($caminho = "",$produtoID = 0) {
try {
$where = $this->getWhere($caminho);
$total = $this->conexao->query( "SELECT COUNT(c.mediaProdutoID) total FROM mediaProduto c $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro MediaProdutoDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/MediaProdutoDAO.class.php
|
PHP
|
asf20
| 4,515
|
<?php
/**
* Description of ClienteBonusDAO
*
* @author Magno
*/
class ClienteBonusDAO {
private $conexao;
private $bonusDAO;
private $clienteDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->bonusDAO = new BonusDAO();
$this->clienteDAO = new ClienteDAO();
}
public function salvar($clienteBonus) {
try {
if ($this->existe($clienteBonus->getBonus()->getBonusID(), $clienteBonus->getCliente()->getUsuarioID())) {
$statment = $this->conexao->prepare("UPDATE clienteBonus SET
valor = :valor,
inicio = :inicio,
fim = :fim
WHERE bonusID = :bonusID AND
usuarioID = :usuarioID");
} else {
$statment = $this->conexao->prepare("INSERT INTO clienteBonus(bonusID,usuarioID,valor,inicio,fim)
VALUES (:bonusID,:usuarioID,:valor,:inicio,:fim);");
}
if ($statment->execute($clienteBonus->toBD())) {
if ($clienteBonus->getClienteBonusID() == null || $clienteBonus->getClienteBonusID() <= 0)
$clienteBonus->setClienteBonusID($this->conexao->lastInsertId());
return $clienteBonus;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro ClienteBonusDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro ClienteBonusDAO:" . $err->getMessage());
}
}
public function excluir($bonusID, $usuarioID) {
try {
$statment = $this->conexao->prepare("DELETE FROM clienteBonus WHERE bonusID = :bonusID AND usuarioID = :usuarioID");
$statment->bindParam(':bonusID', $bonusID);
$statment->bindParam(':usuarioID', $usuarioID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro ClienteBonusDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro ClienteBonusDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $bonusID = -1, $usuarioID = -1, $inicio = "", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($bonusID, $usuarioID, $inicio);
$clienteBonuss = array();
$statment = $this->conexao->query("SELECT * FROM clienteBonus u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$clienteBonus = new ClienteBonusBean(null, null, $row['valor'], $row['inicio'], $row['fim']);
if($carregarDependencias){
$clienteBonus->setBonus($this->bonusDAO->buscarPorID($row['bonusID']));
$clienteBonus->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
}
$clienteBonuss[] = $clienteBonus;
}
return $clienteBonuss;
} catch (PDOException $err) {
throw new Exception("Erro ClienteBonusDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "bonusID", $direcao = "ASC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$clienteBonuss = array();
$statment = $this->conexao->query("SELECT * FROM clienteBonus u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$clienteBonus = new ClienteBonusBean(null, null, $row['valor'], $row['inicio'], $row['fim']);
if($carregarDependencias){
$clienteBonus->setBonus($this->bonusDAO->buscarPorID($row['bonusID']));
$clienteBonus->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
}
$clienteBonuss[] = $clienteBonus;
}
return $clienteBonuss;
} catch (PDOException $err) {
throw new Exception("Erro ClienteBonusDAO:" . $err->getMessage());
}
}
public function buscarPorID($bonusID = -1, $usuarioID = -1, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM clienteBonus bonusID = $bonusID AND usuarioID = $usuarioID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['clienteBonusID']) && $row['clienteBonusID'] > 0) {
$clienteBonus = new ClienteBonusBean(null, null, $row['valor'], $row['inicio'], $row['fim']);
if($carregarDependencias){
$clienteBonus->setBonus($this->bonusDAO->buscarPorID($row['bonusID']));
$clienteBonus->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
}
return $clienteBonus;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro ClienteBonusDAO:" . $err->getMessage());
}
}
private function getWhere($bonusID = -1, $usuarioID = -1, $inicio = "") {
$where = " WHERE 1 = 1 ";
if (isset($bonusID) && $bonusID > 0) {
$where = $where . " AND u.bonusID = $bonusID ";
}
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuarioID = $usuarioID ";
}
if (isset($inicio) && strlen($inicio) > 0) {
$where = $where . " AND u.inicio = '$inicio' ";
}
return $where;
}
public function total($bonusID = -1, $usuarioID = -1, $inicio = "") {
try {
$where = $this->getWhere($bonusID, $usuarioID, $inicio);
$total = $this->conexao->query("SELECT COUNT(u.clienteBonusID) total FROM clienteBonus u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro ClienteBonusDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/ClienteBonusDAO.class.php
|
PHP
|
asf20
| 6,289
|
<?php
/**
* Description of UsuarioDAO
*
* @author Magno
*/
class UsuarioDAO {
protected $conexao;
protected $mediaDAO;
protected $statusDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->mediaDAO = new MediaDAO();
$this->statusDAO = new StatusDAO();
}
public function salvar($usuario) {
try {
if($usuario->getUsuarioID() <= 0 || stripos($usuario->getMedia()->getCaminho(), "Default") === FALSE){
$usuario->setMedia($this->mediaDAO->salvar($usuario->getMedia()));
}
if ($usuario->getUsuarioID() != null && $usuario->getUsuarioID() > 0) {
$statment = $this->conexao->prepare("UPDATE usuario SET
login = :login,
senha = :senha,
email = :email,
mediaID = :mediaID,
statusID = :statusID
WHERE usuarioID = :usuarioID");
} else {
$ip = $_SERVER['REMOTE_ADDR'];
$statment = $this->conexao->prepare("INSERT INTO usuario(usuarioID,login,senha,email,ip,mediaID,statusID)
VALUES (:usuarioID,:login,:senha,:email,'$ip',:mediaID,:statusID);");
}
if ($statment->execute($usuario->toBD())) {
if ($usuario->getUsuarioID() == null || $usuario->getUsuarioID() <= 0)
$usuario->setUsuarioID($this->conexao->lastInsertId());
return $usuario;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro UsuarioDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro UsuarioDAO:" . $err->getMessage());
}
}
public function excluir($usuarioID) {
try {
$statment = $this->conexao->prepare("DELETE FROM usuario WHERE usuarioID = :usuarioID");
$statment->bindParam(':usuarioID', $usuarioID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro UsuarioDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro UsuarioDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $email = "", $login = "", $statusID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($email, $login, $statusID);
$usuarios = array();
$statment = $this->conexao->query("SELECT * FROM usuario u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$usuario = new UsuarioBean($row['usuarioID'], $row['login'], $row['senha'], $row['email'], $row['ip'], Util::dateToString($row['dataCriacao']));
$usuario->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias)
$usuario->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
$usuarios[] = $usuario;
}
return $usuarios;
} catch (PDOException $err) {
throw new Exception("Erro UsuarioDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "usuarioID", $direcao = "ASC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$usuarios = array();
$statment = $this->conexao->query("SELECT * FROM usuario u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$usuario = new UsuarioBean($row['usuarioID'], $row['login'], $row['senha'], $row['email'], $row['ip'], Util::dateToString($row['dataCriacao']));
$usuario->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias)
$usuario->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
$usuarios[] = $usuario;
}
return $usuarios;
} catch (PDOException $err) {
throw new Exception("Erro UsuarioDAO:" . $err->getMessage());
}
}
public function buscarPorID($usuarioID, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM usuario WHERE usuarioID = $usuarioID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['usuarioID']) && $row['usuarioID'] > 0) {
$usuario = new UsuarioBean($row['usuarioID'], $row['login'], $row['senha'], $row['email'], $row['ip'], Util::dateToString($row['dataCriacao']));
$usuario->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias)
$usuario->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
return $usuario;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro UsuarioDAO:" . $err->getMessage());
}
}
protected function getWhere($email = "", $login = "",$statusID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($email) && strlen($email) > 0) {
$where = $where . " AND u.email like '%$email%' ";
}
if (isset($login) && strlen($login) > 0) {
$where = $where . " AND u.login = '$login' ";
}
if (isset($statusID) && $statusID > 0) {
$where = $where . " AND u.statusID = $statusID ";
}
return $where;
}
public function total($email = "", $login = "",$statusID = -1) {
try {
$where = $this->getWhere($email, $login, $statusID);
$total = $this->conexao->query("SELECT COUNT(u.usuarioID) total FROM usuario u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro UsuarioDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/UsuarioDAO.class.php
|
PHP
|
asf20
| 6,605
|
<?php
/**
* Description of PessoaDAO
*
* @author Magno
*/
class EstadoDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($estado) {
try {
if($estado->getEstadoID() != null && $estado->getEstadoID() > 0) {
$statment = $this->conexao->prepare("UPDATE estado SET
nome = :nome,
sigla = :sigla
WHERE estadoID = :estadoID");
}else {
$statment = $this->conexao->prepare("INSERT INTO estado(estadoID,nome,sigla) VALUES (:estadoID,:nome,:sigla);");
}
if($statment->execute($estado->toBD())) {
if($estado->getEstadoID() == null || $estado->getEstadoID() <= 0)
$estado->setEstadoID($this->conexao->lastInsertId());
return $estado;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro EstadoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro EstadoDAO:".$err->getMessage());
}
}
public function excluir($estadoID) {
try {
$statment = $this->conexao->prepare("DELETE FROM estado WHERE estadoID = :estadoID");
$statment->bindParam(':estadoID',$estadoID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro EstadoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro EstadoDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$nome = "",$sigla = "") {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($nome,$sigla);
$estados = array();
$statment = $this->conexao->query( "SELECT * FROM estado e $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row )
$estados[] = new EstadoBean($row['estadoID'], $row['nome'], $row['sigla']);
return $estados;
}catch(PDOException $err) {
throw new Exception("Erro EstadoDAO:".$err->getMessage());
}
}
public function buscarPorID($estadoID) {
try {
$row = $this->conexao->query( "SELECT * FROM estado WHERE estadoID = $estadoID " )->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['estadoID']) && $row['estadoID'] > 0) {
$estado = new EstadoBean($row['estadoID'], $row['nome'], $row['sigla']);
return $estado;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro EstadoDAO:".$err->getMessage());
}
}
public function buscarPorSigla($sigla) {
try {
$row = $this->conexao->query( "SELECT * FROM estado WHERE sigla = '$sigla' " )->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['estadoID']) && $row['estadoID'] > 0) {
$estado = new EstadoBean($row['estadoID'], $row['nome'], $row['sigla']);
return $estado;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro EstadoDAO:".$err->getMessage());
}
}
private function getWhere($nome = "", $sigla = "") {
$where = " WHERE 1 = 1 ";
if (isset ($nome) && strlen($nome) > 0) {
$where = $where." AND e.nome = '$nome' ";
}
if (isset ($sigla) && strlen($sigla) > 0) {
$where = $where." AND e.sigla = '$sigla' ";
}
return $where;
}
public function total($nome = "",$sigla = "") {
try {
$where = $this->getWhere($nome,$sigla);
$total = $this->conexao->query( "SELECT COUNT(e.estadoID) total FROM estado e $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro EstadoDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/EstadoDAO.class.php
|
PHP
|
asf20
| 4,379
|
<?php
/**
* Description of PessoaDAO
*
* @author Magno
*/
class PacoteLanceDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($pacoteLance) {
try {
if($pacoteLance->getPacoteLanceID() != null && $pacoteLance->getPacoteLanceID() > 0) {
$statment = $this->conexao->prepare("UPDATE pacoteLance SET
quantidade = :quantidade,
valor = :valor
WHERE pacoteLanceID = :pacoteLanceID");
}else {
$statment = $this->conexao->prepare("INSERT INTO pacoteLance(pacoteLanceID,quantidade,valor) VALUES (:pacoteLanceID,:quantidade,:valor);");
}
if($statment->execute($pacoteLance->toBD())) {
if($pacoteLance->getPacoteLanceID() == null || $pacoteLance->getPacoteLanceID() <= 0)
$pacoteLance->setPacoteLanceID($this->conexao->lastInsertId());
return $pacoteLance;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro PacoteLanceDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro PacoteLanceDAO:".$err->getMessage());
}
}
public function excluir($pacoteLanceID) {
try {
$statment = $this->conexao->prepare("DELETE FROM pacoteLance WHERE pacoteLanceID = :pacoteLanceID");
$statment->bindParam(':pacoteLanceID',$pacoteLanceID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro PacoteLanceDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro PacoteLanceDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$quantidade = -1, $valor = -1) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($quantidade, $valor);
$pacoteLances = array();
$statment = $this->conexao->query( "SELECT * FROM pacoteLance e $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row )
$pacoteLances[] = new PacoteLanceBean($row['pacoteLanceID'], $row['quantidade'], $row['valor']);
return $pacoteLances;
}catch(PDOException $err) {
throw new Exception("Erro PacoteLanceDAO:".$err->getMessage());
}
}
public function buscarPorID($pacoteLanceID) {
try {
$row = $this->conexao->query( "SELECT * FROM pacoteLance WHERE pacoteLanceID = $pacoteLanceID " )->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['pacoteLanceID']) && $row['pacoteLanceID'] > 0) {
$pacoteLance = new PacoteLanceBean($row['pacoteLanceID'], $row['quantidade'], $row['valor']);
return $pacoteLance;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro PacoteLanceDAO:".$err->getMessage());
}
}
private function getWhere($quantidade = -1) {
$where = " WHERE 1 = 1 ";
if (isset ($quantidade) && $quantidade > 0) {
$where = $where." AND e.quantidade = $quantidade ";
}
return $where;
}
public function total($quantidade = -1, $valor = -1) {
try {
$where = $this->getWhere($quantidade, $valor);
$total = $this->conexao->query( "SELECT COUNT(e.pacoteLanceID) total FROM pacoteLance e $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro PacoteLanceDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/PacoteLanceDAO.class.php
|
PHP
|
asf20
| 3,877
|
<?php
/**
* Description of DepoimentoDAO
*
* @author Magno
*/
class DepoimentoDAO {
private $conexao;
private $statusDAO;
private $clienteDAO;
private $mediaDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->statusDAO = new StatusDAO();
$this->clienteDAO = new ClienteDAO();
$this->mediaDAO = new MediaDAO();
}
public function salvar($depoimento) {
try {
if ($depoimento->getDepoimentoID() != null && $depoimento->getDepoimentoID() > 0) {
$statment = $this->conexao->prepare("UPDATE depoimento SET
descricao = :descricao,
mediaID = :mediaID,
usuarioID = :usuarioID,
statusID = :statusID
WHERE depoimentoID = :depoimentoID");
} else {
$statment = $this->conexao->prepare("INSERT INTO depoimento(depoimentoID,descricao,mediaID,usuarioID,statusID)
VALUES (:depoimentoID,:descricao,:mediaID,:usuarioID,:statusID);");
}
if ($statment->execute($depoimento->toBD())) {
if ($depoimento->getDepoimentoID() == null || $depoimento->getDepoimentoID() <= 0)
$depoimento->setDepoimentoID($this->conexao->lastInsertId());
return $depoimento;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro DepoimentoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro DepoimentoDAO:" . $err->getMessage());
}
}
public function excluir($depoimentoID) {
try {
$statment = $this->conexao->prepare("DELETE FROM depoimento WHERE depoimentoID = :depoimentoID");
$statment->bindParam(':depoimentoID', $depoimentoID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro DepoimentoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro DepoimentoDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $usuarioID = -1, $statusID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($usuarioID, $statusID);
$depoimentos = array();
$statment = $this->conexao->query("SELECT * FROM depoimento u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$depoimento = new DepoimentoBean($row['depoimentoID'], $row['descricao'], $row['data']);
$depoimento->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$depoimento->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
if(isset ($row['mediaID']) && $row['mediaID'] > 0)
$depoimento->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
}
$depoimentos[] = $depoimento;
}
return $depoimentos;
} catch (PDOException $err) {
throw new Exception("Erro DepoimentoDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "depoimentoID", $direcao = "ASC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$depoimentos = array();
$statment = $this->conexao->query("SELECT * FROM depoimento u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$depoimento = new DepoimentoBean($row['depoimentoID'], $row['descricao'], $row['data']);
$depoimento->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$depoimento->setCliente ($this->clienteDAO->buscarPorID($row['usuarioID']));
if(isset ($row['mediaID']) && $row['mediaID'] > 0)
$depoimento->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
}
$depoimentos[] = $depoimento;
}
return $depoimentos;
} catch (PDOException $err) {
throw new Exception("Erro DepoimentoDAO:" . $err->getMessage());
}
}
public function buscarPorID($depoimentoID, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM depoimento WHERE depoimentoID = $depoimentoID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['depoimentoID']) && $row['depoimentoID'] > 0) {
$depoimento = new DepoimentoBean($row['depoimentoID'], $row['descricao'], $row['data']);
$depoimento->setStatus($this->statusDAO->buscarPorID($row['statusID']));
if($carregarDependencias){
$depoimento->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
if(isset ($row['mediaID']) && $row['mediaID'] > 0)
$depoimento->setMedia($this->mediaDAO->buscarPorID($row['mediaID']));
}
return $depoimento;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro DepoimentoDAO:" . $err->getMessage());
}
}
private function getWhere($usuarioID = -1, $statusID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuario = $usuarioID ";
}
if (isset($statusID) && $statusID > 0) {
$where = $where . " AND u.statusID = $statusID ";
}
return $where;
}
public function total($usuarioID = -1, $statusID = -1) {
try {
$where = $this->getWhere($usuarioID, $statusID);
$total = $this->conexao->query("SELECT COUNT(u.depoimentoID) total FROM depoimento u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro DepoimentoDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/DepoimentoDAO.class.php
|
PHP
|
asf20
| 6,474
|
<?php
/**
* Description of CategoriaProdutoDAO
*
* @author Magno
*/
class CategoriaProdutoDAO {
private $conexao;
public function __construct() {
$this->conexao = Conexao::getConexao();
}
public function salvar($categoriaProduto) {
try {
if($categoriaProduto->getCategoriaProdutoID() != null && $categoriaProduto->getCategoriaProdutoID() > 0) {
$statment = $this->conexao->prepare("UPDATE categoriaProduto SET
descricao = :descricao
WHERE categoriaProdutoID = :categoriaProdutoID");
}else {
$statment = $this->conexao->prepare("INSERT INTO categoriaProduto(categoriaProdutoID,descricao) VALUES (:categoriaProdutoID,:descricao);");
}
if($statment->execute($categoriaProduto->toBD())) {
if($categoriaProduto->getCategoriaProdutoID() == null || $categoriaProduto->getCategoriaProdutoID() <= 0)
$categoriaProduto->setCategoriaProdutoID($this->conexao->lastInsertId());
return $categoriaProduto;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro CategoriaProdutoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro CategoriaProdutoDAO:".$err->getMessage());
}
}
public function excluir($categoriaProdutoID) {
try {
$statment = $this->conexao->prepare("DELETE FROM categoriaProduto WHERE categoriaProdutoID = :categoriaProdutoID");
$statment->bindParam(':categoriaProdutoID',$categoriaProdutoID);
if(!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro CategoriaProdutoDAO: ".$erros[2]);
}
}catch(PDOException $err) {
throw new Exception("Erro CategoriaProdutoDAO:".$err->getMessage());
}
}
public function listar($pagina = 0,$descricao = "") {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($descricao);
$categoriaProdutos = array();
$statment = $this->conexao->query( "SELECT * FROM categoriaProduto e $where $limite" );
foreach ( $statment->fetchAll(PDO::FETCH_SERIALIZE) as $row )
$categoriaProdutos[] = new CategoriaProdutoBean($row['categoriaProdutoID'], $row['descricao'], $row['sigla']);
return $categoriaProdutos;
}catch(PDOException $err) {
throw new Exception("Erro CategoriaProdutoDAO:".$err->getMessage());
}
}
public function buscarPorID($categoriaProdutoID) {
try {
$row = $this->conexao->query( "SELECT * FROM categoriaProduto WHERE categoriaProdutoID = $categoriaProdutoID " )->fetch(PDO::FETCH_SERIALIZE);
if(isset($row['categoriaProdutoID']) && $row['categoriaProdutoID'] > 0) {
$categoriaProduto = new CategoriaProdutoBean($row['categoriaProdutoID'], $row['descricao'], $row['sigla']);
return $categoriaProduto;
}else {
return null;
}
}catch(PDOException $err) {
throw new Exception("Erro CategoriaProdutoDAO:".$err->getMessage());
}
}
private function getWhere($descricao = "") {
$where = " WHERE 1 = 1 ";
if (isset ($descricao) && strlen($descricao) > 0) {
$where = $where." AND e.descricao = '$descricao' ";
}
return $where;
}
public function total($descricao = "") {
try {
$where = $this->getWhere($descricao);
$total = $this->conexao->query( "SELECT COUNT(e.categoriaProdutoID) total FROM categoriaProduto e $where" )->fetch(PDO::FETCH_COLUMN);
return $total;
}catch(PDOException $err) {
throw new Exception("Erro CategoriaProdutoDAO:".$err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/CategoriaProdutoDAO.class.php
|
PHP
|
asf20
| 4,042
|
<?php
/**
* Description of EnqueteDAO
*
* @author Magno
*/
class EnqueteDAO {
private $conexao;
private $statusDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->statusDAO = new StatusDAO();
}
public function salvar($enquete) {
try {
if ($enquete->getEnqueteID() != null && $enquete->getEnqueteID() > 0) {
$statment = $this->conexao->prepare("UPDATE enquete SET
descricao = :descricao,
fim = :fim,
statusID = :statusID
WHERE enqueteID = :enqueteID");
} else {
$statment = $this->conexao->prepare("INSERT INTO enquete(enqueteID,descricao,fim,statusID)
VALUES (:enqueteID,:descricao,:fim,:statusID);");
}
if ($statment->execute($enquete->toBD())) {
if ($enquete->getEnqueteID() == null || $enquete->getEnqueteID() <= 0)
$enquete->setEnqueteID($this->conexao->lastInsertId());
return $enquete;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro EnqueteDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro EnqueteDAO:" . $err->getMessage());
}
}
public function excluir($enqueteID) {
try {
$statment = $this->conexao->prepare("DELETE FROM enquete WHERE enqueteID = :enqueteID");
$statment->bindParam(':enqueteID', $enqueteID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro EnqueteDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro EnqueteDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $inicio = "", $descricao = "", $statusID = -1) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($inicio, $descricao, $statusID);
$enquetes = array();
$statment = $this->conexao->query("SELECT * FROM enquete u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$enquete = new EnqueteBean($row['enqueteID'], $row['descricao'], Util::dateTimeToString($row['inicio']), Util::dateTimeToString($row['fim']));
$enquete->setStatus($this->statusDAO->buscarPorID($row['statusID']));
$enquetes[] = $enquete;
}
return $enquetes;
} catch (PDOException $err) {
throw new Exception("Erro EnqueteDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "enqueteID", $direcao = "DESC") {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$enquetes = array();
$statment = $this->conexao->query("SELECT * FROM enquete u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$enquete = new EnqueteBean($row['enqueteID'], $row['descricao'], Util::dateTimeToString($row['inicio']), Util::dateTimeToString($row['fim']));
$enquete->setStatus($this->statusDAO->buscarPorID($row['statusID']));
$enquetes[] = $enquete;
}
return $enquetes;
} catch (PDOException $err) {
throw new Exception("Erro EnqueteDAO:" . $err->getMessage());
}
}
public function buscarPorID($enqueteID) {
try {
$row = $this->conexao->query("SELECT * FROM enquete WHERE enqueteID = $enqueteID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['enqueteID']) && $row['enqueteID'] > 0) {
$enquete = new EnqueteBean($row['enqueteID'], $row['descricao'], Util::dateTimeToString($row['inicio']), Util::dateTimeToString($row['fim']));
$enquete->setStatus($this->statusDAO->buscarPorID($row['statusID']));
return $enquete;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro EnqueteDAO:" . $err->getMessage());
}
}
private function getWhere($inicio = "", $descricao = "",$statusID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($inicio) && strlen($inicio) > 0) {
$where = $where . " AND u.inicio = '$inicio' ";
}
if (isset($descricao) && strlen($descricao) > 0) {
$where = $where . " AND u.descricao like '%$descricao%' ";
}
if (isset($statusID) && $statusID > 0) {
$where = $where . " AND u.statusID = $statusID ";
}
return $where;
}
public function total($inicio = "", $descricao = "",$statusID = -1) {
try {
$where = $this->getWhere($inicio, $descricao, $statusID);
$total = $this->conexao->query("SELECT COUNT(u.enqueteID) total FROM enquete u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro EnqueteDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/EnqueteDAO.class.php
|
PHP
|
asf20
| 5,376
|
<?php
/**
* Description of VotoDAO
*
* @author Magno
*/
class VotoDAO {
private $conexao;
private $enqueteDAO;
private $clienteDAO;
private $respostaDAO;
public function __construct() {
$this->conexao = Conexao::getConexao();
$this->enqueteDAO = new EnqueteDAO();
$this->clienteDAO = new ClienteDAO();
$this->respostaDAO = new RespostaDAO();
}
public function salvar($voto) {
try {
if ($this->existe($voto->getEnquete()->getEnqueteID(), $voto->getCliente()->getUsuarioID())) {
$statment = $this->conexao->prepare("UPDATE voto SET
repostaID = :repostaID
WHERE enqueteID = :enqueteID AND
usuarioID = :usuarioID");
} else {
$statment = $this->conexao->prepare("INSERT INTO voto(enqueteID,usuarioID,respostaID)
VALUES (:enqueteID,:usuarioID,:respostaID);");
}
if ($statment->execute($voto->toBD())) {
if ($voto->getVotoID() == null || $voto->getVotoID() <= 0)
$voto->setVotoID($this->conexao->lastInsertId());
return $voto;
}else {
$erros = $statment->errorInfo();
throw new Exception("Erro VotoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro VotoDAO:" . $err->getMessage());
}
}
public function excluir($enqueteID, $usuarioID) {
try {
$statment = $this->conexao->prepare("DELETE FROM voto WHERE enqueteID = :enqueteID AND usuarioID = :usuarioID");
$statment->bindParam(':enqueteID', $enqueteID);
$statment->bindParam(':usuarioID', $usuarioID);
if (!$statment->execute()) {
$erros = $statment->errorInfo();
throw new Exception("Erro VotoDAO: " . $erros[2]);
}
} catch (PDOException $err) {
throw new Exception("Erro VotoDAO:" . $err->getMessage());
}
}
public function listar($pagina = 0, $enqueteID = -1, $usuarioID = -1, $respostaID = -1, $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina);
$where = $this->getWhere($enqueteID, $usuarioID, $respostaID);
$votos = array();
$statment = $this->conexao->query("SELECT * FROM voto u $where $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$voto = new VotoBean(null, null, null, $row['data']);
if($carregarDependencias){
$voto->setEnquete($this->enqueteDAO->buscarPorID($row['enqueteID']));
$voto->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
$voto->setResposta($this->respostaDAO->buscarPorID($row['respostaID']));
}
$votos[] = $voto;
}
return $votos;
} catch (PDOException $err) {
throw new Exception("Erro VotoDAO:" . $err->getMessage());
}
}
public function listarPorOrdem($pagina = 0, $tamanho = 0, $ordem = "respostaID", $direcao = "ASC", $carregarDependencias = false) {
try {
$limite = Util::getPaginacao($pagina,$tamanho);
$votos = array();
$statment = $this->conexao->query("SELECT * FROM voto u ORDER BY u.$ordem $direcao $limite");
foreach ($statment->fetchAll(PDO::FETCH_SERIALIZE) as $row){
$voto = new VotoBean(null, null, null, $row['data']);
if($carregarDependencias){
$voto->setEnquete($this->enqueteDAO->buscarPorID($row['enqueteID']));
$voto->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
$voto->setResposta($this->respostaDAO->buscarPorID($row['respostaID']));
}
$votos[] = $voto;
}
return $votos;
} catch (PDOException $err) {
throw new Exception("Erro VotoDAO:" . $err->getMessage());
}
}
public function buscarPorID($enqueteID = -1, $usuarioID = -1, $carregarDependencias = false) {
try {
$row = $this->conexao->query("SELECT * FROM voto enqueteID = $enqueteID AND usuarioID = $usuarioID ")->fetch(PDO::FETCH_SERIALIZE);
if (isset ($row['votoID']) && $row['votoID'] > 0) {
$voto = new VotoBean(null, null, null, $row['data']);
if($carregarDependencias){
$voto->setEnquete($this->enqueteDAO->buscarPorID($row['enqueteID']));
$voto->setCliente($this->clienteDAO->buscarPorID($row['usuarioID']));
$voto->setResposta($this->respostaDAO->buscarPorID($row['respostaID']));
}
return $voto;
} else {
return null;
}
} catch (PDOException $err) {
throw new Exception("Erro VotoDAO:" . $err->getMessage());
}
}
public function existe($enqueteID = -1, $usuarioID = -1){
if($this->buscarPorID($enqueteID, $usuarioID) != null)
return true;
return false;
}
private function getWhere($enqueteID = -1, $usuarioID = -1, $respostaID = -1) {
$where = " WHERE 1 = 1 ";
if (isset($enqueteID) && $enqueteID > 0) {
$where = $where . " AND u.enqueteID = $enqueteID ";
}
if (isset($usuarioID) && $usuarioID > 0) {
$where = $where . " AND u.usuarioID = $usuarioID ";
}
if (isset($respostaID) && $respostaID > 0) {
$where = $where . " AND u.respostaID = $respostaID ";
}
return $where;
}
public function total($enqueteID = -1, $usuarioID = -1, $respostaID = -1) {
try {
$where = $this->getWhere($enqueteID, $usuarioID, $respostaID);
$total = $this->conexao->query("SELECT COUNT(u.votoID) total FROM voto u $where")->fetch(PDO::FETCH_COLUMN);
return $total;
} catch (PDOException $err) {
throw new Exception("Erro VotoDAO:" . $err->getMessage());
}
}
}
?>
|
0a1b2c3d4e5
|
trunk/leilao/dao/VotoDAO.class.php
|
PHP
|
asf20
| 6,332
|
<?php
?>
|
0a1b2c3d4e5
|
trunk/leilao/index2.php
|
PHP
|
asf20
| 9
|
/**
* The accessibleList plugin provides two transformations to improve lists display:
* - truncate list to a given length, and add a 'more' button to reveal the whole list
* - paginate long lists so they are easier to read
* Each effect can be used without the other, or simultaneously
*/
(function($)
{
/**
* Add controls to a list
*/
$.fn.accessibleList = function(options)
{
var settings = $.extend({}, $.fn.accessibleList.defaults, options);
var inited = false;
this.each(function(i)
{
var list = $(this);
var lines = list.children();
var listNode = list;
var currentPage;
var pagination = false;
// Detect lag in rendering (IE...)
if (list.height() == 0)
{
setTimeout(function() { list.accessibleList(options); }, 20);
return;
}
// Setup
list.css('overflow', 'hidden').addClass('relative');
var listHeight = list.height();
if (settings.pageSize && lines.length > settings.pageSize)
{
var nbPages = Math.max(1, Math.ceil(lines.length/settings.pageSize));
currentPage = Math.max(1, Math.min(nbPages, settings.startPage));
// Setup pages
var width = list.width();
list.width(width);
var linePage = 0;
var lineRow = 0;
var height = 0;
listHeight = 0;
lines.addClass('absolute').css({
width: (width-parseInt(lines.css('padding-left'))-parseInt(lines.css('padding-right')))+'px',
overflow: 'hidden',
textOverflow: 'ellipsis'
}).each(function(i)
{
var line = $(this);
line.css('top', height+'px').css('left', (linePage*100)+'%');
height += line.outerHeight();
++lineRow;
if (lineRow == settings.pageSize)
{
// Detect listHeight
if (height > listHeight)
{
listHeight = height;
}
++linePage;
lineRow = 0;
height = 0;
}
else
{
height += parseInt(line.css('margin-bottom'));
}
}).attr('scrollLeft', (currentPage-1)*width);
list.height(listHeight);
// Create pagination
pagination = listNode.after('<ul class="small-pagination"></ul>').next();
for (number = 0; number < nbPages; ++number)
{
pagination.append(' <li><a href="#" title="Page '+(number+1)+'">'+(number+1)+'</a></li>');
}
var links = pagination.find('a');
links.click(function(event)
{
// Stop link action
event.preventDefault();
var element = $(this);
// Page number
currentPage = parseInt(element.text());
if (isNaN(currentPage))
{
currentPage = 1;
}
// Show page
var scrollVal = (currentPage-1)*width;
if (inited && settings.animate)
{
list.animate({scrollLeft: scrollVal});
}
else
{
list.attr('scrollLeft', scrollVal);
}
// Style
element.parent().addClass('current').siblings().removeClass('current');
if (currentPage == 1)
{
pagination.find('li.prev').css('visibility', 'hidden');
}
else
{
pagination.find('li.prev').css('visibility', 'visible');
}
if (currentPage == nbPages)
{
pagination.find('li.next').css('visibility', 'hidden');
}
else
{
pagination.find('li.next').css('visibility', 'visible');
}
// Callback
if (settings.after)
{
settings.after.call(list.get(0));
}
});
// Prev / next buttons
pagination.prepend('<li class="prev"><a href="#">Prev</a></li>').find('li.prev a').click(function()
{
pagination.find('li.current').prev().not('.prev').children('a').trigger('click');
});
pagination.append(' <li class="next"><a href="#">Next</a></li>').find('li.next a').click(function()
{
pagination.find('li.current').next().not('.next').children('a').trigger('click');
});
// First update
links.eq(currentPage-1).trigger('click');
// Prepare for next condition
listNode = pagination;
}
if (settings.moreAfter && lines.length > settings.moreAfter)
{
var expanded = true;
var more = $('<a href="#" class="search-less">'+settings.lessText+'</a>').insertAfter(listNode).click(function(event)
{
// Stop link action
event.preventDefault();
// Detect mode
if (!expanded)
{
if (inited && settings.animate)
{
list.animate({'height':listHeight});
}
else
{
list.css({'height':listHeight});
}
// Pagination
if (pagination)
{
if (inited && settings.animate)
{
pagination.expand();
}
else
{
pagination.show();
}
}
// More button
more.removeClass('search-more').addClass('search-less').text(settings.lessText);
expanded = true;
}
else
{
// Gather visible elements
if (settings.pageSize && lines.length > settings.pageSize)
{
var visibleLines = lines;
var rangeStart = (currentPage-1)*settings.pageSize;
if (rangeStart > 0)
{
visibleLines = visibleLines.filter(':gt('+(rangeStart-1)+')');
}
visibleLines = visibleLines.filter(':lt('+settings.moreAfter+')');
}
else
{
var visibleLines = lines.filter(':lt('+settings.moreAfter+')');
}
// Calculate visible height
var visibleHeight = 0;
var visibleCount = visibleLines.length;
visibleLines.each(function(i)
{
visibleHeight += $(this).outerHeight();
if (i < visibleCount-1)
{
visibleHeight += parseInt($(this).css('margin-bottom'));
}
});
if (inited && settings.animate)
{
list.animate({'height': visibleHeight});
}
else
{
list.css({'height': visibleHeight});
}
// Pagination
if (pagination)
{
if (inited && settings.animate)
{
pagination.fold();
}
else
{
pagination.hide();
}
}
// More button
more.removeClass('search-less').addClass('search-more').text(settings.moreText);
expanded = false;
}
// Callback
if (settings.after)
{
settings.after.call(list.get(0));
}
});
if (!settings.openedOnStart)
{
more.trigger('click');
}
}
});
// List ready
inited = true;
return this;
};
$.fn.accessibleList.defaults = {
/**
* Max number of visible lines in each list above 'more' button (0 for no masking)
* @var int
*/
moreAfter: 2,
/**
* Number of visible matches per page (0 for no pagination)
* @var int
*/
pageSize: 7,
/**
* Number of page displayed on startup
* @var int
*/
startPage: 1,
/**
* Tell wether the list should be expanded on startup (ignored if moreAfter is on 0)
* @var boolean
*/
openedOnStart: false,
/**
* Enable animation on list expand/page change
* @var boolean
*/
animate: true,
/**
* Text for the 'more' button
* @var string
*/
moreText: 'More',
/**
* Text for the 'less' button
* @var string
*/
lessText: 'Less',
/**
* Callback function after collapsing/expading/changing page. 'this' is the target list
* @var function|boolean
*/
after: false
};
})(jQuery);
|
0a1b2c3d4e5
|
trunk/leilao/include/js/jquery.accessibleList.js
|
JavaScript
|
asf20
| 7,733
|
<?php
/**
* jsmin.php - PHP implementation of Douglas Crockford's JSMin.
*
* This is pretty much a direct port of jsmin.c to PHP with just a few
* PHP-specific performance tweaks. Also, whereas jsmin.c reads from stdin and
* outputs to stdout, this library accepts a string as input and returns another
* string as output.
*
* PHP 5 or higher is required.
*
* Permission is hereby granted to use this version of the library under the
* same terms as jsmin.c, which has the following license:
*
* --
* Copyright (c) 2002 Douglas Crockford (www.crockford.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The Software shall be used for Good, not Evil.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* --
*
* @package JSMin
* @author Ryan Grove <ryan@wonko.com>
* @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
* @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
* @license http://opensource.org/licenses/mit-license.php MIT License
* @version 1.1.1 (2008-03-02)
* @link http://code.google.com/p/jsmin-php/
*/
class JSMin {
const ORD_LF = 10;
const ORD_SPACE = 32;
protected $a = '';
protected $b = '';
protected $input = '';
protected $inputIndex = 0;
protected $inputLength = 0;
protected $lookAhead = null;
protected $output = '';
// -- Public Static Methods --------------------------------------------------
public static function minify($js) {
$jsmin = new JSMin($js);
return $jsmin->min();
}
// -- Public Instance Methods ------------------------------------------------
public function __construct($input) {
$this->input = str_replace("\r\n", "\n", $input);
$this->inputLength = strlen($this->input);
}
// -- Protected Instance Methods ---------------------------------------------
protected function action($d) {
switch($d) {
case 1:
$this->output .= $this->a;
case 2:
$this->a = $this->b;
if ($this->a === "'" || $this->a === '"') {
for (;;) {
$this->output .= $this->a;
$this->a = $this->get();
if ($this->a === $this->b) {
break;
}
if (ord($this->a) <= self::ORD_LF) {
throw new JSMinException('Unterminated string literal.');
}
if ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
}
}
}
case 3:
$this->b = $this->next();
if ($this->b === '/' && (
$this->a === '(' || $this->a === ',' || $this->a === '=' ||
$this->a === ':' || $this->a === '[' || $this->a === '!' ||
$this->a === '&' || $this->a === '|' || $this->a === '?')) {
$this->output .= $this->a . $this->b;
for (;;) {
$this->a = $this->get();
if ($this->a === '/') {
break;
} elseif ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
} elseif (ord($this->a) <= self::ORD_LF) {
throw new JSMinException('Unterminated regular expression '.
'literal.');
}
$this->output .= $this->a;
}
$this->b = $this->next();
}
}
}
protected function get() {
$c = $this->lookAhead;
$this->lookAhead = null;
if ($c === null) {
if ($this->inputIndex < $this->inputLength) {
$c = substr($this->input, $this->inputIndex, 1);
$this->inputIndex += 1;
} else {
$c = null;
}
}
if ($c === "\r") {
return "\n";
}
if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
return $c;
}
return ' ';
}
protected function isAlphaNum($c) {
return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
}
protected function min() {
$this->a = "\n";
$this->action(3);
while ($this->a !== null) {
switch ($this->a) {
case ' ':
if ($this->isAlphaNum($this->b)) {
$this->action(1);
} else {
$this->action(2);
}
break;
case "\n":
switch ($this->b) {
case '{':
case '[':
case '(':
case '+':
case '-':
$this->action(1);
break;
case ' ':
$this->action(3);
break;
default:
if ($this->isAlphaNum($this->b)) {
$this->action(1);
}
else {
$this->action(2);
}
}
break;
default:
switch ($this->b) {
case ' ':
if ($this->isAlphaNum($this->a)) {
$this->action(1);
break;
}
$this->action(3);
break;
case "\n":
switch ($this->a) {
case '}':
case ']':
case ')':
case '+':
case '-':
case '"':
case "'":
$this->action(1);
break;
default:
if ($this->isAlphaNum($this->a)) {
$this->action(1);
}
else {
$this->action(3);
}
}
break;
default:
$this->action(1);
break;
}
}
}
return $this->output;
}
protected function next() {
$c = $this->get();
if ($c === '/') {
switch($this->peek()) {
case '/':
for (;;) {
$c = $this->get();
if (ord($c) <= self::ORD_LF) {
return $c;
}
}
case '*':
$this->get();
for (;;) {
switch($this->get()) {
case '*':
if ($this->peek() === '/') {
$this->get();
return ' ';
}
break;
case null:
throw new JSMinException('Unterminated comment.');
}
}
default:
return $c;
}
}
return $c;
}
protected function peek() {
$this->lookAhead = $this->get();
return $this->lookAhead;
}
}
// -- Exceptions ---------------------------------------------------------------
class JSMinException extends Exception {}
?>
|
0a1b2c3d4e5
|
trunk/leilao/include/js/jsmin.php
|
PHP
|
asf20
| 6,944
|