This repository was archived by the owner on Jan 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodificar_actividad.php
More file actions
240 lines (207 loc) · 11.5 KB
/
modificar_actividad.php
File metadata and controls
240 lines (207 loc) · 11.5 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php
include_once('session.php');
if (!isset($_SESSION['user'])) {
header('location: login.php');
}
if ($_SESSION['user']['categoryName'] != 'ONG' && !$esGestor && $_SESSION['user']['categoryName'] != 'PAS') {
header('location : perfil.php');
}
include_once('../../database_conn.php');
$conexion = conexion();
//Campos De la actividad que estoy modificando
$id = $_GET['id'];
$query = "SELECT * FROM Actividad WHERE ID=$id";
$resultado = mysqli_query($conexion, $query);
$row = mysqli_fetch_assoc($resultado);
$titulo = $row['Titulo']; //Titulo
$tipo = $row['tipo']; //Clasificacion - Debe ser sin aceptar, pero no puede salir de aquí sin ser de un tipo.
$proyecto = $row['proyecto']; //Proyecto - Debe ser null, pero no se puede salir de aquí sin que el gestor diga si se asigna o si no.
$participantes = $row['participantes']; //Numero de participantes
$horasDia = $row['horasDia']; //Numero de horas al dia
$descripcion = $row['descripcion']; //Descripcion de la actividad
$fechaInic = $row['fechaInicio']; //Fecha de inicio de la actividad
$fechaFin = $row['fechaFin']; //Fecha fin de la actividad
$horario = $row['horario']; //Horario elegido
$archivo = $row['archivo']; //Archivo que se ha subido
//Cargo en 2 arrays las Preferencias
$query = "SELECT *
FROM Actividad_Habilidad ah,Habilidades a
WHERE ah.actividad = $id AND
ah.habilidad = a.Nombre";
$result = mysqli_query($conexion, $query);
while ($row = mysqli_fetch_assoc($result)) {
if ($row['Tipo'] == 0) {
$ambitos[] = $row['habilidad'];
} else {
$tipos[] = $row['habilidad'];
}
}
//Funciones para manejar la vista del formulario
// Permite marcar como elegido el horario preferente que estaba.
function setSelected($option, $horario)
{
if ($option === $horario) {
echo "selected";
}
}
// Permite marcar un check si la habilidad estaba en la actividad
function setChecked($skill, $preferencias) {
if($preferencias ==NULL){
return;
} else if (in_array($skill, $preferencias)) {
return "checked";
}
}
?>
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>AccionSocialMed</title>
<link rel="stylesheet" href="assetsSubirActividades/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assetsSubirActividades/css/16-scrollbar-styles-1.css">
<link rel="stylesheet" href="assetsSubirActividades/css/16-scrollbar-styles.css">
<link rel="stylesheet" href="assetsSubirActividades/css/componente-fromulario.css">
<link rel="stylesheet" href="assetsSubirActividades/css/Custom-Checkbox.css">
<link rel="stylesheet" href="assetsSubirActividades/css/Navegacin-APS.css">
<link rel="stylesheet" href="assetsSubirActividades/css/styles.css">
<style>
textarea{
height: 80%;
width: 100%;
resize: none;
color: #555;
background-color: rgb(248,249,252);
border: 1px #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
text-align: left;
}
</style>
</head>
<body>
<?php include "_navbar.php"; ?>
<div class="register-photo">
<div class="form-container">
<form method="POST" enctype="multipart/form-data" action="scripts/modificar_actividad_gestor.php">
<!--Bloque para Elegir el título -->
<?php
if ($esGestor) {
echo "<h2 class='text-center'><strong>Actividad Propuesta</strong></h2>";
} else {
echo "<h2 class='text-center'><strong>Propuesta de Modificaciones</strong></h2>";
}
?>
<div class="form-group">
<!--Parámetros Ocultos-->
<input type="hidden" name=id value="<?php echo $id?>">
<!--Clasificar Actividad / Ver clasificación -->
<div class="form-row">
<div class="col-6 col-lg-11">
<?php
if ($esGestor) {
echo '<label>Clasificar Como:</label>
<select class="form-control" name="clasificacion" required style="margin: 6px;">
<option value="Voluntariado">Voluntariado</option>
<option value="Investigación">Investigación</option>
<option value="Docencia">Docencia</option>
</select>';
} else {
echo "<label> Clasificada Como: $tipo";
}
?>
</div>
</div>
<div class="form-row">
<!--Primera Columna + Archivo + Descripcion -->
<div class="col-6 col-lg-6">
<div class="form-row">
<div class="col-lg-8">
<label>Titulo:</label>
<input class='form-control' type='text' name='titulo' style='margin: 6px;' value='<?php echo $titulo; ?>' required>
<label>Participantes:</label>
<input class='form-control' type='number' name='participantes' style='margin: 6px;' value='<?php echo $participantes; ?>' required>
<label>Horas/Día:</label>
<input class='form-control' type='number' name='horasDia' required placeholder='H/D' style='margin: 6px;' value='<?php echo $horasDia; ?>'>
<label>Descripción de la actividad:</label>
<div style='height: 200px; width: 288%;margin-bottom: -20px;'>
<textarea rows='8' name='descripcion' required>
<?php echo $descripcion; ?>
</textarea>
</div>
<!-- MAX_FILE_SIZE debe preceder al campo de entrada del fichero (Para subir archivos al servidor)-->
<input type="hidden" name="MAX_FILE_SIZE" value="30000000" />
<?php
if ($archivo != NULL) {
echo "<label>Archivos adicionales: <a href='$archivo' target='_blank'>" . basename($archivo) . "</a><label>";
}
?>
</div>
</div>
</div>
<!-- Segunda Columna -->
<div class="col-lg-5 ">
<label>Fecha Inicio:</label>
<input class='form-control' type='date' name='fechaInicio' required style='margin: 6px;' value='<?php echo $fechaInic; ?>'>
<label>Fecha Finalización:</label>
<input class='form-control' type='date' name='fechaFinalizacion' required style='margin: 6px;' value='<?php echo $fechaFin; ?>'>
<label>Horario Preferente:</label>
<select class="form-control" name="horario" required style="margin: 6px;">
<option value="Mañana">Mañana</option>
<option value="Tarde" <?php setSelected('Tarde', $horario) ?>>Tarde</option>
<option value="Noche" <?php setSelected('Noche', $horario) ?>>Noche</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="col-6 col-lg-8">
<div class="form-row">
<!--Ámbito -->
<div class="col">
<h1 style="font-size: 24px;"><strong>Ámbito:</strong></h1>
<?php
$query = "SELECT * FROM Habilidades WHERE Tipo = 0";
$res = mysqli_query($conexion, $query);
while ($row = mysqli_fetch_assoc($res)) {
echo "<div class='form-check' style='margin: 3px;'>
<input value='".$row['Nombre']."' name='ambitos[]' class='form-check-input' type='checkbox' id='formCheck' " . setChecked($row['Nombre'], $ambitos) . ">
<label class='form-check-label' for='formCheck'>" . $row['Nombre'] . "</label>
</div>";
}
?>
</div>
<!--Tipo-->
<div class="col">
<h1 style="font-size: 24px;"><strong>Tipo:</strong></h1>
<?php
$query = "SELECT * FROM Habilidades WHERE Tipo = 1";
$res = mysqli_query($conexion, $query);
while ($row = mysqli_fetch_assoc($res)) {
echo "<div class='form-check' style='margin: 3px;'>
<input value='" . $row['Nombre'] . "' name='tipos[]' class='form-check-input' type='checkbox' id='formCheck' " . setChecked($row['Nombre'], $tipos) . ">
<label class='form-check-label' for='formCheck'>" . $row['Nombre'] . "</label>
</div>";
}
?>
</div>
</div>
</div>
</div>
<!--Botonera -->
<div class='form-group'>
<button style='background: #56c6c6; max-width: 20%; margin-left: 40%;' class='btn btn-primary btn-block' type='submit' name='Reenviar'>Proponer Modificacion</button>
<button style='background: #56c6c6; max-width: 20%; margin-left: 40%;' class='btn btn-primary btn-block' type='submit' name='Aceptar'>Aceptar Actividad</button>
<button style='background: #56c6c6; max-width: 20%; margin-left: 40%;' class='btn btn-primary btn-block' type='submit' name='Denegar'>Denegar Actividad</button>
</div>
</form>
</div>
</div>
<script src="assetsSubirActividades/js/jquery.min.js"></script>
<script src="assetsSubirActividades/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>