Viewing file: BuscaCtrl.php (1.89 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
require_once("BaseController.php");
class BuscaCtrl extends GenericCtrl {
/**
* Construtor principal
* Inicia a classe principal de controle informando o Modelo Atual
*/
public function __construct() {
parent::setConnection("Noticia");
}
public function getJuridico($pesquisa) {
$q = Doctrine_Query::create()->from("Juridico j");
$q->addWhere("j.titulo LIKE ?", '%' . $pesquisa . '%');
$q->orderBy('j.titulo ASC');
$result = $q->fetchArray();
return $result;
}
public function getNoticias($pesquisa) {
$q = Doctrine_Query::create()->from("Noticia n");
$q->where("n.titulo LIKE ?", '%' . $pesquisa . '%');
$q->orWhere("n.gravata LIKE ?", '%' . $pesquisa . '%');
$q->orWhere("n.conteudo LIKE ?", '%' . $pesquisa . '%');
$q->orderBy('n.notdata DESC');
return $q->fetchArray();
}
public function getRevistas($pesquisa) {
$q = Doctrine_Query::create()->from("Revista r");
$q->where("r.titulo LIKE ?", '%' . $pesquisa . '%');
$q->orderBy('r.dtCadastro DESC');
return $q->fetchArray();
}
public function getEventos($pesquisa) {
$q = Doctrine_Query::create()->from("Evento e");
$q->where("e.titulo LIKE ?", '%' . $pesquisa . '%');
$q->orWhere("e.descricao LIKE ?", '%' . $pesquisa . '%');
$q->orderBy('e.dataFim DESC');
return $q->fetchArray();
}
public function getArtigos($pesquisa) {
$q = Doctrine_Query::create()->from("Artigo a");
$q->where("a.titulo LIKE ?", '%' . $pesquisa . '%');
$q->orWhere("a.autor LIKE ?", '%' . $pesquisa . '%');
$q->orWhere("a.conteudo LIKE ?", '%' . $pesquisa . '%');
$q->orderBy('a.dtArtigo desc');
return $q->fetchArray();
}
}
?>
|