<?php
ob_start();

session_start();
date_default_timezone_set('America/Sao_Paulo');

include "configbd.php";

$idnucleo = $_SESSION["idnucleo"];

$ano_atual=date('Y');

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

$mes_atual = date('m');

$id_atividade = $_GET['at'];

$sql2="SELECT d.tipo_atividade as tipo_atividade,b.materia as materia, a.nome_atividade as nome, c.nome as professor FROM senuc_atividades as a 
inner join materias as b on a.materia_atividade=b.id
inner join senuc_professores as c on a.id_professor=c.id
inner join senuc_tipo_atividade as d on a.tipo_atividade=d.id

WHERE a.id = '".$id_atividade."' ";

$result2 = mysql_query($sql2);

while($dados2 = mysql_fetch_array($result2)){
	$materia = $dados2['materia'];
	$professor = $dados2['professor'];
	$tipo_atividade = $dados2['tipo_atividade'];	
	$nome_atividade = $dados2['nome'];
}


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

$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>Lançamento de Notas</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">


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

<tr>

				<td><center>

				<h1>LANÇAMENTO DE NOTAS (<?php echo $tipo_atividade; ?>)</h1> <br />

                <br />

                <h3>Atividade: <select name="atividade">

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

				  </select>

Matéria: <select name="materia">
<option value="<?php echo $materia;?>" selected="selected"><?php echo utf8_encode($materia);?></option>
  </select>



Professor: 
<select name="professor">
<option value="<?php echo $professor;?>" selected="selected"><?php echo utf8_encode($professor);?></option>
  </select></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>Nota</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='nota' autocomplete='off' maxlength='3' name='nota[]' 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']."'>

			

				</td>

	

			</tr>";}

			?>

		</tbody>

          </table>





	<div id="controls">

		<div id="perpage">

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

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

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

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

				<option value="50" selected="selected">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";
tinysort.defaults.order = 'desc';
	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>