-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmensajes.php
62 lines (58 loc) · 1.31 KB
/
mensajes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
require_once __DIR__.'/includes/config.php';
use \es\ucm\fdi\aw\Mensaje;
use \es\ucm\fdi\aw\FormularioMensaje;
use \es\ucm\fdi\aw\FormularioRespuesta;
?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="<?= $app->resuelve('/css/style.css') ?>" />
<title>Mensajes</title>
</head>
<body>
<div id="contenedor">
<?php
$app->doInclude('comun/cabecera.php');
$app->doInclude('comun/sidebarIzq.php');
?>
<div id="contenido">
<?php
if ($app->tieneRol('user')) {
$formMensaje = new FormularioMensaje();
$formMensaje->gestiona();
}
?>
<h1>Mensajes</h1>
<ul>
<?php
$mensajes = Mensaje::mensajes();
foreach($mensajes as $m) {
?>
<li><?= $m->texto()?> (<?= $m->username()?>)<?php
if ($app->tieneRol('user')) {
$formRespuesta = new FormularioRespuesta($m->id());
$formRespuesta->gestiona();
}
$respuestas = Mensaje::mensajes($m->id());
if (count($respuestas) > 0) {
echo '<ul>';
foreach($respuestas as $r ) {
?>
<li><?= $r->texto()?> (<?= $r->username()?>)</li>
<?php
}
echo '</ul>';
}
?></li>
<?php
}
?>
</ul>
</div>
<?php
$app->doInclude('comun/pie.php');
?>
</div>
</body>
</html>