-
Notifications
You must be signed in to change notification settings - Fork 0
/
lista-proyectos.php
executable file
·95 lines (74 loc) · 3.15 KB
/
lista-proyectos.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
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
<?php
include 'inc/funciones/sesiones.php';
include 'inc/funciones/funciones.php';
include 'inc/templates/header.php';
include 'inc/templates/barra.php';
?>
<div class="contenedor">
<?php
include 'inc/templates/sidebar.php';
?>
<main class="contenido-principal">
<?php
$proyecto = obtenerNombreProyecto($id_proyecto);
if($proyecto):
?>
<h1>Proyecto Actual:
<?php foreach($proyecto as $nombre): ?>
<span><?php echo $nombre['nombre']; ?></span>
<?php endforeach;?>
</h1>
<form action="#" id="formulario">
<div class="campo">
<label for="tarea">Tarea:</label>
<input type="text" placeholder="Nombre Tarea" class="nombre-tarea">
</div> <!-- <div class="campo"> -->
<div class="campo enviar">
<input type="hidden" id="id_proyecto" value="<?php echo $id_proyecto; ?>">
<input type="submit" class="boton nueva-tarea" value="Agregar">
</div> <!-- <div class="campo enviar"> -->
</form> <!-- <form action="#" id="formulario"> -->
<?php
else:
// Si no hay proyectos seleccionados
echo "<p>Selecciona un Proyecto a la izquierda</p>";
endif;
?>
<h2>Listado de Proyectos</h2>
<div class="listado-proyectos">
<ul>
<?php
// importar la conexión
include "inc/funciones/conexion.php";
try {
$sql = "SELECT id, nombre FROM proyectos";
$proyectos = $conn->query($sql);
}
catch (\Exception $e) {
$error = $e->getMessage();
echo $error;
}
if($proyectos->num_rows > 0) {
foreach($proyectos as $proyecto):
?>
<li id="proyecto:<?php echo $proyecto['id']; ?>" class="proyecto">
<p><?php echo $proyecto['nombre']; ?></p>
<div class="acciones">
<input type="hidden" id="id_proyecto" name="id_proyecto" value="<?php echo $proyecto['id']; ?>">
<input type="hidden" id="tipo" value="eliminar">
<i class="fa fa-trash"></i>
</div> <!-- <div class="acciones"> -->
</li>
<?php endforeach;
}
else {
echo "<p class='lista-vacia'>Error</p>";
}
?>
</ul>
</div> <!-- <div class="listado-usuarios"> -->
</main> <!-- <main class="contenido-principal"> -->
</div> <!-- <div class="contenedor"> -->
<?php
include 'inc/templates/footer.php';
?>