Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created October 5, 2020 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/2698e8b909ab837529589ee56f9fb1ca to your computer and use it in GitHub Desktop.
Save parzibyte/2698e8b909ab837529589ee56f9fb1ca to your computer and use it in GitHub Desktop.
<?php
include_once "conexion.php";
include_once "encabezado.php";
include_once "Estudiante.php";
include_once "Materia.php";
include_once "Nota.php";
$estudiante = Estudiante::obtenerUno($_GET["id"]);
$materias = Materia::obtener();
$notas = Nota::obtenerDeEstudiante($estudiante->id);
$materiasConCalificacion = Nota::combinar($materias, $notas);
?>
<div class="row">
<div class="col-12">
<h1>Notas de <?php echo $estudiante->nombre ?></h1>
</div>
<div class="col-12 table-responsive">
<table class="table">
<thead>
<tr>
<th>Materia</th>
<th>Puntaje</th>
</tr>
</thead>
<tbody>
<?php
$sumatoria = 0;
foreach ($materiasConCalificacion as $materia) {
$sumatoria += $materia["puntaje"];
?>
<tr>
<td>
<?php echo $materia["nombre"] ?>
</td>
<td>
<form action="modificar_nota.php" method="POST" class="form-inline">
<input type="hidden" value="<?php echo $estudiante->id ?>" name="id_estudiante">
<input type="hidden" value="<?php echo $materia["id"] ?>" name="id_materia">
<input value="<?php echo $materia["puntaje"] ?>" required min="0" name="puntaje" placeholder="Escriba la calificación" type="number" class="form-control">
<button class="btn btn-success mx-2">Guardar</button>
</form>
</td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td>Promedio</td>
<td>
<strong>
<?php
$promedio = $sumatoria / count($materias);
echo $promedio;
?>
</strong>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<?php
include_once "pie.php";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment