1011 lines
46 KiB
PHP
1011 lines
46 KiB
PHP
<?php
|
|
namespace app\controllers;
|
|
use League\Plates\Engine;
|
|
use PDO;
|
|
header("Access-Control-Allow-Origin: *");
|
|
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
|
|
header("Access-Control-Allow-Headers: Content-Type");
|
|
|
|
class Controller extends DBA{
|
|
public static function view(string $view, array $data = []){
|
|
|
|
$viewsPath = dirname(__FILE__,2)."/views";
|
|
|
|
if(!file_exists($viewsPath . DIRECTORY_SEPARATOR . $view.".php")){
|
|
throw new \Exception("A view {$view} não existe");
|
|
}
|
|
|
|
$templates = new Engine($viewsPath);
|
|
echo $templates-> render($view,$data);
|
|
}
|
|
public function getSTMT($CIDADE,$sql){
|
|
try{
|
|
if($CIDADE=='IRACEMAPOLIS'){
|
|
$this->stmt = $this->getIRACEMAPOLIS()->prepare($sql);
|
|
} elseif($CIDADE=='AGUASDELINDOIA'){
|
|
$this->stmt = $this->getAGUA()->prepare($sql);
|
|
} elseif($CIDADE=='CORUMBATAI'){
|
|
$this->stmt = $this->getCORUMBATAI()->prepare($sql);
|
|
} else{
|
|
throw new Exception("Banco de dados não identificado");
|
|
}
|
|
return $this->stmt;
|
|
} catch (Exception $e){
|
|
echo 'Erro ao preparar a declaração: ' . $e->getMessage();
|
|
return null;
|
|
}
|
|
}
|
|
public function getAcessoFirebird($NOME,$CIDADE){
|
|
$this->sql = "SELECT L.CD_LOGIN, L.CD_USUARIO_SISTEMA, L.NO_USERNAME, L.SENHA, US.NO_USUARIO_SISTEMA, US.NR_CPF
|
|
FROM USUARIO_SISTEMA US
|
|
INNER JOIN LOGIN L ON L.CD_USUARIO_SISTEMA = US.CD_USUARIO_SISTEMA
|
|
WHERE US.NO_USUARIO_SISTEMA LIKE ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,"%".$NOME."%");
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}
|
|
public function getAcessoMariaDB($LOGIN,$CIDADE){
|
|
$this->sql = "SELECT * FROM acessos WHERE ID_USUARIO = ? AND CIDADE = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(1,$LOGIN);
|
|
$this->stmt->bindValue(2,$CIDADE);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}
|
|
public function getPesquisaAcessoMariaDB($NOME,$CIDADE){
|
|
$this->sql = "SELECT * FROM acessos WHERE NO_USUARIO_SISTEMA LIKE ? AND CIDADE = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(1,"%".$NOME."%");
|
|
$this->stmt->bindValue(2,$CIDADE);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}
|
|
public function getLoginControle($NO_USERNAME,$CIDADE){
|
|
if(!$NO_USERNAME==''){
|
|
$this->sql = "SELECT L.CD_USUARIO_SISTEMA,L.SENHA, US.NO_USUARIO_SISTEMA, L.NO_USERNAME, US.CD_CENTRO_CUSTO, CC.CD_UNIDADE, CD.NO_FANTASIA , L.CD_LOGIN
|
|
FROM LOGIN L
|
|
INNER JOIN USUARIO_SISTEMA US ON L.CD_USUARIO_SISTEMA = US.CD_USUARIO_SISTEMA
|
|
INNER JOIN CENTRO_CUSTO CC ON US.CD_CENTRO_CUSTO = CC.CD_CENTRO_CUSTO
|
|
INNER JOIN CAD_DIVERSO CD ON CC.CD_UNIDADE = CD.CD_CAD_DIVERSO
|
|
WHERE NO_USERNAME = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$NO_USERNAME);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetch(PDO::FETCH_OBJ);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getBoletimNotas($CD_MATRICULA,$CIDADE){
|
|
if(!$CD_MATRICULA==''){
|
|
$this->sql = "SELECT * FROM SEC_BOLETIM sb WHERE CD_MATRICULA = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CD_MATRICULA);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getMostrarBoletim($ANO,$CIDADE){
|
|
if(!$ANO==''){
|
|
$this->sql = "SELECT FIRST 1 * FROM SEC_INTERVALO_DATAS WHERE EXTRACT(YEAR FROM DT_INICIAL) = ? ORDER BY DT_INICIAL";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$ANO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getPasse($CD_ALUNO,$CIDADE){
|
|
if(!$CD_ALUNO == ''){
|
|
$this->sql = "SELECT PC.DT_CADASTRO,PC.NR_CARTEIRA,PC.VALIDADE_CARTEIRINHA, PC.NR_TRANSPORTE, PC.TURNO, A.NR_RA, A.DT_NASCIMENTO,PS.DESC_SERIE, PS.GRAU
|
|
FROM PASSE_CADASTRO PC
|
|
INNER JOIN ALUNO A ON PC.CD_ALUNO = A.CD_ALUNO
|
|
INNER JOIN PASSE_SERIE PS ON PC.SERIE = PS.CD_SERIE
|
|
WHERE PC.CD_ALUNO = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CD_ALUNO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getFrequencia($CD_ALUNO,$CIDADE){
|
|
if(!$CD_ALUNO == ''){
|
|
$this->sql = "SELECT PFA.PRESENTE, PFA.DIA
|
|
FROM PASSE_CADASTRO PC
|
|
INNER JOIN PASSE_FREQUENCIA_ALUNOS PFA ON PFA.CD_CADASTRO = PC.CD_CADASTRO
|
|
WHERE PC.CD_ALUNO = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CD_ALUNO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getCarteira($CD_ALUNO,$CIDADE){
|
|
if(!$CD_ALUNO == ''){
|
|
$this->sql = "SELECT A.NR_RA, A.NO_ALUNO,A.NO_LOGRADOURO, A.NR_LOGRADOURO, A.CEP, B.DESC_BAIRRO, A.NR_DDD_TELEFONE, A.NR_TELEFONE, A.NR_DDD_CELULAR,
|
|
A.NR_CELULAR, CD.NO_FANTASIA, PC.VALIDADE_CARTEIRINHA, PC.FL_TIPO_TRANSPORTE, LT.NO_LOGR_TIPO, PC.CEAC
|
|
FROM PASSE_CADASTRO PC
|
|
INNER JOIN ALUNO A ON A.CD_ALUNO = PC.CD_ALUNO
|
|
INNER JOIN CAD_DIVERSO CD ON CD.CD_CAD_DIVERSO = PC.CD_ESCOLA
|
|
LEFT JOIN BAIRRO B ON B.CD_BAIRRO = A.CD_BAIRRO
|
|
LEFT JOIN LOGRADOURO_TIPO LT ON LT.CD_LOGR_TIPO = A.ID_TIPO_LOGR
|
|
WHERE PC.CD_ALUNO = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CD_ALUNO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getPresenca($CD_MATRICULA,$DATA,$CIDADE){
|
|
if(!$CD_MATRICULA==''){
|
|
$this->sql = "SELECT SDCA.DT_DIARIO_CLASSE,SDCA.FL_PRESENTE_AUSENTE,SDC.CD_DISCIPLINA, SD.DESCRICAO
|
|
FROM SEC_DIARIO_CLASSE_AUSENCIA SDCA
|
|
INNER JOIN SEC_DIARIO_CLASSE SDC ON SDC.CD_AULA = SDCA.CD_AULA
|
|
INNER JOIN SEC_DISCIPLINAS SD ON SDC.CD_DISCIPLINA = SD.CD_DISCIPLINA
|
|
WHERE SDCA.CD_MATRICULA = ? AND SDCA.DT_DIARIO_CLASSE = ?
|
|
GROUP BY SDCA.DT_DIARIO_CLASSE, SDCA.FL_PRESENTE_AUSENTE, SDC.CD_DISCIPLINA, SD.DESCRICAO ";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CD_MATRICULA);
|
|
$this->stmt->bindValue(2,$DATA);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_OBJ);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getOcorrencia($MATRICULA,$CIDADE){
|
|
if(!$MATRICULA==''){
|
|
$this->sql = "SELECT FIRST 1 * FROM SEC_OCORRENCIA WHERE CD_MATRICULA = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$MATRICULA);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetch(PDO::FETCH_OBJ);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getCalendarioHome($COD_ESCOLA,$HOJE,$CIDADE){
|
|
if(!$COD_ESCOLA==''){
|
|
$this->sql = "SELECT FIRST 5 sc.DT_CALENDARIO , sc.CD_EVENTO1 , sc.CD_EVENTO2 , se.NO_EVENTO
|
|
FROM SEC_CALENDARIO sc
|
|
INNER JOIN SEC_EVENTO se ON se.CD_EVENTO = CD_EVENTO1
|
|
WHERE CD_CAD_DIVERSO = ? AND DT_CALENDARIO >= ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$COD_ESCOLA);
|
|
$this->stmt->bindValue(2,$HOJE);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getCalendario($COD_ESCOLA,$MES,$QUANTIDADE,$CIDADE){
|
|
if(!$COD_ESCOLA==''){
|
|
$this->sql = "SELECT FIRST $QUANTIDADE sc.DT_CALENDARIO , sc.CD_EVENTO1 , sc.CD_EVENTO2 , se.NO_EVENTO, se.NO_COR
|
|
FROM SEC_CALENDARIO sc
|
|
INNER JOIN SEC_EVENTO se ON se.CD_EVENTO = CD_EVENTO1
|
|
WHERE CD_CAD_DIVERSO = ? AND DT_CALENDARIO >= ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$COD_ESCOLA);
|
|
$this->stmt->bindValue(2,$MES);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getBoletimFaltas($CD_MATRICULA,$CIDADE){
|
|
if(!$CD_MATRICULA==''){
|
|
$this->sql = "SELECT SF.CD_MATRICULA,SF.PERIODO,SF.FALTA,SF.DT_INSERT,SD.DESCRICAO,SD.ABREVIATURA FROM SEC_FALTA sf
|
|
INNER JOIN SEC_FALTA_DISCIPLINA sfd ON SF.CD_FALTA = SFD.CD_FALTA
|
|
INNER JOIN SEC_DISCIPLINAS sd ON SFD.CD_DISCIPLINA = SD.CD_DISCIPLINA
|
|
WHERE SF.CD_MATRICULA = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CD_MATRICULA);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getLoginPais($CPF){
|
|
if(!$CPF==''){
|
|
$this->sql = "SELECT * FROM usuarios WHERE CPF = ?";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(1,$CPF);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetch(PDO::FETCH_OBJ);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getLoginProf($CPF){
|
|
if(!$CPF==''){
|
|
$this->sql = "SELECT * FROM acessos WHERE CPF = ?";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(1,$CPF);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetch(PDO::FETCH_OBJ);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function buscarCPFMae($CPF,$CIDADE){
|
|
if(!$CPF==''){
|
|
$this->sql = "SELECT * FROM ALUNO WHERE CPF_MAE = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CPF);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetch(PDO::FETCH_OBJ);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function buscarCPFPai($CPF,$CIDADE){
|
|
if(!$CPF==''){
|
|
$this->sql = "SELECT * FROM ALUNO WHERE CPF_PAI = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CPF);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetch(PDO::FETCH_OBJ);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function buscarCadastroCPF($CPF){
|
|
if(!$CPF==''){
|
|
$this->sql = "SELECT * FROM usuarios WHERE CPF = ?";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(1,$CPF);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetch(PDO::FETCH_OBJ);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getFilhos($NOME,$PARENTESCO,$CIDADE){
|
|
if($PARENTESCO=='PAI'){
|
|
$this->sql = "SELECT a.CD_ALUNO,s.CD_MATRICULA,a.NR_RA,a.NO_PAI,a.NO_MAE, a.NO_ALUNO,a.DT_NASCIMENTO,s.ANO_FREQ,s.CD_SALA,ss.TURMA,ss.CD_SERIE,ps.DESC_SERIE,
|
|
s.CD_CAD_DIVERSO, cd.NO_FANTASIA, cd.NO_RAZAO_SOCIAL, cd.TX_DIRETOR, cd.TX_VICE_DIRETOR, cd.TX_COORDENADOR, cd.NO_EMAIL, cd.NO_SITE
|
|
FROM ALUNO as a
|
|
INNER JOIN SEC_MATRICULA s ON a.CD_ALUNO = s.CD_ALUNO
|
|
INNER JOIN SEC_SALAS ss ON s.CD_SALA = ss.CD_SALA
|
|
INNER JOIN PASSE_SERIE ps ON ss.CD_SERIE = ps.CD_SERIE
|
|
INNER JOIN CAD_DIVERSO cd ON s.CD_CAD_DIVERSO = cd.CD_CAD_DIVERSO
|
|
WHERE a.NO_PAI LIKE ? AND s.ANO_FREQ ='2023'";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,"%".$NOME."%");
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else if($PARENTESCO=='MAE'){
|
|
$this->sql = "SELECT a.CD_ALUNO,s.CD_MATRICULA, a.NR_RA,a.NO_PAI,a.NO_MAE, a.NO_ALUNO,a.DT_NASCIMENTO,s.ANO_FREQ,s.CD_SALA,ss.TURMA,ss.CD_SERIE,ps.DESC_SERIE,
|
|
s.CD_CAD_DIVERSO, cd.NO_FANTASIA, cd.NO_RAZAO_SOCIAL, cd.TX_DIRETOR, cd.TX_VICE_DIRETOR, cd.TX_COORDENADOR, cd.NO_EMAIL, cd.NO_SITE
|
|
FROM ALUNO as a
|
|
INNER JOIN SEC_MATRICULA s ON a.CD_ALUNO = s.CD_ALUNO
|
|
INNER JOIN SEC_SALAS ss ON s.CD_SALA = ss.CD_SALA
|
|
INNER JOIN PASSE_SERIE ps ON ss.CD_SERIE = ps.CD_SERIE
|
|
INNER JOIN CAD_DIVERSO cd ON s.CD_CAD_DIVERSO = cd.CD_CAD_DIVERSO
|
|
WHERE a.NO_MAE LIKE ? AND s.ANO_FREQ ='2023'";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,"%".$NOME."%");
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}
|
|
}
|
|
public function getAlunos($NOME,$CIDADE,$ANO,$ESCOLA){
|
|
//CRIADO PARA TESTE COM PARAMETRO
|
|
if(!$NOME==''){
|
|
if($CIDADE=='AGUASDELINDOIA'){
|
|
if($ESCOLA==''){
|
|
$this->sql = "SELECT a.CD_ALUNO,s.CD_MATRICULA,a.NR_RA,a.NO_PAI,a.NO_MAE, a.NO_ALUNO,a.DT_NASCIMENTO,s.ANO_FREQ,s.CD_SALA,ss.TURMA,ss.CD_SERIE,ps.DESC_SERIE,
|
|
s.CD_CAD_DIVERSO, cd.NO_FANTASIA, cd.NO_RAZAO_SOCIAL
|
|
FROM ALUNO as a
|
|
INNER JOIN SEC_MATRICULA s ON a.CD_ALUNO = s.CD_ALUNO
|
|
INNER JOIN SEC_SALAS ss ON s.CD_SALA = ss.CD_SALA
|
|
INNER JOIN PASSE_SERIE ps ON ss.CD_SERIE = ps.CD_SERIE
|
|
INNER JOIN CAD_DIVERSO cd ON s.CD_CAD_DIVERSO = cd.CD_CAD_DIVERSO
|
|
WHERE a.NO_ALUNO LIKE ? AND S.ANO_FREQ = ?";
|
|
}else{
|
|
$this->sql = "SELECT a.CD_ALUNO,s.CD_MATRICULA,a.NR_RA,a.NO_PAI,a.NO_MAE, a.NO_ALUNO,a.DT_NASCIMENTO,s.ANO_FREQ,s.CD_SALA,ss.TURMA,ss.CD_SERIE,ps.DESC_SERIE,
|
|
s.CD_CAD_DIVERSO, cd.NO_FANTASIA, cd.NO_RAZAO_SOCIAL
|
|
FROM ALUNO as a
|
|
INNER JOIN SEC_MATRICULA s ON a.CD_ALUNO = s.CD_ALUNO
|
|
INNER JOIN SEC_SALAS ss ON s.CD_SALA = ss.CD_SALA
|
|
INNER JOIN PASSE_SERIE ps ON ss.CD_SERIE = ps.CD_SERIE
|
|
INNER JOIN CAD_DIVERSO cd ON s.CD_CAD_DIVERSO = cd.CD_CAD_DIVERSO
|
|
WHERE a.NO_ALUNO LIKE ? AND S.ANO_FREQ = ? AND CD.NO_FANTASIA = ?";
|
|
}
|
|
}else{
|
|
if($ESCOLA==''){
|
|
$this->sql = "SELECT a.CD_ALUNO,s.CD_MATRICULA,a.NR_RA,a.NO_PAI,a.NO_MAE, a.NO_ALUNO,a.DT_NASCIMENTO,s.ANO_FREQ,s.CD_SALA,ss.TURMA,ss.CD_SERIE,ps.DESC_SERIE,
|
|
s.CD_CAD_DIVERSO, cd.NO_FANTASIA, cd.NO_RAZAO_SOCIAL
|
|
FROM ALUNO as a
|
|
INNER JOIN SEC_MATRICULA s ON a.CD_ALUNO = s.CD_ALUNO
|
|
INNER JOIN SEC_SALAS ss ON s.CD_SALA = ss.CD_SALA
|
|
INNER JOIN PASSE_SERIE ps ON ss.CD_SERIE = ps.CD_SERIE
|
|
INNER JOIN CAD_DIVERSO cd ON s.CD_CAD_DIVERSO = cd.CD_CAD_DIVERSO
|
|
WHERE a.NO_ALUNO LIKE ? AND S.ANO_FREQ = ?";
|
|
}else{
|
|
$this->sql = "SELECT a.CD_ALUNO,s.CD_MATRICULA,a.NR_RA,a.NO_PAI,a.NO_MAE, a.NO_ALUNO,a.DT_NASCIMENTO,s.ANO_FREQ,s.CD_SALA,ss.TURMA,ss.CD_SERIE,ps.DESC_SERIE,
|
|
s.CD_CAD_DIVERSO, cd.NO_FANTASIA, cd.NO_RAZAO_SOCIAL
|
|
FROM ALUNO as a
|
|
INNER JOIN SEC_MATRICULA s ON a.CD_ALUNO = s.CD_ALUNO
|
|
INNER JOIN SEC_SALAS ss ON s.CD_SALA = ss.CD_SALA
|
|
INNER JOIN PASSE_SERIE ps ON ss.CD_SERIE = ps.CD_SERIE
|
|
INNER JOIN CAD_DIVERSO cd ON s.CD_CAD_DIVERSO = cd.CD_CAD_DIVERSO
|
|
WHERE a.NO_ALUNO LIKE ? AND S.ANO_FREQ = ? AND CD.NO_FANTASIA = ?";
|
|
}
|
|
}
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,"%".$NOME."%");
|
|
$this->stmt->bindValue(2,$ANO);
|
|
if(!$ESCOLA==''){
|
|
$this->stmt->bindValue(3,$ESCOLA);
|
|
}
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getMatriculas($CD_ALUNO,$CIDADE){
|
|
|
|
if(!$CD_ALUNO==''){
|
|
$this->sql = "SELECT S.CD_MATRICULA , S.CD_ALUNO ,S.ANO_FREQ,SS.TURMA, PS.DESC_SERIE
|
|
FROM SEC_MATRICULA S
|
|
INNER JOIN SEC_SALAS SS ON S.CD_SALA = SS.CD_SALA
|
|
INNER JOIN PASSE_SERIE PS ON SS.CD_SERIE = PS.CD_SERIE
|
|
WHERE S.CD_ALUNO = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CD_ALUNO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getPais($CD_ALUNO){
|
|
$this->sql = "SELECT * FROM usuarios WHERE CD_ALUNO = ?";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(1,$CD_ALUNO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}
|
|
public function getLogs($USUARIO,$CIDADE,$SISTEMA){
|
|
$this->sql = "SELECT *
|
|
FROM log_pais
|
|
WHERE NO_USUARIO LIKE ?
|
|
AND CIDADE = ?
|
|
AND SISTEMA = ? ";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(1,"%".$USUARIO."%");
|
|
$this->stmt->bindValue(2,$CIDADE);
|
|
$this->stmt->bindValue(3,$SISTEMA);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}
|
|
public function deletaPais($CPF){
|
|
$this->sql = "DELETE FROM usuarios WHERE CPF = ?";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(1,$CPF);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'deletado com sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}
|
|
public function inserirPais(){
|
|
$CD_ALUNO = $_POST['CD_ALUNO'];
|
|
$ALUNO = $_POST['ALUNO'];
|
|
$CPF = $_POST['CPF'];
|
|
$NOME = $_POST['NOME'];
|
|
$SENHA = $_POST['SENHA'];
|
|
$PARENTESCO = $_POST['PARENTESCO'];
|
|
$DATA_CADASTRO = $_POST['DATA_CADASTRO'];
|
|
$CONDICAO = $_POST['CONDICAO'];
|
|
$CIDADE = $_POST['CIDADE'];
|
|
if($CONDICAO=='NOVO'){
|
|
$this->sql = "INSERT INTO usuarios (CD_ALUNO, ALUNO, CPF, NOME, SENHA, PARENTESCO, DATA_CADASTRO, CONDICAO, CIDADE)
|
|
VALUES (:CD_ALUNO, :ALUNO, :CPF, :NOME, :SENHA, :PARENTESCO, :DATA_CADASTRO, :CONDICAO, :CIDADE)";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(':CD_ALUNO', $CD_ALUNO);
|
|
$this->stmt->bindValue(':ALUNO', $ALUNO);
|
|
$this->stmt->bindValue(':CPF', $CPF);
|
|
$this->stmt->bindValue(':NOME', $NOME);
|
|
$this->stmt->bindValue(':SENHA', $SENHA);
|
|
$this->stmt->bindValue(':PARENTESCO', $PARENTESCO);
|
|
$this->stmt->bindValue(':DATA_CADASTRO', $DATA_CADASTRO);
|
|
$this->stmt->bindValue(':CONDICAO', $CONDICAO);
|
|
$this->stmt->bindValue(':CIDADE', $CIDADE);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'cadastrado com sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}else{
|
|
$this->sql = "UPDATE usuarios SET CD_ALUNO = :CD_ALUNO, ALUNO = :ALUNO, NOME = :NOME, SENHA = :SENHA,
|
|
PARENTESCO = :PARENTESCO, DATA_CADASTRO = :DATA_CADASTRO, CONDICAO = :CONDICAO, CPF = :CPF, CIDADE = :CIDADE WHERE CPF = :CPF";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(':CD_ALUNO', $CD_ALUNO);
|
|
$this->stmt->bindValue(':ALUNO', $ALUNO);
|
|
$this->stmt->bindValue(':CPF', $CPF);
|
|
$this->stmt->bindValue(':NOME', $NOME);
|
|
$this->stmt->bindValue(':SENHA', $SENHA);
|
|
$this->stmt->bindValue(':PARENTESCO', $PARENTESCO);
|
|
$this->stmt->bindValue(':DATA_CADASTRO', $DATA_CADASTRO);
|
|
$this->stmt->bindValue(':CONDICAO', $CONDICAO);
|
|
$this->stmt->bindValue(':CIDADE', $CIDADE);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'editado com sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}
|
|
}
|
|
public function updateChamada(){
|
|
$DT_DIARIO_CLASSE = $_POST['DT_DIARIO_CLASSE'];
|
|
$CD_AULA = intval($_POST['CD_AULA']);
|
|
$CD_SALA = intval($_POST['CD_SALA']);
|
|
$CD_MATRICULA = intval($_POST['CD_MATRICULA']);
|
|
$FL_PRESENTE_AUSENTE = $_POST['FL_PRESENTE_AUSENTE'];
|
|
$CIDADE = $_POST['CIDADE'];
|
|
if($DT_DIARIO_CLASSE!=''){
|
|
$this-> sql = "UPDATE SEC_DIARIO_CLASSE_AUSENCIA
|
|
SET FL_PRESENTE_AUSENTE = ?
|
|
WHERE DT_DIARIO_CLASSE = ?
|
|
AND CD_AULA = ?
|
|
AND CD_SALA = ?
|
|
AND CD_MATRICULA = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $FL_PRESENTE_AUSENTE);
|
|
$this->stmt->bindValue(2, $DT_DIARIO_CLASSE);
|
|
$this->stmt->bindValue(3, $CD_AULA);
|
|
$this->stmt->bindValue(4, $CD_SALA);
|
|
$this->stmt->bindValue(5, $CD_MATRICULA);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'editado com sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}else{
|
|
echo 'dados incompletos';
|
|
}
|
|
}
|
|
public function updateNota(){
|
|
$NOTA = $_POST['NOTA'];
|
|
$CD_MATRICULA = intval($_POST['CD_MATRICULA']);
|
|
$CD_DISCIPLINA = intval($_POST['CD_DISCIPLINA']);
|
|
$CD_SALA = intval($_POST['CD_SALA']);
|
|
$PERIODO = intval($_POST['PERIODO']);
|
|
$CIDADE = $_POST['CIDADE'];
|
|
if($NOTA!=''){
|
|
$this-> sql = "UPDATE SEC_NOTA
|
|
SET NOTA = ?
|
|
WHERE CD_MATRICULA = ?
|
|
AND CD_DISCIPLINA = ?
|
|
AND CD_SALA = ?
|
|
AND PERIODO = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $NOTA);
|
|
$this->stmt->bindValue(2, $CD_MATRICULA);
|
|
$this->stmt->bindValue(3, $CD_DISCIPLINA);
|
|
$this->stmt->bindValue(4, $CD_SALA);
|
|
$this->stmt->bindValue(5, $PERIODO);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'editado com sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}else{
|
|
echo 'dados incompletos';
|
|
}
|
|
}
|
|
public function insertDiarioClasse(){
|
|
$DT_DIARIO_CLASSE = $_POST['DT_DIARIO_CLASSE'];
|
|
$CD_SALA = intval($_POST['CD_SALA']);
|
|
$CD_AULA = intval($_POST['CD_AULA']);
|
|
$CD_CALENDARIO = intval($_POST['CD_CALENDARIO']);
|
|
$CD_DISCIPLINA = intval($_POST['CD_DISCIPLINA']);
|
|
$CD_USUARIO = intval($_POST['CD_USUARIO']);
|
|
$CIDADE = $_POST['CIDADE'];
|
|
|
|
if($DT_DIARIO_CLASSE!=''){
|
|
$this-> sql = "INSERT INTO SEC_DIARIO_CLASSE (DT_DIARIO_CLASSE, CD_SALA, CD_AULA, CD_USUARIO_SISTEMA_PROFESSOR , CD_CALENDARIO , CD_DISCIPLINA ,
|
|
CONTEUDO_MINISTRADO, CONSIDERACOES_GERAIS, CD_USUARIO_SISTEMA_REGISTRO, FL_ORIGEM_FALTAS)
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $DT_DIARIO_CLASSE);
|
|
$this->stmt->bindValue(2, $CD_SALA);
|
|
$this->stmt->bindValue(3, $CD_AULA);
|
|
$this->stmt->bindValue(4, $CD_USUARIO);
|
|
$this->stmt->bindValue(5, $CD_CALENDARIO);
|
|
$this->stmt->bindValue(6, $CD_DISCIPLINA);
|
|
$this->stmt->bindValue(7, '');
|
|
$this->stmt->bindValue(8, '');
|
|
$this->stmt->bindValue(9, $CD_USUARIO);
|
|
$this->stmt->bindValue(10, 1);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}else{
|
|
echo 'dados incompletos';
|
|
}
|
|
}
|
|
public function insertNovaChamada(){
|
|
$DT_DIARIO_CLASSE = $_POST['DT_DIARIO_CLASSE'];
|
|
$CD_SALA = intval($_POST['CD_SALA']);
|
|
$CD_AULA = intval($_POST['CD_AULA']);
|
|
$CD_MATRICULA = intval($_POST['CD_MATRICULA']);
|
|
$FL_PRESENTE_AUSENTE = $_POST['FL_PRESENTE_AUSENTE'];
|
|
$CD_USUARIO_SISTEMA_REGISTRO = intval($_POST['CD_USUARIO_SISTEMA_REGISTRO']);
|
|
$CIDADE = $_POST['CIDADE'];
|
|
|
|
if($DT_DIARIO_CLASSE!=''){
|
|
$this-> sql = "INSERT INTO SEC_DIARIO_CLASSE_AUSENCIA (DT_DIARIO_CLASSE, CD_SALA, CD_AULA, CD_MATRICULA, FL_PRESENTE_AUSENTE, CD_USUARIO_SISTEMA_REGISTRO,
|
|
FL_ORIGEM_FALTAS, DT_REGISTRO_ALT )
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $DT_DIARIO_CLASSE);
|
|
$this->stmt->bindValue(2, $CD_SALA);
|
|
$this->stmt->bindValue(3, $CD_AULA);
|
|
$this->stmt->bindValue(4, $CD_MATRICULA);
|
|
$this->stmt->bindValue(5, $FL_PRESENTE_AUSENTE);
|
|
$this->stmt->bindValue(6, $CD_USUARIO_SISTEMA_REGISTRO);
|
|
$this->stmt->bindValue(7, 1);
|
|
$this->stmt->bindValue(8, $DT_DIARIO_CLASSE);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}else{
|
|
echo 'dados incompletos';
|
|
}
|
|
}
|
|
public function insertNota(){
|
|
$CD_MATRICULA = intval($_POST['CD_MATRICULA']);
|
|
$CD_DISCIPLINA = intval($_POST['CD_DISCIPLINA']);
|
|
$CD_PROFESSOR = intval($_POST['CD_PROFESSOR']);
|
|
$PERIODO = $_POST['PERIODO'];
|
|
$NOTA = $_POST['NOTA'];
|
|
$CD_LOGIN = intval($_POST['CD_LOGIN']);
|
|
$DT_INSERT = $_POST['DT_INSERT'];
|
|
$CD_ALUNO = $_POST['CD_ALUNO'];
|
|
$CD_SALA = intval($_POST['CD_SALA']);
|
|
$CIDADE = $_POST['CIDADE'];
|
|
|
|
if($CD_MATRICULA!=''){
|
|
$this-> sql = "INSERT INTO SEC_NOTA (CD_MATRICULA, CD_DISCIPLINA, CD_PROFESSOR , PERIODO , NOTA , CD_LOGIN , DT_INSERT , FL_STATUS , CD_ALUNO , MEDIA_FINAL_MANUAL, CD_SALA)
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ? , ?, ? , ?) ";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $CD_MATRICULA);
|
|
$this->stmt->bindValue(2, $CD_DISCIPLINA);
|
|
$this->stmt->bindValue(3, $CD_PROFESSOR);
|
|
$this->stmt->bindValue(4, $PERIODO);
|
|
$this->stmt->bindValue(5, $NOTA);
|
|
$this->stmt->bindValue(6, $CD_LOGIN);
|
|
$this->stmt->bindValue(7, $DT_INSERT);
|
|
$this->stmt->bindValue(8, 1);
|
|
$this->stmt->bindValue(9, $CD_ALUNO);
|
|
$this->stmt->bindValue(10, 'N');
|
|
$this->stmt->bindValue(11, $CD_SALA);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}else{
|
|
echo 'dados incompletos';
|
|
}
|
|
}
|
|
public function inserirAcesso(){
|
|
$DATA = $_POST['DATA'];
|
|
$ACESSO_CONTROLE = $_POST['ACESSO_CONTROLE'];
|
|
$APP_PROFESSORES = $_POST['APP_PROFESSORES'];
|
|
$ACESSO_LOG = $_POST['ACESSO_LOG'];
|
|
$CADASTRADO_POR = $_POST['CADASTRADO_POR'];
|
|
$ID_USUARIO = $_POST['ID_USUARIO'];
|
|
$NO_USUARIO_SISTEMA = $_POST['NO_USUARIO_SISTEMA'];
|
|
$CIDADE = $_POST['CIDADE'];
|
|
$CPF = $_POST['CPF'];
|
|
$NOVO = $_POST['NOVO'];
|
|
if($NOVO=='SIM'){
|
|
$this->sql = "INSERT INTO acessos (DATA, ACESSO_CONTROLE, APP_PROFESSORES, ACESSO_LOG, CADASTRADO_POR, ID_USUARIO, CIDADE, NO_USUARIO_SISTEMA, CPF)
|
|
VALUES (:DATA, :ACESSO_CONTROLE, :APP_PROFESSORES, :CADASTRADO_POR, :ID_USUARIO, :CIDADE, :NO_USUARIO_SISTEMA, :CPF)";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(':DATA', $DATA);
|
|
$this->stmt->bindValue(':ACESSO_CONTROLE', $ACESSO_CONTROLE);
|
|
$this->stmt->bindValue(':APP_PROFESSORES', $APP_PROFESSORES);
|
|
$this->stmt->bindValue(':ACESSO_LOG', $ACESSO_LOG);
|
|
$this->stmt->bindValue(':CADASTRADO_POR', $CADASTRADO_POR);
|
|
$this->stmt->bindValue(':ID_USUARIO', $ID_USUARIO);
|
|
$this->stmt->bindValue(':NO_USUARIO_SISTEMA', $NO_USUARIO_SISTEMA);
|
|
$this->stmt->bindValue(':CIDADE', $CIDADE);
|
|
$this->stmt->bindValue(':CPF', $CPF);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'cadastrado com sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}else{
|
|
$this->sql = "UPDATE acessos
|
|
SET DATA = :DATA, ACESSO_CONTROLE = :ACESSO_CONTROLE, APP_PROFESSORES = :APP_PROFESSORES, ACESSO_LOG = :ACESSO_LOG, CADASTRADO_POR = :CADASTRADO_POR,
|
|
CIDADE = :CIDADE, NO_USUARIO_SISTEMA = :NO_USUARIO_SISTEMA, CPF = :CPF WHERE ID_USUARIO = :ID_USUARIO";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(':DATA', $DATA);
|
|
$this->stmt->bindValue(':ACESSO_CONTROLE', $ACESSO_CONTROLE);
|
|
$this->stmt->bindValue(':APP_PROFESSORES', $APP_PROFESSORES);
|
|
$this->stmt->bindValue(':ACESSO_LOG', $ACESSO_LOG);
|
|
$this->stmt->bindValue(':CADASTRADO_POR', $CADASTRADO_POR);
|
|
$this->stmt->bindValue(':ID_USUARIO', $ID_USUARIO);
|
|
$this->stmt->bindValue(':NO_USUARIO_SISTEMA', $NO_USUARIO_SISTEMA);
|
|
$this->stmt->bindValue(':CIDADE', $CIDADE);
|
|
$this->stmt->bindValue(':CPF', $CPF);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'editado com sucesso';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}
|
|
}
|
|
public function getDisciplinasProf($CD,$ANO,$CIDADE){
|
|
if(!$CD==''){
|
|
$this-> sql = "SELECT SAS.CD_ANO_DISCIPLINA, SS.CD_CAD_DIVERSO, SAS.CD_SALA, SS.CD_SERIE,
|
|
SAS.ANO_ATRIBUICAO, SAD.CD_DISCIPLINA,SD.CD_DISCIPLINA, SD.DESCRICAO, SD.ABREVIATURA, SS.TURMA, PS.DESC_SERIE, PS.GRAU, SS.HR_INICIO, PS.CD_TIPO_ENSINO
|
|
FROM SEC_ATRIBUICAO_SALAS SAS
|
|
INNER JOIN SEC_ANO_DISCIPLINA SAD ON SAS.CD_ANO_DISCIPLINA = SAD.CD_ANO_DISCIPLINA
|
|
INNER JOIN SEC_DISCIPLINAS SD ON SAD.CD_DISCIPLINA = SD.CD_DISCIPLINA
|
|
INNER JOIN SEC_SALAS SS ON SAS.CD_SALA = SS.CD_SALA
|
|
INNER JOIN PASSE_SERIE PS ON SS.CD_SERIE = PS.CD_SERIE
|
|
WHERE CD_USUARIO_SISTEMA = ?
|
|
AND ANO_ATRIBUICAO = ? ";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1,$CD);
|
|
$this->stmt->bindValue(2,$ANO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getPeriodoBimestral($CIDADE){
|
|
if(!$CIDADE==''){
|
|
$this-> sql = "SELECT * FROM SEC_PERIODO_BIMESTRAL";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getPeriodoNotas($CIDADE){
|
|
if(!$CIDADE==''){
|
|
$this-> sql = "SELECT * FROM SEC_PERIODO_NOTAS";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getIntervaloDatas($ID,$ANO,$CIDADE,$NR_SEQUENCIA){
|
|
if(!$ID==''){
|
|
$this-> sql = "SELECT SID.CD_INTERVALO_DATAS, SID.NR_SEQUENCIA, SID.NO_TITULO, SID.DT_INICIAL, SID.DT_FINAL, SID.TIPO, SID.ID_TIPO_ENSINO
|
|
FROM SEC_INTERVALO_DATAS SID
|
|
WHERE SID.DT_INICIAL >= ? AND ID_TIPO_ENSINO = ? AND NR_SEQUENCIA = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $ANO);
|
|
$this->stmt->bindValue(2, $ID);
|
|
$this->stmt->bindValue(3, $NR_SEQUENCIA);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getGrade($CD_SALA,$CD_DISCIPLINA,$CIDADE){
|
|
if(!$CD_SALA==''){
|
|
$this-> sql = "SELECT SG.CD_GRADE , SGS.DIA_SEMANA , SGS.AULA
|
|
FROM SEC_GRADE SG
|
|
INNER JOIN SEC_GRADE_SUB SGS ON SG.CD_GRADE = SGS.CD_GRADE
|
|
WHERE SG.CD_SALA = ? AND SGS.CD_DISCIPLINA = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $CD_SALA);
|
|
$this->stmt->bindValue(2, $CD_DISCIPLINA);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getChamadasRealizadas($CD_SALA,$CD_DISCIPLINA,$DATA,$ANO,$CIDADE){
|
|
if(!$CD_SALA==''){
|
|
$this-> sql = "SELECT SDCA.DT_DIARIO_CLASSE , SDCA.CD_AULA , SDCA.CD_MATRICULA , SDCA.FL_PRESENTE_AUSENTE ,
|
|
SM.CD_ALUNO, A.NO_ALUNO , SM.NR_TURMA, SDC.CD_DISCIPLINA , SM.STATUS
|
|
FROM SEC_DIARIO_CLASSE_AUSENCIA SDCA
|
|
INNER JOIN SEC_MATRICULA SM ON SDCA.CD_MATRICULA = SM.CD_MATRICULA
|
|
INNER JOIN ALUNO A ON SM.CD_ALUNO = A.CD_ALUNO
|
|
INNER JOIN SEC_DIARIO_CLASSE SDC ON SDCA.DT_DIARIO_CLASSE = SDC.DT_DIARIO_CLASSE
|
|
AND SDCA.CD_SALA = SDC.CD_SALA
|
|
AND SDCA.CD_AULA = SDC.CD_AULA
|
|
WHERE SDCA.CD_SALA = ? AND SDCA.DT_DIARIO_CLASSE = ? AND SDC.CD_DISCIPLINA = ? AND SM.ANO_FREQ = ?
|
|
ORDER BY SDCA.CD_AULA , A.NO_ALUNO ";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $CD_SALA);
|
|
$this->stmt->bindValue(2, $DATA);
|
|
$this->stmt->bindValue(3, $CD_DISCIPLINA);
|
|
$this->stmt->bindValue(4, $ANO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getNotasRealizadas($CD_SALA,$CD_DISCIPLINA,$PERIODO,$CIDADE){
|
|
if(!$CD_SALA==''){
|
|
$this-> sql = "SELECT SN.CD_MATRICULA , SN.NOTA , SN.CD_ALUNO , SN.CD_NOTA , SM.NR_TURMA, SM.STATUS , A.NO_ALUNO
|
|
FROM SEC_NOTA SN
|
|
INNER JOIN SEC_MATRICULA SM ON SM.CD_MATRICULA = SN.CD_MATRICULA
|
|
INNER JOIN ALUNO A ON SM.CD_ALUNO = A.CD_ALUNO
|
|
WHERE SN.CD_SALA = ? AND SN.CD_DISCIPLINA = ? AND SN.PERIODO = ?
|
|
ORDER BY A.NO_ALUNO ";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $CD_SALA);
|
|
$this->stmt->bindValue(2, $CD_DISCIPLINA);
|
|
$this->stmt->bindValue(3, $PERIODO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getNovaChamada($CD_SALA,$ANO,$CIDADE){
|
|
if(!$CD_SALA==''){
|
|
$this-> sql = "SELECT SM.CD_MATRICULA , SM.CD_ALUNO , SM.CD_SALA , SM.NR_TURMA , SM.STATUS , SM.ANO_FREQ, A.NO_ALUNO
|
|
FROM SEC_MATRICULA SM
|
|
INNER JOIN ALUNO A ON SM.CD_ALUNO = A.CD_ALUNO
|
|
WHERE SM.CD_SALA = ? AND SM.ANO_FREQ = ?
|
|
ORDER BY A.NO_ALUNO";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $CD_SALA);
|
|
$this->stmt->bindValue(2, $ANO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getCodigoCalendario($CD_CAD_DIVERSO,$DT_CALENDARIO,$ID_TIPO_ENSINO,$CIDADE){
|
|
if(!$CD_CAD_DIVERSO==''){
|
|
$this-> sql = "SELECT SC.CD_CALENDARIO
|
|
FROM SEC_CALENDARIO SC
|
|
INNER JOIN SEC_TIPO_ENSINO STE ON SC.ID_TIPO_ENSINO = STE.CD_TP_ENSINO
|
|
WHERE SC.CD_CAD_DIVERSO = ? AND SC.DT_CALENDARIO = ? AND STE.SIGLA = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $CD_CAD_DIVERSO);
|
|
$this->stmt->bindValue(2, $DT_CALENDARIO);
|
|
$this->stmt->bindValue(3, $ID_TIPO_ENSINO);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function getDiarioClasse($CD_AULA,$CD_SALA,$DT_DIARIO_CLASSE,$CIDADE){
|
|
if(!$DT_DIARIO_CLASSE==''){
|
|
$this-> sql = "SELECT *
|
|
FROM SEC_DIARIO_CLASSE SDC
|
|
WHERE CD_AULA = ? AND CD_SALA = ? AND DT_DIARIO_CLASSE = ?";
|
|
$Con = new Controller();
|
|
$this->stmt = $Con -> getSTMT($CIDADE,$this->sql);
|
|
$this->stmt->bindValue(1, $CD_AULA);
|
|
$this->stmt->bindValue(2, $CD_SALA);
|
|
$this->stmt->bindValue(3, $DT_DIARIO_CLASSE);
|
|
$this->stmt->execute();
|
|
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
return $this-> res;
|
|
}else{
|
|
//caso o id não foi passado recebe essa mensagem
|
|
die('informação incompleta...');
|
|
}
|
|
}
|
|
public function insertLog(){
|
|
$DATA = $_POST['DATA'];
|
|
$TELA = $_POST['TELA'];
|
|
$SISTEMA = $_POST['SISTEMA'];
|
|
$CD_USUARIO = $_POST['CD_USUARIO'];
|
|
$NO_USUARIO = $_POST['NO_USUARIO'];
|
|
$CD_ALUNO = $_POST['CD_ALUNO'];
|
|
$NO_ALUNO = $_POST['NO_ALUNO'];
|
|
$CIDADE = $_POST['CIDADE'];
|
|
if($DATA!=''){
|
|
$this->sql = "INSERT INTO log_pais (DATA, TELA, CD_USUARIO, NO_USUARIO, CD_ALUNO,NO_ALUNO, CIDADE, SISTEMA)
|
|
VALUES (:DATA, :TELA, :CD_USUARIO, :NO_USUARIO, :CD_ALUNO, :NO_ALUNO, :CIDADE, :SISTEMA)";
|
|
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
|
$this->stmt->bindValue(':DATA', $DATA);
|
|
$this->stmt->bindValue(':TELA', $TELA);
|
|
$this->stmt->bindValue(':CD_USUARIO', $CD_USUARIO);
|
|
$this->stmt->bindValue(':NO_USUARIO', $NO_USUARIO);
|
|
$this->stmt->bindValue(':CD_ALUNO', $CD_ALUNO);
|
|
$this->stmt->bindValue(':NO_ALUNO', $NO_ALUNO);
|
|
$this->stmt->bindValue(':CIDADE', $CIDADE);
|
|
$this->stmt->bindValue(':SISTEMA', $SISTEMA);
|
|
$this->stmt->execute();
|
|
if($this->stmt){
|
|
echo 'log salvo';
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}else{
|
|
echo 'erro';
|
|
}
|
|
}
|
|
}
|
|
|
|
class DBA{
|
|
protected static $instAGUA;
|
|
protected static $instCORUMBATAI;
|
|
protected static $instIRACEMAPOLIS;
|
|
protected static $instMARIA;
|
|
|
|
// Método público para obter a instância da conexão com o banco de dados AGUA
|
|
public static function getAGUA() {
|
|
if (self::$instAGUA === null) {
|
|
self::$instAGUA = new PDO(STR_BD_AGUA, USUARIO_HOMO, SENHA_HOMO);
|
|
}
|
|
return self::$instAGUA;
|
|
}
|
|
|
|
// Método público para obter a instância da conexão com o banco de dados CORUMBATAI
|
|
public static function getCORUMBATAI() {
|
|
if (self::$instCORUMBATAI === null) {
|
|
self::$instCORUMBATAI = new PDO(STR_BD_CORUMBATAI, USUARIO_HOMO, SENHA_HOMO);
|
|
}
|
|
return self::$instCORUMBATAI;
|
|
}
|
|
|
|
// Método público para obter a instância da conexão com o banco de dados IRACEMAPOLIS
|
|
public static function getIRACEMAPOLIS() {
|
|
if (self::$instIRACEMAPOLIS === null) {
|
|
try{
|
|
self::$instIRACEMAPOLIS = new PDO(STR_BD_IRACEMAPOLIS, USUARIO_HOMO, SENHA_HOMO);
|
|
//echo "Conexão com o banco de dados estabelecida com sucesso!";
|
|
}catch (PDOException $e) {
|
|
echo "Erro na conexão com o banco de dados: " . $e->getMessage();
|
|
}
|
|
}
|
|
return self::$instIRACEMAPOLIS;
|
|
}
|
|
|
|
// Método público para obter a instância da conexão com o banco de dados MARIA
|
|
public static function getMARIA() {
|
|
if (self::$instMARIA === null) {
|
|
try{
|
|
self::$instMARIA = new PDO(DB_CONTROLE, USER, PASS);
|
|
//echo "Conexão com o banco de dados estabelecida com sucesso!";
|
|
}catch (PDOException $e) {
|
|
echo "Erro na conexão com o banco de dados: " . $e->getMessage();
|
|
}
|
|
}
|
|
|
|
return self::$instMARIA;
|
|
}
|
|
}
|