/** * <b>Remover Usuário:</b> Informe o ID do usuário que deseja remover. Este método não permite deletar * o próprio perfil ou ainda remover todos os ADMIN'S do sistema! * @param INT $UserId = Id do usuário */ public function ExeDelete($UserId) { $this->User = (int) $UserId; $readUser = new Read(); $readUser->ExeRead(self::Entity, "WHERE user_id = :id", "id={$this->User}"); if (!$readUser->getResult()) { $this->Error = ['Oppsss, você tentou remover um usuário que não existe no sistema!', WS_ERROR]; $this->Result = false; } elseif ($this->User == $_SESSION['userlogin']['user_id']) { $this->Error = ['Oppsss, você tentou remover seu usuário. Essa ação não é permitida!!!', WS_INFOR]; $this->Result = false; } else { if ($readUser->getResult()[0]['user_level'] == 3) { $readAdmin = $readUser; $readAdmin->ExeRead(self::Entity, "WHERE user_id != :id AND user_level = :lv", "id={$this->User}&lv=3"); if (!$readAdmin->getRowCount()) { $this->Error = ['Oppsss, você está tentando remover o único ADMIN do sistema. Para remover cadastre outro antes!!!', WS_ERROR]; $this->Result = false; } else { $this->Delete(); } } else { $this->Delete(); } } }
private function getNames($nutri) { $read = new Read(); $read->FullRead("SELECT nutri_name FROM " . DB_NUTRICAO . " WHERE nutri_id = :id", "id={$nutri}"); if ($read->getResult()) { return $read->getResult()[0]['nutri_name']; } else { return null; } }
function __construct($FamiliaId, $EducandoId) { $this->FamiliaId = $FamiliaId; $this->EducandoId = $EducandoId; $read = new Read(); $read->ExeRead(DB_FAMILIA, "WHERE familia_id = :id", "id={$this->FamiliaId}"); if ($read->getResult()) { $this->DadosPai = ['nome' => $read->getResult()[0]['familia_pai_nome'], 'telefone' => $read->getResult()[0]['familia_pai_telefonefixo']]; $this->DadosMae = ['nome' => $read->getResult()[0]['familia_mae_nome'], 'telefone' => $read->getResult()[0]['familia_mae_telefonefixo']]; $read->ExeRead(DB_EDUCANDOS, "WHERE educando_id = :id", "id={$this->EducandoId}"); if ($read->getResult()) { $this->DadosEducando = ['nome' => $read->getResult()[0]['educando_nome']]; $this->Result = true; $read->ExeRead(DB_SAUDE, "WHERE educando_id = :id", "id={$this->EducandoId}"); if ($read->getResult()) { $this->ExistRecord = true; $this->Data = $read->getResult()[0]; } else { $this->ExistRecord = false; $this->Data = null; } } else { $this->Result = false; $this->Error = ['Erro. Não existe cadastro para esse educando no sistema', TW_ERROR]; } } else { $this->Result = false; $this->Error = ['Erro. Não existe cadastro para essa família no sistema', TW_ERROR]; } }
private function getUser() { $read = new Read(); $read->ExeRead('pessoas', "WHERE email = :e AND senha = :p", "e={$this->Email}&p={$this->Senha}"); if ($read->getResult()) { $this->Result = $read->getResult()[0]; return true; } else { return false; } }
private function getUser() { $this->Senha = md5($this->Senha); $read = new Read(); $read->ExeRead("ws_users", "WHERE user_email = :e AND user_password = :p", "e={$this->Email}&p={$this->Senha}"); if ($read->getResult()) { $this->Result = $read->getResult()[0]; return TRUE; } else { return FALSE; } }
public function getInstituicao($id) { $read = new Read(); $read->Reader(self::Entity, 'inner join tb_logradouros on ' . self::Entity . '.tb_logradouros_logradouro_id = tb_logradouros.logradouro_id ' . 'inner join tb_bairros on tb_logradouros.tb_bairros_bairros_id = tb_bairros.bairros_id ' . 'inner join tb_cidade on tb_cidade.cidade_id = tb_bairros.tb_cidade_cidade_id ' . 'where instituicao_id = :id', "id={$id}"); if ($read->getResult()) { $this->result = $read->getResult(); $this->rowcount = $read->getRowCount(); } else { $this->result = false; $this->rowcount = 0; } }
private function getUser() { $this->senha = md5($this->senha); $read = new Read(); $read->ExeRead('usuario', "WHERE login = :e AND senha = :p", "e={$this->login}&p={$this->senha}"); if ($read->getResult()) { $this->result = $read->getResult()[0]; return true; } else { return false; } }
public function getMotorista($idmotorista) { $read = new Read(); $read->Reader(self::Entity, 'inner join tb_logradouros on ' . self::Entity . '.tb_logradouros_logradouro_id = tb_logradouros.logradouro_id ' . 'inner join tb_bairros on tb_logradouros.tb_bairros_bairros_id = tb_bairros.bairros_id ' . ' where motorista_id = :id', "id={$idmotorista}"); if ($read->getResult()) { $this->result = $read->getResult(); $this->rowcount = $read->getRowCount(); } else { $this->result = false; $this->rowcount = 0; } }
private function GetUser() { $this->Pass = md5($this->Pass); $read = new Read(); $read->ExeRead('user', "WHERE email = :e AND password = :p", "e={$this->Email}&p={$this->Pass}"); if ($read->getResult()) { $this->Result = $read->getResult()[0]; return true; } else { return FALSE; } }
private function getUser() { $readUser = new Read(); $readUser->ExeRead(DB_USERS, "WHERE user_email = :email", "email={$this->DestinoEmail}"); if ($readUser->getResult()) { $this->DestinoNome = $readUser->getResult()[0]['user_name'] . ' ' . $readUser->getResult()[0]['user_lastname']; $this->UserId = $readUser->getResult()[0]['user_id']; return true; } else { return false; } }
public function Login($user, $pass) { $pass = md5($pass); $read = new Read(); $read->Reader('tb_users', 'where user_login = :user and user_pass = :pass', "user={$user}&pass={$pass}"); if ($read->getResult()) { $data = $read->getResult(); $_SESSION['schoolbus_login'] = array('username' => $data[0]['user_login'], 'user_url' => $data[0]['user_url'], 'user_nome' => $data[0]['user_nome'], 'nivel' => $data[0]['user_nivel']); return true; } else { if (isset($_SESSION['schoolbus_login'])) { unset($_SESSION['schoolbus_login']); } return false; } }
/** * Busca a categoria a partir do id * @param INT $Category - ID do usuário cadastrado no banco * @return STRING - retorna o nome da categoria */ public function getCategory($Category) { $this->CatId = $Category; $read = new Read(); $read->FullRead("SELECT cat_name FROM " . DB_PRODUTOS_CATEGORIAS . " WHERE cat_id = :id", "id={$this->CatId}"); return $read->getResult()[0]['cat_name']; }
/** * Busca o login do usuário a partir do user_id * @param INT $userid - ID do usuário cadastrado no banco * @return STRING - retorna o login do usuário */ public function getUserName($UserId) { $this->UserId = $UserId; $read = new Read(); $read->FullRead("SELECT user_login FROM " . DB_USERS . " WHERE user_id = :id", "id={$this->UserId}"); return $read->getResult()[0]['user_login']; }
private function getUser() { $read = new Read(); $read->ExeRead(DB_USERS, "WHERE user_email = :e", "e={$this->Email}"); $this->Senha = sha1($this->Email . $this->Senha); $this->Senha = crypt($this->Senha, sha1($this->Email)); $options = ['cost' => 11]; $this->Senha = password_hash($this->Senha, PASSWORD_BCRYPT, $options); if ($read->getResult() && password_verify($read->getResult()[0]['user_password'], $this->Senha)) { $this->Result = $read->getResult()[0]; $this->Id = $read->getResult()[0]['user_id']; return true; } else { return false; } }
private function setName() { $Where = isset($this->Post) ? "post_id != {$this->Post} and" : ''; $readName = new Read(); $readName->ExeRead(self::Entity, "where {$Where} post_title = :t", "t={$this->Data['post_title']}"); if ($readName->getResult()) { $this->Data['post_name'] = $this->Data['post_name'] . '-' . $readName->getRowCount(); } }
private function select() { $ReadBanco = new Read(); $ReadBanco->ExeRead(self::entidade, ($this->id != 0 ? 'WHERE id = :id' : null) . ' ORDER BY sigla', $this->id != 0 ? "id={$this->id}" : null); if ($ReadBanco->getRowCount() > 0) { $this->result = $ReadBanco->getResult(); } else { $this->result = null; } }
public function ExeSelect($id = 0) { $read = new Read(); $read->ExeRead(self::entidade, ($id != 0 ? 'WHERE id = :id' : '') . ' ORDER BY nome', $id != 0 ? "id={$id}" : null); if ($read->getRowCount() > 0) { $this->result = $read->getResult(); } else { $this->result = null; } }
private function setName() { $email = $this->Data['email']; $readName = new Read(); $readName->ExeRead(self::Entity, "WHERE cpf = {$this->Data['cpf']} or email = '{$email}'"); if ($readName->getResult()) { $this->Msg = "<script>alert('Ja possui Cadastrado em Nosso Sitema!');</script>"; } else { $this->Create(); } }
/** * Obtem o player com o id tal * @return $Array [] de player */ public static function GetAccountId($id) { $Read = new Read(); $Read->ExeRead('players', "WHERE id = :id", "id={$id}"); $Result = $Read->getResult(); if ($Result) { return $Result; } else { return false; } }
public static function CatByName($CategoryName) { $read = new Read(); $read->ExeRead('ws_categories', "WHERE category_name = :name", "name={$CategoryName}"); if ($read->getRowCount()) { return $read->getResult()[0]['category_id']; } else { echo "A categoria {$CategoryName} não foi encontrada!"; die; } }
private function setName() { $Where = !empty($this->CatId) ? "category_id != {$this->CatId} AND" : ''; $categoria = $this->Data['category_title']; $readName = new Read(); $readName->ExeRead(self::Entity, "WHERE {$Where} category_title = :t", "t={$this->Data['category_title']}"); if ($readName->getResult()) { $this->Error = ["<b>Erro ao Cadastrar:</b> Categoria ja está cadastrada", WS_ERROR]; } else { $this->Create(); } }
public function GravarTrabalho() { $this->dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); if (isset($_FILES['fileUpload'])) { $nome = $this->dados['titulo']; $ext = strtolower(substr($_FILES['fileUpload']['name'], -4)); //Pegando extensão do arquivo $new_name = $nome . $ext; //Definindo um novo nome para o arquivo $this->LinkAnexo = $new_name; $dir = 'uploads/'; //Diretório para uploads move_uploaded_file($_FILES['fileUpload']['tmp_name'], $dir . $new_name); //Fazer upload do arquivo } else { echo "<script>alert('nao foi possivel anexar o arquivo!');</script>"; } if ($this->dados['tipoAtividade'] == "Palestra") { $tipoA = 1; } elseif ($this->dados['tipoAtividade'] == "MiniCurso") { $tipoA = 2; } else { $tipoA = 3; } //atualiza pessoa $updateP = new Update(); $dadosUp = ["curriculo" => $this->dados['perfil'], "nivel" => 1, "telefone" => $this->dados['telefone']]; $updateP->ExeUpdate('pessoas', $dadosUp, "where codigo = :id", "id={$this->dados['idPes']}"); //cadastra Trabalho $cadastrarT = new Create(); $Dados = ["resumo" => $this->dados['resumo'], "data_submetido" => date("Y-m-d"), "tipo_atividade" => $tipoA, "anexo" => $this->LinkAnexo, "status" => "N", "titulo" => $this->dados['titulo']]; $cadastrarT->ExeCreate('trabalhos', $Dados); $this->idT = $cadastrarT->getResult(); // Vincula o auto trabalho $cadastraAT = new Create(); $DadosAT = ["codigo_trabalho" => (int) $this->idT, "codigo_autor" => (int) $this->dados['idPes'], "codigo_evento" => 1]; $cadastraAT->ExeCreate('autor_trabalho', $DadosAT); // pega dados da pessoa $pessoa = new Read(); $pessoa->ExeRead('pessoas', "where codigo = :id", "id={$this->dados['idPes']}"); foreach ($pessoa->getResult() as $resulPes) { extract($resulPes); //Enviar o Email. $enviarEmail = new Email(); $DadosEmail = ["Assunto" => "Confirmação da Submição de Trabalho DeepDay", "Mensagem" => "Seu Trabalho foi submetido com sucesso.", "RemetenteNome" => "Equipe DeepDay", "RemetenteEmail" => "*****@*****.**", "DestinoNome" => $nome, "DestinoEmail" => $email]; $enviarEmail->Enviar($DadosEmail); } echo "<script>alert('Seu trabalho foi submetido com sucesso!');</script>"; echo "<script>window.location.assign('" . BASE . "/painel')</script>"; }
private function Search() { $entidade = "pe_" . $this->dados['entidade']; $busca = $this->dados['busca']; $termos = ''; $parseString = "busca={$busca}"; if ($entidade == "pe_pessoa") { $termos = "WHERE nome LIKE '%' :busca '%' OR nome_fantasia LIKE '%' :busca '%' OR cadastro LIKE '%' :busca '%' OR email LIKE '%' :busca '%'"; } elseif ($entidade == "pe_empenho") { $termos = "WHERE id LIKE '%' :busca '%' OR numero_doc LIKE '%' :busca '%' OR descricao LIKE '%' :busca '%' OR obs LIKE '%' :busca '%'"; } $readBusca = new Read(); $readBusca->ExeRead($entidade, $termos, $parseString); if ($readBusca->getRowCount() > 0) { $this->result = $readBusca->getResult(); $this->error = null; } else { $this->result = false; $this->error = ["Nenhum registro encontrado em {$entidade} para a busca {$busca}", WS_ALERT]; } //var_dump($readBusca); }
<?php $readResponsavel = new Read(); foreach ($readSes->getResult() as $sessoes) { $readResponsavel->FullRead("SELECT user_name, user_lastname FROM " . DB_USERS . " WHERE user_id = :id", "id={$readSes->getResult()[0]['created_by']}"); ?> <tr> <td><?php echo $sessoes['data'] . ' ' . $sessoes['hora']; ?> </td> <td><?php echo $sessoes['ocorrencia']; ?> </td> <td><?php echo $readResponsavel->getResult()[0]['user_name'] . ' ' . $readResponsavel->getResult()[0]['user_lastname']; ?> </td> </tr> <?php } ?> </tbody> </table> <?php } else { WSErro("Ainda não tem sessões registradas nesse grupo. ", TW_INFOR); } ?> </article> <?php
</div> <div class="form-group"> <label class="col-lg-12 col-md-12">Religião:</label> <input type="text" class="form-control" id="educando_religiao" name="educando_religiao"> <span id="helpBlock" class="help-block">Se tiver mais de uma, separe-as por vírgula. Ex: católica,evangélica</span> </div> <div class="form-group"> <label class="col-sm-6">Escola de Origem:</label> <?php $readEscola = new Read(); $readEscola->ExeRead(DB_ESCOLA_ORIGEM); ?> <select class="form-control selectpicker col-sm-10" name="educando_colegio"> <option value="t">Todos</option> <?php foreach ($readEscola->getResult() as $escola) { ?> <option value="<?php echo $escola['id']; ?> "/><?php echo $escola['nome_escola']; ?> </option> <?php } ?> </select> </div> <label class="checkbox-inline"> <input type="hidden" name="educando_conselhotutelar" value="nao">
</select> </label> <label class="form_padding_select"> <span class="field">Cidade:</span> <select class="j_loadcity form-control" name="user_cidade"> <?php if (!isset($user_cidade)) { ?> <option value="" selected disabled> Selecione antes um estado </option> <?php } else { $City = new Read(); $City->ExeRead(DB_CIDADES, "WHERE estado_id = :uf ORDER BY cidade_nome ASC", "uf={$user_uf}"); if ($City->getRowCount()) { foreach ($City->getResult() as $cidade) { extract($cidade); echo "<option value=\"{$cidade_id}\" "; if (isset($user_cidade) && $user_cidade == $cidade_id) { echo "selected"; } echo "> {$cidade_nome} </option>"; } } } ?> </select> </label> </div><!--/line--> <div class="form-group"> <label for="cep">CEP:</label>
<li class="active">Lista Cardápios</li> </ol> <form method="post" name="CardapioCreate"> <div class="form-group"> <div class="row"> <div class="col-lg-6 col-md-6 inputGroupContainer"> <label for="cardapio_dia">Dia para criação do cardápio:</label> <input type="text" class="form-control formDatedmY" maxlength="10" id="cardapio_dia" name="cardapio_dia" /> </div> </div> </div> <input class="btn btn-primary" type="submit" name="SendPostForm" value="Criar Cardápio" /> </form> </header> <?php if ($readCardapio->getResult()) { ?> <h1 class="text-primary h2 bold titleMobileMarginTop">Lista dos Cardápios:</h1> <div class="table-responsive col-lg-12 marginTop"> <table id="table-cardapio" class="table table-hover table-striped table-condensed"> <thead> <tr> <th data-column-id="data">Data</th> <th data-column-id="links" data-formatter="commands" data-sortable="false">-</th> </tr> </thead> <tbody> <?php foreach ($readCardapio->getResult() as $cardapio) { ?> <tr>
<div class="formulario"> <?php //RECUPERANDO ID DA PESSOA $pessoa_id = filter_input(INPUT_GET, 'pessoa_id'); //VERIFICANDO SE O ID FOI INFORMADO if (!empty($pessoa_id)) { $read = new Read(); $read->ExeRead("pe_pessoa", "WHERE id = :id", "id={$pessoa_id}"); //VERIFICANDO SE O ID CORRESPONDE A ALGUEM CADASTRADO if ($read->getRowCount() > 0) { $nome = $read->getResult()[0]['nome']; echo "<h2>Empenho para: <a href='home.php?page=pessoa&id={$pessoa_id}'>{$nome}<a> </h2>"; //RECUPERANDO DADOS PARA O CADASTRO $dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); //VERIFICANDO SE OS DADOS FORAM INFORMADOS if (!empty($dados['salvar'])) { unset($dados['salvar']); $admin = new AdminEmpenho(); //CADASTRANDO DADOS $admin->ExeCreate($dados); WSErro($admin->getError()[0], $admin->getError()[1]); if (!$admin->getResult()) { extract($dados, EXTR_PREFIX_ALL, 'em'); include 'forms/form_empenho.php'; } else { echo "<p><a href='home.php?page=novoempenho&pessoa_id={$pessoa_id}'>Cadastrar novo empenho</a><a href='home.php?page=empenhos&pessoa_id={$pessoa_id}'>Ver empenhos</a></p>"; } } else { include 'forms/form_empenho.php'; } } else {
unset($data['SendPostForm']); require '_models/AdminVisitante.class.php'; $cadastra = new AdminVisitante(); $cadastra->ExeUpdate($visitante, $data, $userlogin['user_id']); if (!$cadastra->getResult()) { WSErro($cadastra->getError()[0], $cadastra->getError()[1]); $log->RecordLog("Edição: Visitante", "Erro: " . $cadastra->getError()[0]); } else { $logData = $log->setData($data); $log->RecordLog("Edição: Visitante. Dados: " . $logData, "Sucesso: " . $cadastra->getError()[0]); header("Location:painel.php?exe=recepcao/atendimento&update=true"); } } $readData = new Read(); $readData->ExeRead(DB_VISITANTES, "WHERE visitante_id = :id", "id={$visitante}"); $data = $readData->getResult()[0]; $readData->ExeRead(DB_VISITAS, "WHERE visitante_id = :id ORDER BY id DESC LIMIT 1", "id={$visitante}"); if ($readData->getResult()) { $data['visita_data_entrada'] = date('d/m/Y', strtotime($readData->getResult()[0]['visita_data_entrada'])); $data['visita_hora_entrada'] = date('H:i:s', strtotime($readData->getResult()[0]['visita_data_entrada'])); if ($readData->getResult()[0]['visita_data_saida'] !== null) { $data['visita_data_saida'] = date('d/m/Y', strtotime($readData->getResult()[0]['visita_data_saida'])); $data['visita_hora_saida'] = date('H:i:s', strtotime($readData->getResult()[0]['visita_data_saida'])); } } ?> <header> <ol class="breadcrumb"> <li><a href="painel.php" title="Tela Inicial">Início</a></li> <li><a href="painel.php?exe=recepcao/atendimento" title="Lista Visitantes">Lista Visitantes</a></li> <li class="active">Atualizar Visitante: <?php
<div class="container"> <article class="row"> <?php if ($userlogin['user_level'] == NV_SADMIN || $userlogin['user_level'] == NV_ADMIN || $userlogin['user_level'] == NV_PSICOLOGIA) { $log = new Log($userlogin['user_id']); $log->RecordLog("Acesso: " . filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_DEFAULT), "Sucesso"); $educandoId = filter_input(INPUT_GET, 'educando', FILTER_VALIDATE_INT); $readEdu = new Read(); $readEdu->FullRead("SELECT educando_nome, educando_id FROM " . DB_EDUCANDOS . " WHERE educando_id = :id", "id={$educandoId}"); if ($readEdu->getResult()) { $data = filter_input_array(INPUT_POST, FILTER_DEFAULT); if ($data && $data['SendPostForm']) { unset($data['SendPostForm']); require '_models/AdminEducando.class.php'; $cadastra = new AdminEducando(); $cadastra->ExeCreateOcorrencia($educandoId, $data, 'Ocorrência', $userlogin['user_id']); if (!$cadastra->getResult()) { WSErro($cadastra->getError()[0], $cadastra->getError()[1]); $log->RecordLog("Cadastro: Registro de Ocorrência.", "Erro: " . $cadastra->getError()[0]); } else { $logData = $log->setData($data); $log->RecordLog("Cadastro: Registro de Ocorrência. Dados: " . $logData, "Sucesso: " . $cadastra->getError()[0]); header("Location:painel.php?exe=educandos/psico/index&create=true&tipo=ocorrencia"); } } ?> <header> <ol class="breadcrumb"> <li><a href="painel.php" title="Tela Inicial">Início</a></li> <li><a href="painel.php?exe=educandos/psico/index" title="Registrar Atendimento Individual ou Contato">Registrar Atendimento Individual ou Contato</a></li> <li class="active">Registrar Ocorrência de <?php