<?php

session_start();

include "configbd.php";

$idnucleo = $_SESSION["idnucleo"];

$ano_atual=date('Y');

$ano_anterior=date('Y') -1;

$mes_atual = date('m');

$categoria = $_GET['categoria'];

if($categoria==1){

$categoria_escrita='COORDENADORES';

$sql="SELECT * FROM senuc_coordenador WHERE ativo=1 and idnucleo = '".$idnucleo."'  ";

$result = mysql_query($sql);}

if($categoria==2){

$categoria_escrita='PROFESSORES';

$sql="SELECT * FROM senuc_professores WHERE ativo=1 and idnucleo = '".$idnucleo."'  ";

$result = mysql_query($sql);}

if($categoria==3){

$categoria_escrita='ALUNOS';

$sql="SELECT * FROM senuc_aluno WHERE ativo=1 and idnucleo = '".$idnucleo."'  ";

$result = mysql_query($sql);

}



?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>TinyTable</title>

<link rel="stylesheet" href="style.css" />

   <script type="text/javascript" src="jquery.js"></script> 

        <script>

            function verificaNumero(e) {

                if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {

                    return false;

                }

            }

             

            $(document).ready(function() {

                $("#form1").keypress(verificaNumero);



            });

        </script>





</head>

<body>

<form action="fecha.php" id="form1" method="post" enctype="multipart/form-data" target="_new">

<input name="categoria" type="hidden" value="<?php echo $categoria; ?>" />

	<table cellpadding="0" cellspacing="0" border="0"  class="sortable2">

<tr>

				<td><center>

				<h1>FREQUÊNCIA MENSAL DE <?php echo $categoria_escrita; ?></h1> <br />

                <br />

                <h3>Ano de Referência: <select name="ano_referencia">

				<option value="<?php echo $ano_atual;?>" selected="selected"><?php echo $ano_atual;?></option>

				<option value="<?php echo $ano_anterior;?>"><?php echo $ano_anterior;?></option>

  </select>

Mês de Referência: <select name="mes_referencia">

<?

for($mes=1;$mes<=12;$mes++){

if($mes==1){

$mes_escrito="Janeiro";	

}

else if ($mes==2){

$mes_escrito="Fevereiro";		

}

else if ($mes==3){

$mes_escrito="Março";		

}

else if ($mes==4){

$mes_escrito="Abril";		

}

else if ($mes==5){

$mes_escrito="Maio";		

}

else if ($mes==6){

$mes_escrito="Junho";		

}

else if ($mes==7){

$mes_escrito="Julho";		

}

else if ($mes==8){

$mes_escrito="Agosto";		

}

else if ($mes==9){

$mes_escrito="Setembro";		

}

else if ($mes==10){

$mes_escrito="Outubro";		

}

else if ($mes==11){

$mes_escrito="Novembro";		

}

else {

$mes_escrito="Dezembro";		

}









if($mes_atual==$mes){

echo '<option selected value="'.$mes.'">'.$mes_escrito.'</option>';

}else{

echo '<option value="'.$mes.'">'.$mes_escrito.'</option>';

}

}

?>  </select>



Dias Letivos: 

<input autocomplete='off' name='dias_letivos' type='text' id='dias_letivos' size='4' maxlength="2"/> </h3></td>

			</tr></table>

	<table cellpadding="0" cellspacing="0" border="0" id="table" class="sortable">



<br /><br />

		<thead>

			

			<tr>

				<th><h3>Nome</h3></th>

			  <th width="130px"><h3>Cpf</h3></th>

			  <th width="50px"><h3>Dias Presentes </h3></th>

			</tr>

		</thead>

		<tbody>

			<?php



while($dados = mysql_fetch_array($result)){

             echo "<tr>

				<td>".$dados['nome']."</td>

				<td>".$dados['cpf']."</td>

				<td><input size='10' id='presenca' autocomplete='off' maxlength='2' name='presenca[]' type='text'/> <input type='hidden' name='id[]' value='".$dados['id']."'><input type='hidden' name='nome[]' value='".$dados['nome']."'><input type='hidden' name='cpf[]' value='".$dados['cpf']."'>

<input type='hidden' name='nascimento[]' value='".$dados['nascimento']."'>

<input type='hidden' name='etnia[]' value='".$dados['etnia']."'>

<input type='hidden' name='renda[]' value='".$dados['renda']."'>

<input type='hidden' name='ingresso_nucleo[]' value='".$dados['ingresso_nucleo']."'>

<input type='hidden' name='id_mdl[]' value='".$dados['id_mdl']."'>



				

				

				<input type='hidden' name='categoria' value='".$categoria."'>



				

				</td>

	

			</tr>";}

			?>

		</tbody>

          </table>





	<div id="controls">

		<div id="perpage">

			<select onchange="sorter.size(this.value)">

			<option value="5">5</option>

				<option value="10" selected="selected">10</option>

				<option value="20">20</option>

				<option value="50">50</option>

				<option value="100">100</option>

  </select>

			<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Resultados por página</span>

</form>    

		</div>

<div id="navigation">

			<img src="images/first.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1,true)" />

			<img src="images/previous.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1)" />

			<img src="images/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />

			<img src="images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />



    <br />        <br />  <br /><center><input style="font-size:20px; font-family:Verdana, Geneva, sans-serif; color:#00C; width:140px;" value="LANÇAR" name="enviar" type="submit" /></center><br /><br />





		</div>

<div id="text">Mostrando página <span id="currentpage"></span> de <span id="pagelimit"></span><splaying Page/div>

    

</div>

	<script type="text/javascript" src="script.js"></script>

	<script type="text/javascript">

  var sorter = new TINY.table.sorter("sorter");

	sorter.head = "head";

	sorter.asc = "asc";

	sorter.desc = "desc";

	sorter.even = "evenrow";

	sorter.odd = "oddrow";

	sorter.evensel = "evenselected";

	sorter.oddsel = "oddselected";

	sorter.paginate = true;

	sorter.currentid = "currentpage";

	sorter.limitid = "pagelimit";

	sorter.init("table",1);

  </script>

</body>

</html>