7 Commits

Author SHA1 Message Date
dbvictor2002 9a41c04daf Eliminar vistas/eyy.md 2026-10-02 13:21:04 +02:00
dbvictor2002 060ea53992 Subir archivos a "vistas" 2026-10-02 13:20:57 +02:00
dbvictor2002 a8a4699bd4 Eliminar modelos/hola.md 2026-10-02 13:20:40 +02:00
dbvictor2002 85e5c2fc0b Subir archivos a "modelos" 2026-10-02 13:20:32 +02:00
v.rodriguezcamacho b58db59f93 carpetas nuevas 2026-10-02 13:19:57 +02:00
dbvictor2002 9ec2222d78 Eliminar vistaResultados.php 2026-10-02 13:08:04 +02:00
dbvictor2002 7344a0c31f Eliminar PartidaModelo.php 2026-10-02 13:07:53 +02:00
2 changed files with 109 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
// modelos/PartidaModelo.php
class PartidaModelo {
private $conexion;
public function __construct($conexion) {
$this->conexion = $conexion;
}
// Obtiene los jugadores mapeados en la partida actual
public function obtenerJugadoresPartida($idPartida) {
$stmt = $this->conexion->prepare("
SELECT u.idUsuario, u.nombreUsuario, e.idEquipo, e.nombreEquipo
FROM equipoxpartida exp
INNER JOIN equipoxusuario exu ON exp.idEquipo = exu.idEquipo
INNER JOIN usuario u ON exu.idUsuario = u.idUsuario
INNER JOIN equipo e ON exu.idEquipo = e.idEquipo
WHERE exp.idPartida = :idPartida
");
$stmt->execute([':idPartida' => $idPartida]);
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
// Obtiene las respuestas guardadas por un usuario específico
public function obtenerRespuestasUsuario($idPartida, $idUsuario) {
$stmtRespuestas = $this->conexion->prepare("
SELECT ra.idPartidaxPregunta, r.correcta
FROM respuestaalmacenada ra
INNER JOIN respuesta r ON ra.idRespuesta = r.idRespuesta
INNER JOIN partidaxpregunta pxp ON ra.idPartidaxPregunta = pxp.idPartidaxPregunta
WHERE pxp.idPartida = :idPartida AND ra.idUsuario = :idUsuario
");
$stmtRespuestas->execute([':idPartida' => $idPartida, ':idUsuario' => $idUsuario]);
return $stmtRespuestas->fetchAll(PDO::FETCH_ASSOC);
}
}
+72
View File
@@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Resultados - Trivial</title>
<link rel="stylesheet" href="css/resultados.css">
<script src="js/jquery-4.0.0.min.js"></script>
</head>
<body data-id-partida="<?php echo $idPartida; ?>">
<div id="pantalla-espera" class="contenedor">
<h2>⌛ Esperando a que todos los jugadores terminen...</h2>
<p>Calculando estadísticas de velocidad y actualizando perfiles históricos en el servidor.</p>
<div class="loader"></div>
</div>
<div id="pantalla-resultados" class="contenedor" style="display:none;">
<h1>🏆 Resultados de la Partida 🏆</h1>
<h2>Clasificación por Equipos</h2>
<table class="tabla-ranking">
<thead>
<tr>
<th>Posición</th>
<th>Equipo</th>
<th>Puntos Totales</th>
</tr>
</thead>
<tbody>
<?php foreach ($equiposFinales as $index => $eq): ?>
<tr class="<?php echo $index === 0 ? 'top-team' : ''; ?>">
<td>#<?php echo $index + 1; ?></td>
<td><?php echo htmlspecialchars($eq['nombre']); ?></td>
<td><strong><?php echo $eq['puntos']; ?> pts</strong></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<h2>Rendimiento Individual</h2>
<table class="tabla-ranking">
<thead>
<tr>
<th>Posición</th>
<th>Jugador</th>
<th>Equipo</th>
<th>Aciertos</th>
<th>Puntos Logrados</th>
</tr>
</thead>
<tbody>
<?php foreach ($jugadoresFinales as $index => $jug): ?>
<tr class="<?php echo $index === 0 ? 'top-player' : ''; ?>">
<td>#<?php echo $index + 1; ?></td>
<td><?php echo htmlspecialchars($jug['nombre']); ?></td>
<td><?php echo htmlspecialchars($jug['equipo']); ?></td>
<td><?php echo $jug['aciertos']; ?> / 10</td>
<td><strong><?php echo $jug['puntos']; ?> pts</strong></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="contenedor-boton">
<a href="/triviagmatico/" id="btnVolverInicio" data-id="<?php echo $idPartida; ?>" class="btn-inicio">Volver al Inicio 🏠</a>
</div>
</div>
<script src="js/resultados.js"></script>
</body>
</html>