-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
145 lines (125 loc) · 6.34 KB
/
dashboard.php
File metadata and controls
145 lines (125 loc) · 6.34 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
session_start();
if(!isset($_SESSION['usuario'])){
header('Location: dashboard.php');
}
require_once('baseDatos.php');
$bd = BaseDeDatos::getInstancia();
$conexion = $bd -> getConexion();
$current_id = $_SESSION['idUser'];
require_once('template/header.php');
?>
<main><h4 class="title1">Tareas vencidas </h4>
<div class="txt_btn">
<p><button onclick="location.href='formulario.php'"
id="btn_agregar_id" type="button"
class="btn waves-effect blue-grey lighten-2">Agregar Tarea</button></p>
</div>
<br>
<table class="highlight responsive-table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Tarea</th>
<th scope="col">Asignado por</th>
<th scope="col">Fecha Vencimiento</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php
$sentencia = "SELECT id_tarea, titulo, nombre_Apellido , fecah_venc FROM tareas
INNER JOIN usuarios ON usuarios.id_usuario = tareas.id_asignador
WHERE (fecah_venc < CURRENT_DATE) AND (id_user_asignado = '$current_id') AND
(tareas.estatus = 1) ORDER BY id_tarea";
$consulta_dos = $conexion -> prepare($sentencia);
$consulta_dos -> execute();
$cont = 1;
while($fila = $consulta_dos -> fetch()){ ?>
<tr>
<th scope="row"><?php echo $cont++; ?></th>
<td><?php echo $fila['titulo']; ?></td>
<td><?php echo $fila['nombre_Apellido']; ?></td>
<td><?php echo $fila['fecah_venc']; ?></td>
<td> <button onclick="location.href='eliminarTarea.php?id_elim=<?php echo $fila['id_tarea']?>'" type="button" class="btn waves-effect deep-orange darken-4">X</button></td>
</tr>
<?php
}
?>
</tbody>
</table><br>
<h4>Tareas por realizar</h4><br>
<table class="highlight responsive-table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Tarea</th>
<th scope="col">Asignado por</th>
<th scope="col">Fecha Vencimiento</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php
$sentencia = "SELECT id_tarea, titulo, nombre_Apellido , fecah_venc FROM tareas
INNER JOIN usuarios ON usuarios.id_usuario = tareas.id_asignador
WHERE (id_user_asignado = '$current_id') AND
(tareas.estatus = 1) AND (fecah_venc > CURRENT_DATE) ORDER BY id_tarea";
$consulta_dos = $conexion -> prepare($sentencia);
$consulta_dos -> execute();
$datos = array();
//$_SESSION['Vencimiento'] = null;
$cont = 1;
while($fila = $consulta_dos -> fetch()){ ?>
<tr>
<th scope="row"><?php echo $cont++; ?></th>
<td><?php echo $fila['titulo']; ?></td>
<td><?php echo $fila['nombre_Apellido']; ?></td>
<td><?php echo $fila['fecah_venc']; ?></td>
<td><button onclick="location.href='seguimiento.php?id_elim=<?php echo $fila['id_tarea']?>'" type="button" class="btn btn-info">Ver</button></td>
</tr>
<?php
}
$_SESSION['tareas'] = $datos;
?>
</tbody>
</table><br>
<h4>Tareas asignadas a otros</h4><br>
<table class="highlight responsive-table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Tarea</th>
<th scope="col">Asignado a</th>
<th scope="col">Fecha Vencimiento</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php
$sentencia = "SELECT id_tarea, titulo, nombre_Apellido , fecah_venc FROM tareas
INNER JOIN usuarios ON usuarios.id_usuario = tareas.id_user_asignado
WHERE id_asignador = '$current_id' AND
(tareas.estatus = 1) ORDER BY id_tarea";
$consulta_tres = $conexion -> prepare($sentencia);
$consulta_tres -> execute();
$cont = 1;
while($fila = $consulta_tres -> fetch()){
?>
<tr>
<th scope="row"><?php echo $cont++; ?></th>
<td><?php echo $fila['titulo']; ?></td>
<td><?php echo $fila['nombre_Apellido']; ?></td>
<td><?php echo $fila['fecah_venc']; ?></td>
<td>
<button onclick="location.href='actualizacion.php?id_elim=<?php echo $fila['id_tarea']?>'" type="button" class="btn btn-primary">Editar</button>
<button onclick="location.href='eliminarTarea.php?id_elim=<?php echo $fila['id_tarea']?>'" type="button" class="btn waves-effect deep-orange darken-4">X</button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</main>
<?php require_once('template/footer.php'); ?>