|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace GDE; |
| 4 | + |
| 5 | +define('NO_CACHE', true); |
| 6 | +define('NO_HTML', true); |
| 7 | +define('NO_REDIRECT', true); |
| 8 | + |
| 9 | +require_once('../common/common.inc.php'); |
| 10 | + |
| 11 | +if($_Usuario->getAluno(false) === null) |
| 12 | + exit(); |
| 13 | + |
| 14 | +if(!empty($_GET['idn'])) { |
| 15 | + $Nota = Nota::Load($_GET['idn']); |
| 16 | + if(($Nota->getID() == null) || ($Nota->getUsuario(true)->getID() != $_Usuario->getID())) |
| 17 | + exit(); |
| 18 | +?> |
| 19 | +<div id="div_nota_<?= $Nota->getID(); ?>" class="nota"> |
| 20 | + <span class="nota_sigla"><?= $Nota->getSigla(true); ?></span>: <span class="nota_nota"><?= $Nota->getNota(true); ?></span> |
| 21 | + <span class="peso_texto">Peso</span>: <span class="peso_valor"><?= $Nota->getPeso(true); ?></span> |
| 22 | + <a href="#" onclick="return Alterar_Nota('<?= $Nota->getID(); ?>', '<?= $Nota->getOferecimento()->getID(); ?>');">Alterar</a> |
| 23 | + <a href="#" onclick="return Remover_Nota('<?= $Nota->getID(); ?>');">Excluir</a> |
| 24 | +</div> |
| 25 | +<?php |
| 26 | + exit(); |
| 27 | +} |
| 28 | + |
| 29 | +$Periodo_Selecionado = (!empty($_GET['p'])) ? Periodo::Load($_GET['p']) : Periodo::getAtual(); |
| 30 | + |
| 31 | +$Periodos = Periodo::Listar(); |
| 32 | +$periodos = ""; |
| 33 | +foreach($Periodos as $Periodo) |
| 34 | + $periodos .= '<option value="'.$Periodo->getID().'"'.(($Periodo_Selecionado->getID() == $Periodo->getID())?' selected="selected"':null).'>'.$Periodo->getNome(false).'</option>'; |
| 35 | + |
| 36 | +$Oferecimentos = $_Usuario->getAluno()->getOferecimentos($Periodo_Selecionado->getID()); |
| 37 | + |
| 38 | +?> |
| 39 | +<div class="div_periodo"><strong>Notas de <select id="periodo_notas"><?= $periodos; ?></select></strong></div> |
| 40 | +<?php |
| 41 | +if(count($Oferecimentos) == 0) |
| 42 | + die(' <div style="text-align: center;"><strong>Você não cursou nenhuma Disciplina em '.$Periodo_Selecionado->getNome(false).'!</strong></div>'); |
| 43 | +?> |
| 44 | + <div style="text-align: center;"><strong>Aviso:</strong> Esta ainda é uma versão preliminar do controle de notas.</div> |
| 45 | + <div id="tabs_notas" class="tabs-bottom"> |
| 46 | + <ul> |
| 47 | +<?php foreach($Oferecimentos as $Oferecimento) { ?> |
| 48 | + <li><a href="#tab_notas_<?= $Oferecimento->getID(); ?>"><?= $Oferecimento->getSigla(true); ?> <?= $Oferecimento->getTurma(true); ?></a></li> |
| 49 | +<?php } ?> |
| 50 | + </ul> |
| 51 | +<?php foreach($Oferecimentos as $Oferecimento) { ?> |
| 52 | + <div id="tab_notas_<?= $Oferecimento->getID(); ?>" class="tab_content"> |
| 53 | + <div class="notas_header_sigla"><?= $Oferecimento->getSigla(true); ?> <?= $Oferecimento->getTurma(true); ?></div> |
| 54 | + <div class="notas_header_nome"><?= $Oferecimento->getDisciplina()->getNome(true); ?></div> |
| 55 | + <div class="notas"> |
| 56 | +<?php foreach(Nota::Listar($_Usuario, $Oferecimento) as $Nota) |
| 57 | + if ($Nota->getSigla() != "Exame") { ?> |
| 58 | + <div id="div_nota_<?= $Nota->getID(); ?>" class="nota"> |
| 59 | + <div class="nota_sigla"> |
| 60 | + <?= $Nota->getSigla(true); ?> |
| 61 | + <a href="#" onclick="return Alterar_Nota('<?= $Nota->getID(); ?>', '<?= $Nota->getOferecimento()->getID(); ?>');"><img src="<?= CONFIG_URL; ?>web/images/EditOFF.png" alt="Alterar" title="Alterar" class="nota_botao_lapis" /></a> |
| 62 | + <a href="#" id="excluir_nota_<?= $Nota->getID(); ?>" onclick="return Remover_Nota('<?= $Nota->getID(); ?>');"><img class="nota_botao_x" src="<?= CONFIG_URL; ?>web/images/CancelOFF.png" alt="Excluir" title="Excluir" /></a> |
| 63 | + </div> |
| 64 | + <div class="nota_texto"> |
| 65 | + <span class="nota_texto">Nota</span>: <span class="nota_valor"><?= $Nota->getNota(true); ?></span> |
| 66 | + </div> |
| 67 | + <div class="peso_texto"> |
| 68 | + <span class="peso_texto">Peso</span>: <span class="peso_valor"><?= $Nota->getPeso(true); ?></span> |
| 69 | + </div> |
| 70 | + </div> |
| 71 | +<?php |
| 72 | + } |
| 73 | +$totalPeso = 0; |
| 74 | +$media = 0; |
| 75 | +foreach(Nota::Listar($_Usuario, $Oferecimento) as $Nota) |
| 76 | + if($Nota->getSigla() != "Exame"){ |
| 77 | + $totalPeso += floatval(str_replace(",", ".", $Nota->getPeso(true))); |
| 78 | + $media += floatval(str_replace(",", ".", $Nota->getNota(true))) * floatval(str_replace(",", ".", $Nota->getPeso(false))); |
| 79 | + } |
| 80 | + else |
| 81 | + $Exame = $Nota; |
| 82 | +if($totalPeso > 0) { |
| 83 | + $media = floatval($media / $totalPeso); |
| 84 | +?> |
| 85 | + <div id="div_media_<?= $Oferecimento->getID(); ?>" class="nota"> |
| 86 | + <div class="nota_sigla">Média</div> |
| 87 | + <div class="nota_texto"> |
| 88 | + <span class="nota_texto">Nota</span>: <span class="media_valor"><?= number_format($media, 2, ',', '.'); ?></span> |
| 89 | + </div> |
| 90 | + </div> |
| 91 | +<?php } |
| 92 | +if(isset($Exame) && ($Exame->getOferecimento()->getID() == $Oferecimento->getID() )) { ?> |
| 93 | + <div id="div_nota_<?= $Exame->getID(); ?>" class="nota"> |
| 94 | + <div class="nota_sigla">Exame <a href="#" onclick="return Alterar_Nota('<?= $Exame->getID(); ?>', '<?= $Exame->getOferecimento()->getID(); ?>');"><img src="<?= CONFIG_URL; ?>web/images/EditOFF.png" alt="Alterar" title="Alterar" class="nota_botao_lapis" /></a> <a href="#" id="excluir_nota_<?= $Exame->getID(); ?>" onclick="return Remover_Nota('<?= $Exame->getID(); ?>');"><img class="nota_botao_x" src="<?= CONFIG_URL; ?>web/images/CancelOFF.png" alt="Excluir" title="Excluir" /></a></div> |
| 95 | + <div class="nota_texto"> |
| 96 | + <span class="nota_texto">Nota</span>: <span class="nota_valor"><?= $Exame->getNota(true); ?></span> |
| 97 | + </div> |
| 98 | + </div> |
| 99 | + <div id="div_media_final_<?= $Oferecimento->getID(); ?>" class="nota"> |
| 100 | + <div class="media_sigla">Média Final</div> |
| 101 | + <span class="nota_texto">Nota</span>: <span class="media_valor"><?=number_format((($media+str_replace(",", ".", $Exame->getNota(false)))/2), 2, ',', '.'); ?></span> |
| 102 | + </div> |
| 103 | +<?php } ?> |
| 104 | + <div id="nota_funcoes_<?= $Oferecimento->getID() ?>" class="nota"> |
| 105 | + <div class="notas_funcoes" id="funcao_nota_<?= $Oferecimento->getID() ?>"> |
| 106 | + <a href="#" id="link_nova_nota_<?= $Oferecimento->getID(); ?>" onclick="return Adicionar_Nota('<?= $Oferecimento->getID(); ?>', false);">Nova Nota</a> |
| 107 | + </div> |
| 108 | +<?php if((count(Nota::Listar($_Usuario, $Oferecimento)) > 0) && (!isset($Exame))) { ?> |
| 109 | + <div class="notas_funcoes" id="funcao_exame_<?= $Oferecimento->getID() ?>"> |
| 110 | + <a href="#" id="link_novo_exame_<?= $Oferecimento->getID(); ?>" onclick="return Adicionar_Nota('<?= $Oferecimento->getID(); ?>', true);" class="nota_funcoes">Adicionar Exame</a> |
| 111 | + </div> |
| 112 | +<?php |
| 113 | + } |
| 114 | + unset($Exame); |
| 115 | +?> |
| 116 | + </div> |
| 117 | + </div> |
| 118 | + </div> |
| 119 | +<?php } ?> |
| 120 | +</div> |
0 commit comments