<?php if (!empty($_POST)) { $found = AssistanceData::getByATD($_POST["alumn_id"], $_POST["team_id"], $_POST["date_at"]); if ($found == null && $_POST["kind_id"] != "") { $assis = new AssistanceData(); $assis->alumn_id = $_POST["alumn_id"]; $assis->team_id = $_POST["team_id"]; $assis->kind_id = $_POST["kind_id"]; $assis->date_at = $_POST["date_at"]; $assis->add(); } else { if ($found = !null && $_POST["kind_id"] != "") { $found = AssistanceData::getByATD($_POST["alumn_id"], $_POST["team_id"], $_POST["date_at"]); $found->kind_id = $_POST["kind_id"]; $found->update(); } else { if ($_POST["kind_id"] == "") { $found = AssistanceData::getByATD($_POST["alumn_id"], $_POST["team_id"], $_POST["date_at"]); $found->del(); } } } }
<?php $alumns = AlumnTeamData::getAllByTeamId($_GET["team_id"]); if (count($alumns) > 0) { // si hay usuarios ?> <table class="table table-bordered table-hover"> <thead> <th>Nombre</th> <th> </th> </thead> <?php foreach ($alumns as $al) { $alumn = $al->getAlumn(); $asist = AssistanceData::getByATD($alumn->id, $_GET["team_id"], $_GET["date_at"]); $values = array("" => "Sin seleccion", "1" => "Asistencia", "2" => "Falta", "3" => "Retardo", "4" => "Justificacion"); ?> <tr> <td style="width:250px;"><?php echo $alumn->name . " " . $alumn->lastname; ?> </td> <td > <form id="form-<?php echo $al->id; ?> "> <input type="hidden" name="alumn_id" value="<?php echo $alumn->id; ?> ">