class="form-control" value="<?php echo isset($dados['motorista_cpf']) ? $dados['motorista_cpf'] : ''; ?> " /> </div> </div> <div class="form-group"> <label for="tb_logradouros_logradouro_id" class="col-md-3 control-label">Endereço</label> <div class="col-md-4"> <select class="form-control" name="tb_logradouros_logradouro_id" id="tb_logradouros_logradouro_id"> <option value="">Selecione...</option> <?php $readerlog = new Read(); $readerlog->Reader('tb_logradouros', 'inner join tb_bairros on ' . 'tb_logradouros.tb_bairros_bairros_id = tb_bairros.bairros_id'); if ($readerlog->getRowCount() > 0) { foreach ($readerlog->getResult() as $options) { if ($options['logradouro_id'] == $dados['tb_logradouros_logradouro_id']) { echo "<option value=\"{$options['logradouro_id']}\" selected=\"selected\">{$options['logradouro_nome']} -- " . "{$options['bairros_nome']}</option>"; } else { echo "<option value=\"{$options['logradouro_id']}\">{$options['logradouro_nome']} -- " . "{$options['bairros_nome']}</option>"; } } } ?> </select> </div> </div> <div class="form-group"> <label for="" class="col-md-3 control-label"></label>
private function getSyntax() { $read = new Read(); $read->ExeRead($this->Tabela, $this->Termos, $this->Places); $this->Rows = $read->getRowCount(); if ($this->Rows > $this->Limite) { $Paginas = ceil($this->Rows / $this->Limite); $MaxLinks = $this->MaxLinks; $this->Paginator = "<ul class=\"paginator\">"; $this->Paginator .= "<li><a title=\"{$this->First}\" href=\"{$this->Link}1\">{$this->First}</a></li>"; for ($iPag = $this->Page - $MaxLinks; $iPag <= $this->Page - 1; $iPag++) { if ($iPag >= 1) { $this->Paginator .= "<li><a title=\"Página {$iPag}\" href=\"{$this->Link}{$iPag}\">{$iPag}</a></li>"; } } $this->Paginator .= "<li><span class=\"active\">{$this->Page}</span></li>"; for ($dPag = $this->Page + 1; $dPag <= $this->Page + $MaxLinks; $dPag++) { if ($dPag <= $Paginas) { $this->Paginator .= "<li><a title=\"Página {$dPag}\" href=\"{$this->Link}{$dPag}\">{$dPag}</a></li>"; } } $this->Paginator .= "<li><a title=\"{$this->Last}\" href=\"{$this->Link}{$Paginas}\">{$this->Last}</a></li>"; $this->Paginator .= "</ul>"; } }
private function getSyntax() { $read = new Read(); $read->ExeRead($this->tabela, $this->termos, $this->places); $this->rows = $read->getRowCount(); if ($this->rows > $this->limit) { $paginas = ceil($this->rows / $this->limit); $maxLinks = $this->maxLinks; $this->paginator = "<ul class=\"paginator\">"; $this->paginator .= "<li><a title=\"{$this->first}\" href=\"{$this->link}1\">{$this->first}</a></li>"; for ($iPag = $this->page - $maxLinks; $iPag <= $this->page - 1; $iPag++) { if ($iPag >= 1) { $this->paginator .= "<li><a title=\"Página {$iPag}\" href=\"{$this->link}{$iPag}\">{$iPag}</a></li>"; } } $this->paginator .= "<li><span=\"active\">{$this->page}</li>"; for ($dPag = $this->page + 1; $dPag <= $this->page + $maxLinks; $dPag++) { if ($dPag <= $paginas) { $this->paginator .= "<li><a title=\"Página {$dPag}\" href=\"{$this->link}{$dPag}\">{$dPag}</a></li>"; } } $this->paginator .= "<li><a title=\"{$this->last}\" href=\"{$this->link}{$paginas}\">{$this->last}</a></li>"; $this->paginator .= "</ul>"; } }
private function getSyntax() { $read = new Read(); $read->ExeRead($this->Table, $this->Terms, $this->Places); $this->Rows = $read->getRowCount(); // Verifica se tem resultados para que se faça a paginação if ($this->Rows > $this->Limit) { // Divide a quantidade de resultados (Rows) pelo limite para obter a quantidade de páginas $Paginas = ceil($this->Rows / $this->Limit); $MaxLinks = $this->MaxLinks; $this->Paginator = "<ul class=\"paginator\">"; $this->Paginator .= "<li><a title=\"{$this->First}\" href=\"{$this->Link}1\">{$this->First}</a></li>"; for ($iPag = $this->Page - $MaxLinks; $iPag <= $this->Page - 1; $iPag++) { if ($iPag >= 1) { $this->Paginator .= "<li><a title=\"Página {$iPag}\" href=\"{$this->Link}{$iPag}\">{$iPag}</a></li>"; } } $this->Paginator .= "<li><span class=\"active\">{$this->Page}</span></li>"; for ($dPag = $this->Page + 1; $dPag <= $this->Page + $MaxLinks; $dPag++) { if ($dPag <= $Paginas) { $this->Paginator .= "<li><a title=\"Página {$dPag}\" href=\"{$this->Link}{$dPag}\">{$dPag}</a></li>"; } } $this->Paginator .= "<li><a title=\"{$this->Last}\" href=\"{$this->Link}{$Paginas}\">{$this->Last}</a></li>"; $this->Paginator .= "</ul>"; } }
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(); } }
public static function UserOnline() { $now = Date('Y-m-d H:i:s'); $deleteUserOnline = new Delete(); $deleteUserOnline->ExeDelete('ws_siteviews_online', "WHERE online_endview < :now", "now={$now}"); $readUserOnline = new Read(); $readUserOnline->ExeRead('ws_siteviews_online'); return $readUserOnline->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; } }
private function select() { $read = new Read(); $read->ExeRead(self::entidade, ($this->id != 0 ? 'WHERE id = :id' : '') . ' ORDER BY nome', $this->id != 0 ? "id={$this->id}" : null); if ($read->getRowCount() > 0) { $this->result = $read->getResult(); } else { $this->result = null; } }
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; } }
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 checkPessoa() { $ReadPessoa = new Read(); $ReadPessoa->ExeRead(self::entidade, "WHERE cadastro = :cadastro", "cadastro={$this->dados['cadastro']}"); if ($ReadPessoa->getRowCount() > 0) { $this->result = false; $this->error = ["A identificação {$this->dados['cadastro']} já consta no sistema", WS_ALERT]; return false; } else { return true; } }
public function getRotas($status = null) { $read = new Read(); if (!is_null($status)) { $read->Reader(self::Entity, 'where rota_status = :status', "status={$status}"); if ($read->getResult()) { $this->result = $read->getResult(); $this->rowcount = $read->getRowCount(); } else { $this->result = false; $this->rowcount = 0; } } else { $read->Reader(self::Entity); if ($read->getResult()) { $this->result = $read->getResult(); $this->rowcount = $read->getRowCount(); } else { $this->result = false; $this->rowcount = 0; } } }
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); }
private function updateUser() { $ArrOnline = ['online_endview' => $_SESSION['useronline']['online_endview'], 'online_url' => $_SESSION['useronline']['online_url']]; $updateUser = new Update(); $updateUser->ExeUpdate('wm_siteviews_online', $ArrOnline, "WHERE online_session = :ses", "ses={$_SESSION['useronline']['online_session']}"); // Se o update nao for realizado com sucesso é por que a sessão foi morta então recria a sessão if (!$updateUser->getRowCount()) { $readSession = new Read(); $readSession->ExeRead('wm_siteviews_online', 'WHERE online_session = :onses', "onses={$_SESSION['useronline']['online_session']}"); if (!$readSession->getRowCount()) { // Reinicializa a sessão do usuário $this->setUser(); } } }
</label> <label class="label_small"> <span class="field">Author:</span> <select name="post_author"> <option value="<?php echo $_SESSION['userlogin']['user_id']; ?> "> <?php echo "{$_SESSION['userlogin']['user_name']} {$_SESSION['userlogin']['user_lastname']}"; ?> </option> <?php $readAut = new Read(); $readAut->ExeRead("ws_users", "where user_id != :id and user_level >= :level order by user_name asc", "id={$_SESSION['userlogin']['user_id']}&level=2"); if ($readAut->getRowCount() >= 1) { foreach ($readAut->getResult() as $aut) { echo "<option "; if ($post['post_author'] == $aut['user_id']) { echo "selected=\"selected\""; } echo "value=\"{$aut['user_id']}\"> {$aut['user_name']} {$aut['user_lastname']} </option>"; } } ?> </select> </label> </div><!--/line--> <div class="label gbform">
$data['educando_foto'] = $_FILES['educando_foto']['tmp_name'] ? $_FILES['educando_foto'] : 'null'; require '_models/AdminEducando.class.php'; $cadastra = new AdminEducando(); $cadastra->ExeCreate($familiaId, $data, $userlogin['user_id']); if (!$cadastra->getResult()) { WSErro($cadastra->getError()[0], $cadastra->getError()[1]); $log->RecordLog("Cadastro: educando", "Erro: " . $cadastra->getError()[0]); } else { $logData = $log->setData($data); $log->RecordLog("Cadastro: educando. Dados: " . $logData, "Sucesso: " . $cadastra->getError()[0]); header("Location:painel.php?exe=educandos/matricula&familia={$familiaId}&educando={$cadastra->getResult()}"); } } $familia = new Read(); $familia->ExeRead(DB_FAMILIA, "WHERE familia_id = :familia", "familia={$familiaId}"); if ($familia->getRowCount()) { foreach ($familia->getResult() as $fam) { } } else { header("Location: painel.php?exe=educandos/index&empty=true"); } ?> <header> <ol class="breadcrumb"> <li><a href="painel.php" title="Tela Inicial">Início</a></li> <li><a href="painel.php?exe=familias/index" title="Lista Famílias">Lista Famílias</a></li> <li><a href="painel.php?exe=educandos/index&familia=<?php echo $familiaId; ?> " title="Lista Educandos da Família <?php echo $familiaId;
private function checkCover() { $readCapa = new Read(); $readCapa->FullRead("SELECT user_capa FROM " . DB_USERS . " WHERE user_email = :email", "email={$this->Data['user_email']}"); if ($readCapa->getRowCount()) { $delCapa = $readCapa->getResult()[0]['user_capa']; if (file_exists("../uploads/{$delCapa}") && !is_dir("../uploads/{$delCapa}")) { unlink("../uploads/{$delCapa}"); } } }
private function UsuarioUpdate() { $ArrOnline = ['online_endview' => $_SESSION['useronline']['online_endview'], 'online_url' => $_SESSION['useronline']['online_url']]; $userUpdate = new Update(); $userUpdate->ExeUpdate('ws_siteviews_online', $ArrOnline, "where online_session = :ses", "ses={$_SESSION['useronline']['online_session']}"); if (!$userUpdate->getRowCount()) { $readSes = new Read(); $readSes->ExeRead('ws_siteviews_online', "where online_session = :onses", "onses={$_SESSION['useronline']['online_session']}"); if (!$readSes->getRowCount()) { $this->setUsuario(); } } }
public static function Palestras() { $read = new Read(); $read->ExeRead('trabalhos', "where tipo_atividade = 1 and status = 'A' "); return $read->getRowCount(); }
/** * <b>Usuários Online: </b> Deleta os usuários que tem seu tempo de sessão expirado. Logo depois realiza uma leitura no banco de dados * para obter o número de usuários online no sistema * @return INT : Número de usuários online */ public static function OnlineUsers() { // Pega a data atual $now = date('Y-m-d H:i:s'); // Deleta os usuários que estão com o tempo de sessão expirado $delExpiredSession = new Delete(); $delExpiredSession->ExeDelete('wm_siteviews_online', "WHERE online_endview < :now", "now={$now}"); // Le o banco de dados e retorna o número de usuários online $readOnlineUser = new Read(); $readOnlineUser->ExeRead('wm_siteviews_online'); return $readOnlineUser->getRowCount(); }
public function getBairroNome($id) { $read = new Read(); $read->Reader(self::Bairro, ' where bairros_id = :id', "id={$id}"); if ($read->getRowCount() > 0) { $nomeBairro = $read->getResult(); $this->result = $nomeBairro[0]['bairros_nome']; $this->rowcount = $read->getRowCount(); } else { $this->result = false; $this->rowcount = 0; } }
<?php $totalPalestrantes = Totais::Palestrante(); $totalAlunos = Totais::Alunos(); $totalPalestras = Totais::Palestras(); $totalMiniCurso = Totais::MiniCurso(); $totalBanners = Totais::Banners(); $trabalhos = Totais::Trabalhos(); $idpalestrante = $userlogin['codigo']; $statustra = new Read(); $statustra->FullRead("SELECT trabalhos.status\nFROM autor_trabalho\nINNER JOIN pessoas ON autor_trabalho.codigo_autor = pessoas.codigo\nINNER JOIN trabalhos ON autor_trabalho.codigo_trabalho = trabalhos.codigo\nWHERE pessoas.codigo = {$idpalestrante}"); if ($statustra->getRowCount() != 0) { foreach ($statustra->getResult() as $cat) { extract($cat); if ($status == 'N') { $resultado = 'Seu Trabalho esta sendo avaliado'; } elseif ($status == 'R') { $resultado = 'Seu Trabalho não foi Aprovado'; } else { $resultado = 'Parabéns seu Trabalho foi Aprovado'; } } } else { $resultado = 'Você Ainda não Submeteu Trabalho'; } ?> <style> #box{ position: absolute; right: 15px; top: 50px;
//Objeto READ $read = new Read(); //VISITAS DO SITE $read->FullRead(null, "SELECT SUM(siteviews_views) AS views FROM ws_siteviews"); $Views = $read->getResult()[0]->views; //USUÁRIOS $read->FullRead(null, "SELECT SUM(siteviews_users) AS users FROM ws_siteviews"); $Users = $read->getResult()[0]->users; //MÉDIA DE PAGEVIEWS $read->FullRead(null, "SELECT SUM(siteviews_pages) AS pages FROM ws_siteviews"); $ResPages = $read->getResult()[0]->pages; $Pages = substr($ResPages / ($Users == 0 ? 1 : $Users), 0, 5); //POSTS $read->setTable("ws_posts"); $read->findAll(); $Posts = $read->getRowCount(); //EMPRESAS $read->setTable("app_empresas"); $read->findAll(); $Empresas = $read->getRowCount(); ?> <ul> <li class="view"><span><?php echo $Views; ?> </span> visitas</li> <li class="user"><span><?php echo $Users; ?> </span> usuários</li>
private function getRow() { $Read = new Read($this->Tabela); if (!empty($this->Places)) { $Read->Query($this->Termos, $this->Places); } else { $Read->findAll(); } return $Read->getRowCount(); }
private function checkCover() { $readCapa = new Read(); $readCapa->FullRead("SELECT visitante_foto FROM " . DB_VISITANTES . " WHERE visitante_id = :id", "id={$this->VisitanteId}"); if ($readCapa->getRowCount()) { $delCapa = $readCapa->getResult()[0]['visitante_foto']; if (file_exists("uploads/{$delCapa}") && !is_dir("uploads/{$delCapa}")) { unlink("uploads/{$delCapa}"); } } }
?> </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">
<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 {
private function checkCover() { $readCapa = new Read(); $readCapa->FullRead("SELECT educando_foto FROM " . DB_EDUCANDOS . " WHERE educando_id = :id", "id={$this->EducandoId}"); if ($readCapa->getRowCount()) { $delCapa = $readCapa->getResult()[0]['educando_foto']; if (file_exists("uploads/{$delCapa}") && !is_dir("uploads/{$delCapa}")) { unlink("uploads/{$delCapa}"); } } }
private function checkEmail() { $Where = isset($this->User) ? "user_id != {$this->User} AND" : ''; $readUser = new Read(); $readUser->ExeRead(self::Entity, "WHERE {$Where} user_email = :email", "email={$this->Data['user_email']}"); if ($readUser->getRowCount()) { $this->Error = ["O e-email informado foi cadastrado no sistema por outro usuário! Informe outro e-mail!", WS_ERROR]; $this->Result = false; } else { $this->Result = true; } }
public function searchNames($nome) { $read = new Read(); $read->ExeRead(DB_FAMILIA, "WHERE familia_pai_nome LIKE '%' :nome '%'", "nome={$nome}"); $i = 0; $rowCount = 0; if ($read->getResult()) { foreach ($read->getResult() as $pai) { if ($pai['familia_pai_nome'] !== 'Desconhecido') { $this->Data[$i++] = ['nome' => $pai['familia_pai_nome'], 'idade' => Check::getIdade($pai['familia_pai_datanascimento']), 'cpf' => $pai['familia_pai_cpf'], 'rg' => $pai['familia_pai_rg'], 'renda' => $pai['familia_renda']]; } } $rowCount += $read->getRowCount(); } $read->ExeRead(DB_FAMILIA, "WHERE familia_mae_nome LIKE '%' :nome '%'", "nome={$nome}"); if ($read->getResult()) { foreach ($read->getResult() as $mae) { $this->Data[$i++] = ['nome' => $mae['familia_mae_nome'], 'idade' => Check::getIdade($mae['familia_mae_datanascimento']), 'cpf' => $mae['familia_mae_cpf'], 'rg' => $mae['familia_mae_rg'], 'renda' => $mae['familia_renda']]; } $rowCount += $read->getRowCount(); } $read->ExeRead(DB_FAMILIA_RESPONSAVEL, "WHERE familia_resp_nome LIKE '%' :nome '%'", "nome={$nome}"); if ($read->getResult()) { foreach ($read->getResult() as $resp) { $this->Data[$i++] = ['nome' => $resp['familia_resp_nome'], 'idade' => Check::getIdade($resp['familia_resp_datanascimento']), 'cpf' => $resp['familia_resp_cpf'], 'rg' => $resp['familia_resp_rg']]; } $rowCount += $read->getRowCount(); } if ($rowCount == 0) { $this->result = false; $this->Error = ["Sua pesquisa não retornou resultados.", TW_ALERT]; } else { $this->Result = true; $this->Error = ["Sua pesquisa retornou " . $rowCount . " resultado(s).", TW_ACCEPT]; } }