Fix page materias.php

This commit is contained in:
2023-08-16 19:19:41 +00:00
parent 9ce1dee313
commit 6147315925

View File

@@ -45,14 +45,14 @@ if ($user->admin) {
$sql = "SELECT * FROM fs_materias(:nombre, :carrera, :facultad)"; $sql = "SELECT * FROM fs_materias(:nombre, :carrera, :facultad)";
if (isset($_POST["desc"])) { if (isset($_POST["desc"])) {
$desc = $_POST["desc"]; $desc = $_POST["desc"];
$filter_desc = trim(filter_input(INPUT_POST, "desc", FILTER_SANITIZE_STRING, array('flags' => FILTER_FLAG_STRIP_LOW))); $filter_desc = htmlspecialchars($desc, ENT_QUOTES, 'UTF-8');
} else { } else {
$desc = null; $desc = null;
} }
if (isset($_POST["carrera"])) { if (isset($_POST["carrera"])) {
$pcarrera = $_POST["carrera"]; $pcarrera = $_POST["carrera"];
$filter_carrera = trim(filter_input(INPUT_POST, "carrera", FILTER_SANITIZE_STRING, array('flags' => FILTER_FLAG_STRIP_LOW))); $filter_carrera = htmlspecialchars($pcarrera, ENT_QUOTES, 'UTF-8');
} else { } else {
$pcarrera = null; $pcarrera = null;
} }
@@ -104,11 +104,15 @@ if ($user->admin) {
if ($nivel_ac != $carrera["nivel_id"]) { if ($nivel_ac != $carrera["nivel_id"]) {
$nivel_ac = $carrera["nivel_id"]; $nivel_ac = $carrera["nivel_id"];
?> ?>
<li data-id="" class="not-selectable"><?php echo $carrera["nivel_nombre"]; ?></li> <li data-id="" class="not-selectable">
<?php echo $carrera["nivel_nombre"]; ?>
</li>
<?php <?php
} }
?> ?>
<li data-id="<?php echo $carrera["carrera_nombre"]; ?>" class="pl-4 <?= !(isset($filter_carrera) && $carrera["carrera_nombre"] == $filter_carrera) ?: 'selected'; ?>"><?= $carrera["carrera_nombre"] ?></li> <li data-id="<?php echo $carrera["carrera_nombre"]; ?>"
class="pl-4 <?= !(isset($filter_carrera) && $carrera["carrera_nombre"] == $filter_carrera) ?: 'selected'; ?>">
<?= $carrera["carrera_nombre"] ?></li>
<?php <?php
} }
@@ -141,16 +145,15 @@ if ($user->admin) {
<?php <?php
if ($pcarrera == "") { if ($pcarrera == "") {
?> ?>
<p> Se muestran los primeros <strong><?php echo $max_count; ?></strong> resultados. Utiliza los filtros para encontrar la materia que buscas.</p> <p> Se muestran los primeros <strong>
<?php echo $max_count; ?>
</strong> resultados. Utiliza los filtros para encontrar la materia que buscas.</p>
<?php } ?> <?php } ?>
<table class="table table-sm table-striped table-white"> <table class="table table-sm table-striped table-white">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th>Nombre</th> <th>Nombre</th>
<th>Carrera</th> <th>Carrera</th>
<?php if ($user->acceso == 'w') { ?>
<th>Acciones</th>
<?php } ?>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -160,13 +163,12 @@ if ($user->admin) {
?> ?>
<tr data-id="<?php echo $materia["materia_id"]; ?>" id="<?php echo $materia["materia_id"]; ?>"> <tr data-id="<?php echo $materia["materia_id"]; ?>" id="<?php echo $materia["materia_id"]; ?>">
<td class="text-primary"><?php echo $materia["materia_nombre"]; ?></td> <td class="text-primary">
<td class="text-primary"><?php echo $materia["carrera_nombre"]; ?></td> <?php echo $materia["materia_nombre"]; ?>
<?php if ($user->acceso == 'w') { ?> </td>
<td class="text-center icono-acciones"> <td class="text-primary">
<a href="#" data-toggle="modal" data-target="#modal" data-tipo="3" title="Editar"><span class="ing-editar ing-fw"></span></a> <?php echo $materia["carrera_nombre"]; ?>
</td> </td>
<?php } ?>
</tr> </tr>
<?php <?php
@@ -198,7 +200,8 @@ if ($user->admin) {
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form action="./action/action_materias_update.php" method="post" id="formaModal" onsubmit="return valida_campos()"> <form action="./action/action_materias_update.php" method="post" id="formaModal"
onsubmit="return valida_campos()">
<input type="hidden" name="id" id="id"> <input type="hidden" name="id" id="id">
<div class="form-box"> <div class="form-box">
<div class="form-group row"> <div class="form-group row">