| Server IP : 20.75.53.88 / Your IP : 216.73.217.72 [ Web Server : Apache System : Linux VMRALP-3 4.4.0-256-generic #290~14.04.1-Ubuntu SMP Thu Jun 20 09:24:50 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29+esm15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Domains : 3 Domains MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/merenda/vicosa23/modulos/escola/ |
Upload File : |
<?php
/**
* Created by PhpStorm.
* User: RalpAlves
* Date: 04/03/15
* Time: 14:02
*/
ini_set('display_errors', 'off');
session_start();
$id_usu = $_SESSION['idusu'];
$usuario = $_SESSION['txt_usuario'];
$direito = $_SESSION['admin'];
$cod_esc = $_GET['cod_escola'];
$esc_ate = $_GET['acao'];
$rs_sql = mysql_query("select * from escolas where esc_id = $cod_esc") or die('Erro ao selecionar (escola_edt.php #11)' . mysql_error());
$resulta = mysql_fetch_array($rs_sql);
//Lista programas da escola
$rsPrograma = mysql_query("SELECT * from v_lista_prgrama_escola where esp_esc_id = $cod_esc ");
$rsPrograma_totalRows = mysql_num_rows($rsPrograma);
//tabelas auxiliares
$rs_dis = mysql_query("SELECT * FROM distrito where dis_ativo='1'");
$rs_prg = mysql_query("SELECT * FROM programa where prg_ativo='1'");
$rs_rot = mysql_query("SELECT * FROM rotas where rota_ativo='1'");
$rs_tip = mysql_query("SELECT * FROM tipoescola");
?>
<head id="Head1">
<script type="text/javascript">
function excluir_registro(e) {
if (!confirm('Deseja realmente excluir este registro?')) {
if (window.event)
window.event.returnValue = false; else
e.preventDefault();
}
}
</script>
<!--MOSTRAR / ESCONDER DIV-->
<script>
function m_div(el) {
var display = document.getElementById(el).style.display;
if (display == "none")
document.getElementById(el).style.display = 'block'; else
document.getElementById(el).style.display = 'none';
}
</script>
<!--USO: <button type="submit" name="bt_novo" class="btn" onclick="m_div('id_da_div')"></button>-->
<!--MOSTRAR / ESCONDER DIV-->
<!--Atulizar somente div dos programas-->
<script>
var var_inc = 'cadastrar';
function alterar_div() {
$.ajax({
type: "POST", url: "modulos/escola/escola_prg_crud.php", data: {
txt_programa_esc: $('#txt_programa_esc').val(),
txt_adesao: $('#txt_adesao').val(),
txt_id: $('#txt_id').val(),
txt_aluno_manha: $('#txt_aluno_manha').val(),
txt_aluno_tarde: $('#txt_aluno_tarde').val(),
txt_aluno_noite: $('#txt_aluno_noite').val(),
txt_aluno_integral: $('#txt_aluno_integral').val(),
txt_aluno_ampliada: $('#txt_aluno_ampliada').val(),
txt_cardapio: $('#txt_cardapio').val(),
var_inc: var_inc
}, success: function (data) {
$('#conteudo').html(data);
}
});
}
</script>
<script type="text/javascript">
$(document).ready(function () {
$('#tabela').DataTable({
"pagingType": "full_numbers", "lengthMenu": [[8, 25, 50, -1], [8, 25, 50, "Todos"]], stateSave: true, "oLanguage": {
"sProcessing": "Processando. Aguarde...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "NENHUM REGISTRO ENCONTRADO!",
"sInfo": "Mostrando _START_ até _END_ de _TOTAL_ registros",
"sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
"sInfoFiltered": "(de _MAX_ registros no total)",
"sInfoPostFix": "",
"sSearch": "<em class='fa fa-search' title='pesquisar'></em>",
"sUrl": "",
"oPaginate": {
"sFirst": "<em class='fa fa-angle-double-left' title='primeiro registro'>",
"sPrevious": "<em class='fa fa-arrow-circle-left' title='registro anterior'></em>",
"sNext": "<em class='fa fa-arrow-circle-right' title='próximo registro'></em>",
"sLast": "<em class='fa fa-angle-double-right ' title='último registro'>"
}
}
});
});
</script>
<script>
function combo(id, acao, valor) {
$.ajax({
type: "GET",
url: './ajax.php?a=' + acao + '&valor=' + valor,
dataType: "html",
success: function (resultado) {
//alert(resultado);
$('#' + id).html(resultado);
//$('#resposta').html(resultado);
}
});
}
</script>
</head>
<!--FORM DE ESCOLAS-->
<body style="padding-top: 40px;"/>
<form id="form1" name="form1" id="cad_esc" method="post" action="?page=./escola/escola_crud&var_acao=editar">
<div class="container">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title">
<?php
if ($esc_ate=='esc_ate') {
echo "<button type='button' name='bt_novo' class='btn' onclick=location.href='?page=./escola/escolas_atendidas'>
<i class=\"fa fa-arrow-left\"></i></button>";
} else {
echo "<button type='button' name='bt_novo' title='novo' class='btn' onclick=location.href='?page=./escola/escola'>
<i class=\"fa fa-arrow-left\"></i></button>";
}
?>
<span style="font-size:20px;"> Escola | Edição</span>
<button type="submit" name="bt_novo" title="salvar" class="btn botao_direita"><i class="fa fa-check"></i></button>
</div>
</div>
</div>
</div>
<!--
EDICAO DE ESCOLAS
-->
<div id="id_form" class="container">
<div class='col-xs-12 col-sm-12 com-md-12 col-lg-12'>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
ID
<input type="text" name="txt_ID" size="4px" style="text-align: center;" readonly="readonly"
value="<?php echo $resulta['esc_id'] ?>" class="form-control" id="txt_id">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
INEP
<input type="text" name="txt_inep" autofocus value="<?php echo $resulta['esc_inep'] ?>"
class="form-control">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
CREDE
<input type="text" name="txt_crede" value="<?php echo $resulta['esc_crede']; ?>"
class="form-control">
</div>
</div>
<div class='col-xs-12 col-sm-12 com-md-12 col-lg-12'>
<div class="col-xs-12 col-sm-8 com-md-8 col-lg-8">
Escola
<input type="text" name="txt_escola" value="<?php echo utf8_encode($resulta['esc_nome']) ?>"
class="form-control">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Distrito
<!--ADD DE OUTRO MÓDULO-->
<a class='janela70 text-black' href="index2.php?page=escola/distrito"> <i class='glyphicon glyphicon-plus'></i></a>
<i class='glyphicon glyphicon-refresh' onclick="combo('distrito','sel_distrito','0')" style="cursor: hand;"></i>
<!--ADD DE OUTRO MÓDULO-->
<div id='distrito'>
<select name="txt_distrito" class="form-control select2">
<?php while ($_dis = mysql_fetch_array($rs_dis)) {
if ($resulta['esc_dis_id']==$_dis['dis_id']) {
$selected = 'selected';
} else {
$selected = '';
}
?>
<option
value="<?=$_dis['dis_id']?>" <?php echo $selected; ?>><?=utf8_encode($_dis['dis_distrito'])?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class='col-xs-12 col-sm-12 com-md-12 col-lg-12'>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Alunos Matriculados
<input type="text" name="txt_qtd_alunos" value="<?php echo $resulta['esc_qtdalu_mat'] ?>"
class="form-control">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
UF
<input type="text" name="txt_uf" value="<?php echo $resulta['esc_uf'] ?>" class="form-control">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Municipio
<input type="text" name="txt_municipio" value="<?php echo $resulta['esc_municipio'] ?>"
class="form-control">
</div>
</div>
<div class='col-xs-12 col-sm-12 com-md-12 col-lg-12'>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Endereço
<input type="text" name="txt_endereco" value="<?php echo utf8_encode($resulta['esc_endereco']) ?>"
class="form-control">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Bairro
<input type="text" name="txt_bairro" value="<?php echo $resulta['esc_bairro'] ?>"
class="form-control">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
CEP
<input type="text" name="txt_cep" value="<?php echo $resulta['esc_cep'] ?>" class="form-control">
</div>
</div>
<div class='col-xs-12 col-sm-12 com-md-12 col-lg-12'>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Telefone
<input type="text" name="txt_telefone" value="<?php echo $resulta['esc_telefone'] ?>"
class="form-control">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
rota
<!--ADD DE OUTRO MÓDULO-->
<a class='janela70 text-black' href="index2.php?page=escola/rota"> <i class='glyphicon glyphicon-plus'></i></a>
<i class='glyphicon glyphicon-refresh' onclick="combo('rota','sel_rota','0')" style="cursor: hand;"></i>
<!--ADD DE OUTRO MÓDULO-->
<div id='rota'>
<select name="txt_rota" class="form-control select2">
<?php while ($_rot = mysql_fetch_array($rs_rot)) {
if ($resulta['esc_rota_id']==$_rot['rota_id']) {
$selected = 'selected';
} else {
$selected = '';
}
?>
<option value="<?=$_rot['rota_id']?>"<?php echo $selected; ?>><?=$_rot['rota']?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Diretor
<input type="text" name="txt_diretor" value="<?php echo $resulta['esc_diretor'] ?>"
class="form-control">
</div>
</div>
<div class='col-xs-12 col-sm-12 com-md-12 col-lg-12'>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Telefone diretor
<input type="text" name="txt_tel_diretor" value="<?php echo $resulta['esc_diretor_tel'] ?>"
class="form-control">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
E-mail diretor
<input type="text" name="txt_mail_diretor" value="<?php echo $resulta['esc_diretor_email'] ?>"
class="form-control">
</div>
</div>
</div>
</form>
<br>
<!--
PROGRAMAS
-->
<div class="container panel panel-info panel-title panel-body">
<div class="col-md-2">
<span style="font-size:20px;"> Programas</span>
</div>
<div class="col-md-1">
<button id="id_bt_salvar" name="id_bt_salvar" class="btn" title="salvar"
onclick="m_div('id_cad_prg'), m_div('id_bt_salvar'), m_div('id_bt_cancelar'), alterar_div()"
style="display: none;"><i class="fa fa-check"></i>
</button>
</div>
<div class="col-md-1">
<button id="id_bt_cancelar" name="id_bt_cancelar" class="btn" title="cancelar"
onclick="m_div('id_cad_prg'), m_div('id_bt_salvar'), m_div('id_bt_cancelar')"
style="display: none;"><i class="fa fa-close"></i>
</button>
</div>
</div>
<!--PROGRAMAS-->
<div id="id_cad_prg" class="container panel-body" style="display: none;">
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
ID
<input type="text" name="txt_id_prg" class="form-control" id="txt_id_prg" readonly="readonly">
</div>
<div class="col-md-4">
Programa
<select name="txt_programa" class="form-control select2" style="width: 100%;" autofocus id="txt_programa_esc">
<?php while ($_prg = mysql_fetch_array($rs_prg)) { ?>
<option value="<?php echo $_prg['prg_id'] ?>"><?php echo utf8_encode($_prg['prg_programa']) ?></option>
<?php } ?>
</select>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Tipo Cardápio
<select name="txt_cardapio" class="form-control select2" style="width: 100%;" id="txt_cardapio">
<?php while ($_tip = mysql_fetch_array($rs_tip)) { ?>
<option
value="<?php echo $_tip['tpe_id'] ?>"><?php echo utf8_encode($_tip['tpe_tipoescola']) ?></option>
<?php } ?>
</select>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Percentual Adesão
<input type="text" name="txt_adesao" class="form-control" id="txt_adesao">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Qtd. alunos manhã
<input type="text" name="txt_manha" class="form-control" id="txt_aluno_manha">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Qtd. alunos tarde
<input type="text" name="txt_tarde" class="form-control" id="txt_aluno_tarde">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Qtd. alunos noite
<input type="text" name="txt_noite" class="form-control" id="txt_aluno_noite">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Qtd. alunos integral
<input type="text" name="txt_integral" class="form-control" id="txt_aluno_integral">
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
Qtd. alunos ampliada
<input type="text" name="txt_ampliada" class="form-control" id="txt_aluno_ampliada">
</div>
</div>
<br>
<div id="id_lista_prg" class='container form-inline panel panel-primary filterable'>
<table id='tabela2' class='table'>
<div id="conteudo1">
<div id='dialog' class='modal modal-dialog'></div>
<div class='bs-example'>
<div class='alert alert-info' style='text-align: center;'>
<strong>Cadastrar novo programa </strong>
<a href='#' onclick="javascript:;m_div('id_cad_prg'); m_div('id_bt_salvar'); m_div('id_bt_cancelar')">
<img src='img/novo.png' width='16' title='Incluir programa'/></a>
</div>
</div>
</div>
<div id="conteudo">
<?php
echo("
<div class='panel panel-body panel-primary filterable'>
<table class='tabe1 table table-striped table-hover dt-responsive' cellspacing='0' width='100%' border='0''>
<thead>
<tr>
<th>Esc.</th>
<th>ID</th>
<th>Programa</th>
<th>Tipo Cardápio</th>
<th>Manhã</th>
<th>Tarde</th>
<th>Noite</th>
<th>Integral</th>
<th>Ampliada</th>
<th>Total</th>
<th></th>
<th></th>
</tr>
</thead>
");
while ($row_rsPrograma = mysql_fetch_array($rsPrograma)) {
echo "<tbody><tr>";
echo "<td>" . $row_rsPrograma['esp_esc_id'] . "</td>";
echo "<td>" . $row_rsPrograma['esp_id'] . "</td>";
echo "<td>" . $row_rsPrograma['prg_programa'] . "</td>";
echo "<td>" . $row_rsPrograma['tpe_tipoescola'] . "</td>";
echo "<td>" . $row_rsPrograma['esp_manha'] . "</td>";
echo "<td>" . $row_rsPrograma['esp_tarde'] . "</td>";
echo "<td>" . $row_rsPrograma['esp_noite'] . "</td>";
echo "<td>" . $row_rsPrograma['esp_integral'] . "</td>";
echo "<td>" . $row_rsPrograma['esp_ampliada'] . "</td>";
$tot_alunos = $row_rsPrograma['esp_manha'] + $row_rsPrograma['esp_tarde'] + $row_rsPrograma['esp_noite'] + $row_rsPrograma['esp_integral'] + $row_rsPrograma['esp_ampliada'];
echo "<td>" . $tot_alunos . "</td>";
$cod_prg = $row_rsPrograma['esp_id'];
$cod_esc = $row_rsPrograma['esp_esc_id'];
// echo "<td><a href=\"javascript: window.open('modulos/escola/escola_prg_edt.php?cod_prg=$cod_prg&cod_escola=$cod_esc','programas','menubar=no,
// resizable=no,width=500,height=250,location=no,toolbar=no,top=100,directories=no,fullscreen=no,left=200')\">
// <em class='fa fa-edit text-orange' title='editar registro'></em></a></td>";
echo "<td><a class='janela50' href='modulos/escola/escola_prg_edt.php?cod_prg=$cod_prg&cod_escola=$cod_esc'>
<em class='fa fa-edit text-orange' title='editar registro'></em></a>
</td>";
if ($direito=='1') {
echo "<td><a href='?page=escola/escola_prg_edt.php?cod_prg=$cod_prg&cod_escola=$cod_esc'> <em class='fa fa-trash text-red' title='Excluir registro' onclick='excluir_registro(event);' /></a></td>";
} else {
echo "<td><a href='#'><img src='img/not.png' width='16' title='sem permissão para excluir registro'/></a></td>";
}
echo "</tr>";
};
echo("</tbody></table></div>");
?>
</div>
<br><br>
<!-- <div id="conteudo">-->
<!-- </div>-->
</table>
</div>
</html>