funcionalidad de perfil (estadisticas y nombre)
This commit is contained in:
@@ -212,5 +212,5 @@ class Usuario {
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,4 +85,26 @@ switch ($_POST['orden']) {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'mostrarEstadisticas':
|
||||||
|
|
||||||
|
$usuario = Usuario::buscarPorId($_SESSION['idUsuario']);
|
||||||
|
|
||||||
|
if ($usuario instanceof Usuario) {
|
||||||
|
|
||||||
|
echo json_encode([
|
||||||
|
'victorias' => $usuario->getVictorias(),
|
||||||
|
'derrotas' => $usuario->getDerrotas(),
|
||||||
|
'aciertos' => $usuario->getAciertos()
|
||||||
|
]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
echo json_encode($usuario);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ include 'cabecera.php';
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Triviagmático</title>
|
<title>Triviagmático</title>
|
||||||
|
<script src="js/jquery-4.0.0.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|||||||
+34
-7
@@ -28,6 +28,7 @@
|
|||||||
<!-- Tu CSS -->
|
<!-- Tu CSS -->
|
||||||
<link rel="stylesheet" href="css/index.css">
|
<link rel="stylesheet" href="css/index.css">
|
||||||
<link rel="stylesheet" href="css/perfil.css">
|
<link rel="stylesheet" href="css/perfil.css">
|
||||||
|
<script src="js/jquery-4.0.0.min.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@
|
|||||||
<!-- Nombre -->
|
<!-- Nombre -->
|
||||||
|
|
||||||
<h1 id="nombre" class="nombre">
|
<h1 id="nombre" class="nombre">
|
||||||
tuNombre
|
<?php echo $_SESSION['nombreUsuario'] ?>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
|
||||||
@@ -180,8 +181,8 @@
|
|||||||
<i class="bi bi-trophy-fill"></i>
|
<i class="bi bi-trophy-fill"></i>
|
||||||
Victorias:
|
Victorias:
|
||||||
|
|
||||||
<strong>
|
<strong id="victorias">
|
||||||
0
|
|
||||||
</strong>
|
</strong>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -192,8 +193,8 @@
|
|||||||
<i class="bi bi-x-circle-fill"></i>
|
<i class="bi bi-x-circle-fill"></i>
|
||||||
Derrotas:
|
Derrotas:
|
||||||
|
|
||||||
<strong>
|
<strong id="derrotas">
|
||||||
0
|
|
||||||
</strong>
|
</strong>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -204,8 +205,8 @@
|
|||||||
<i class="bi bi-bullseye"></i>
|
<i class="bi bi-bullseye"></i>
|
||||||
Aciertos:
|
Aciertos:
|
||||||
|
|
||||||
<strong>
|
<strong id="aciertos">
|
||||||
0
|
|
||||||
</strong>
|
</strong>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -417,6 +418,32 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "controladores/controladorUsuario.php",
|
||||||
|
data: {
|
||||||
|
'orden': 'mostrarEstadisticas'
|
||||||
|
}
|
||||||
|
}).done(function(respuesta) {
|
||||||
|
console.log(respuesta);
|
||||||
|
respuesta = JSON.parse(respuesta);
|
||||||
|
if (respuesta.error) {
|
||||||
|
console.log(respuesta.error);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$('#victorias').text(respuesta.victorias);
|
||||||
|
$('#derrotas').text(respuesta.derrotas);
|
||||||
|
$('#aciertos').text(respuesta.aciertos);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<!-- Bootstrap JS -->
|
<!-- Bootstrap JS -->
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user