-
Notifications
You must be signed in to change notification settings - Fork 0
/
home_coordenador.php
343 lines (313 loc) · 11.6 KB
/
home_coordenador.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
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<?php
session_start();
if (empty($_SESSION["nome"])) {
header("Location: index.php");
}
?>
<!DOCTYPE html>
<html class="h-100">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="icon.png">
<title>Biblioteca Virtual</title>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/requisicao.js"></script>
<script src="js/edit_perfil.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Comfortaa&display=swap" rel="stylesheet">
<link rel='stylesheet' href='https://use.fontawesome.com/releases/v5.7.0/css/all.css' integrity='sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ' crossorigin='anonymous'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="css/estilo.css" type="text/css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pretty-checkbox@3.0/dist/pretty-checkbox.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body class="d-flex flex-column h-100">
<div id="page-content">
<?php
require "grid/nav.php";
?>
<?php
require "grid/mini_nav.php";
?>
<!-- Tela inicial -->
<?php
$var = $_GET["var"];
if(isset($var) && $var == 1){
$x = 1;
}
else{
$x = 0;
}
?>
<div class="pt-4 text-black flex-shrink-0" id="displayHome">
<div class="container">
<div class="row p-2" style="border: solid 2px black;">
<div id="form" class="col-xl">
<h3 class="titulos">Pesquisa de Projetos</h3>
<form class="textos" action="home_coordenador.php?var=<?php echo $x?>" method="POST">
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputNome">Pesquisa pelo nome do projeto</label>
<input type="text" class="form-control" name="pesquisanome" id="inputNome">
</div>
<div class="form-group col-md-4">
<label for="inputCurso">Curso</label>
<select id="inputCurso" class="form-control" name="pesquisacurso">
<option selected value="">Escolha..</option>
<?php
require 'config.php';
$pesquisaano = "";
$pesquisanome = "";
$pesquisacurso = "";
$sqlcurso = "SELECT * FROM curso";
$pdocurso = $con->prepare($sqlcurso);
$pdocurso->execute();
while($curso = $pdocurso->fetch(PDO::FETCH_OBJ)){
?>
<option value="<?php echo $curso->idCurso?>"><?php echo $curso->nome ?></option>
<?php
}
?>
</select>
</div>
<div class="form-group col-md-2">
<label for="inputAno">Ano</label>
<select id="inputAno" class="form-control" name="pesquisaano">
<?php
$sqlano = "SELECT * FROM projeto GROUP BY ano ORDER BY ano desc";
$pdoano = $con->prepare($sqlano);
$pdoano->execute();
?>
<option selected value="">Escolha..</option>
<?php
while($ano = $pdoano->fetch(PDO::FETCH_OBJ)){
?>
<option value="<?php echo $ano->ano ?>"><?php echo $ano->ano ?></option>
<?php
}
?>
</select>
</div>
</div>
<button type="submit" class="btn btn-outline btn-lg" style="float: right;">Pesquisar</button>
</form>
<?php
extract($_POST);
?>
</div>
</div>
<div class="row">
<button class="btn btn-cad ml-3 mt-4 textos" data-toggle="modal" data-target="#cadastros">+Cadastrar</button>
</div>
</div>
</div>
<div class="pt-4 text-black col-xl" id="displayHome">
<?php
$estilopendente = "";
$estiloverificado = "";
if(isset($_GET["var"]) && $_GET["var"] == 1){
$estiloverificado = "active";
}
else{
$estilopendente = "active";
}
?>
<a href="home_coordenador.php?var=0" class="btn btn-outline <?= $estilopendente ?>" id="btnpendente">Pendentes</a>
<a href="home_coordenador.php?var=1" class="btn btn-outline <?= $estiloverificado ?>" id="btnverificado">Verificados</a>
</div>
<?php
$tabelapendente = "";
$tabelaverificado = "";
if(isset($_GET["var"]) && $_GET["var"] == 0){
$tabelapendente = '<th scope="col">Nome</th>
<th scope="col">Alunos</th>
<th scope="col">Arquivo</th>
<th scope="col">Permitir</th>
<th scope="col">Negar</th';
}
else{
$tabelaverificado = '<th scope="col">Nome</th>
<th scope="col">Alunos</th>
<th scope="col">Arquivo</th>';
}
?>
<table class="table table-bordered table-hover table-responsive mt-2" id="resultado">
<thead class="cinza">
<tr>
<?php
echo $tabelapendente.$tabelaverificado;
?>
</tr>
</thead>
<tbody class="table">
<?php
if ($var == 1) {
$sqlprojeto = "SELECT * FROM projeto WHERE verificado = 1 AND nome LIKE '%$pesquisanome%' AND ano LIKE '%$pesquisaano%' AND idCurso LIKE '%$pesquisacurso%'";
}
else{
$sqlprojeto = "SELECT * FROM projeto WHERE verificado = 0 AND nome LIKE '%$pesquisanome%' AND ano LIKE '%$pesquisaano%' AND idCurso LIKE '%$pesquisacurso%'";
}
$pdoprojeto = $con->prepare($sqlprojeto);
$pdoprojeto->execute();
$count = $pdoprojeto->rowCount();
if ($count > 0) {
while($projeto = $pdoprojeto->fetch(PDO::FETCH_OBJ)){
?>
<tr class="justify-content-center">
<?php
if ($var == 1) {
?>
<td>
<?php echo $projeto->nome.' ('.$projeto->ano.')';
if($projeto->favorito == 1) {
?>
<i class="fa fa-star" style="color: #E8C61C;"></i></td>
<?php
}
?></td>
<td><?php echo $projeto->alunos?></td>
<td style="width: 4%;"><?php echo '<a href ="upload/'.$projeto->arquivo.'" class="btn btn-outline ml-2"><i class="fa fa-file-pdf-o"></i></a>'; ?></td>
<?php
} else{
?>
<td>
<?php echo $projeto->nome.' ('.$projeto->ano.')';
if($projeto->favorito == 1) {
?>
<i class="fa fa-star" style="color: #E8C61C;"></i></td>
<?php
}
?></td>
<td><?php echo $projeto->alunos?></td>
<td style="width: 4%;"><?php echo '<a href ="upload/'.$projeto->arquivo.'" class="btn btn-outline ml-2"><i class="fa fa-file-pdf-o"></i></a>'; ?></td>
<td style="width: 8%;" class="pl-5"><a href="func/permitir.php?id=<?php echo $projeto->idProjeto ?>" class="btn btn-outline-success"><i class="far fa-thumbs-up"></i></a></td>
<td style="width: 8%;" class="pl-5"><a href="func/negar.php?id=<?php echo $projeto->idProjeto ?>" class="btn btn-outline-danger" onclick="return confirm('Deseja realmente excluir o projeto selecionado?')"><i class="far fa-thumbs-down"></i></a></td>
<?php
}
?>
</tr>
<?php
}
}
else{
?>
<div class="alert alert-danger m-3" role="alert">
Nenhum resultado encontrado na pesquisa!
</div>
<script>
$(document).ready(function(){
$("#resultado").hide();
})
</script>
<?php
}
?>
</tbody>
</table>
<!-- MODAL PARA PROFESSORES -->
<div class="modal fade" id="cadastros" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="titulomodal">Escolha:
<button type="button" class="btn btn-outline active" id="abrirmodalprof" name="abrirmodalprof">Professor</button>
<button type="button" class="btn btn-outline" id="abrirmodalprojeto" name="abrirmodalprojeto">Projeto</button>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Fechar" id="apagar">
<span aria-hidden="true">×</span>
</button>
</div>
<div id="modalprof">
<form>
<div class="modal-body">
<div class="form-group">
<label for="nomeprof">Nome</label>
<input type="text" class="form-control" id="nomeprof" name="nomeprof" placeholder="Nome do professor" maxlength="70" required>
</div>
<div class="form-group">
<label for="email">E-mail</label>
<input type="email" class="form-control" id="email" name="email" placeholder="E-mail do professor" maxlength="70" required>
</div>
<div class="form-group">
<label for="senha">Gerar Senha</label>
<br>
<button type="button" class="btn btn-outline my-1 btn-lg" id="btngerarsenha"><i class="fas fa-key"></i></button>
<input type="hidden" class="form-control" id="gerarsenha" name="gerarsenha" placeholder="Senha do professor" required>
<br>
<label id="aviso" style="color: green;"></label>
</div>
</div>
<div class="modal-footer">
<button type="reset" class="btn btn-outline" data-dismiss="modal" id="btnsair">Cancelar</button>
<button type="button" class="btn btn-outline-primary" id="btncadprof">Cadastrar</button>
</div>
</form>
</div>
<div id="modalprojeto" style="display: none;">
<form action="func/cadprojeto.php" method="POST" enctype="multipart/form-data">
<div class="modal-body">
<div class="form-group">
<label for="nomeprojeto">Nome</label>
<input type="text" class="form-control" id="nomeprojeto" name="nomeprojeto" placeholder="Nome do projeto" maxlength="50" required>
</div>
<div class="form-group">
<label for="alunos">Alunos</label>
<input type="text" class="form-control" id="alunos" name="alunos" placeholder="Nome dos alunos por extenso" maxlength="255" required>
</div>
<div class="form-group">
<label for="nome">Ano</label>
<select class="form-control" id="ano" name="ano">
<?php
$ano = date('Y');
$limite = $ano - 30;
for ($i=$ano; $i >= $limite; $i--) {
?>
<option value="<?php echo $i?>"><?php echo $i ?></option>
<?php
}
?>
</select>
</div>
<div class="custom-file">
<input type="file" name="arquivo" id="arquivo" accept="application/pdf">
<div class="text-danger">Somente formato PDF.</div>
</div>
<br>
<div class="pretty p-svg p-curve ml-3 mt-3 mb-4">
<input type="checkbox" name="favorito" id="favorito">
<div class="state p-success">
<!-- svg path -->
<svg class="svg svg-icon" viewBox="0 0 20 20">
<path d="M7.629,14.566c0.125,0.125,0.291,0.188,0.456,0.188c0.164,0,0.329-0.062,0.456-0.188l8.219-8.221c0.252-0.252,0.252-0.659,0-0.911c-0.252-0.252-0.659-0.252-0.911,0l-7.764,7.763L4.152,9.267c-0.252-0.251-0.66-0.251-0.911,0c-0.252,0.252-0.252,0.66,0,0.911L7.629,14.566z" style="stroke: white;fill:white;"></path>
</svg>
<label>Destaque</label>
</div>
</div>
</div>
<div class="modal-footer">
<button type="reset" class="btn btn-outline" data-dismiss="modal" id="btnsair">Cancelar</button>
<button type="submit" class="btn btn-outline-primary" id="btncadprojeto">Cadastrar</button>
</div>
</form>
</div>
<label id="sucesso" style="display: none;">
Cadastro concluído!
</label>
<label id="fracasso" style="display: none;">
Preencha os dados corretamente!
</label>
</div>
</div>
</div>
<?php
require "grid/perfil.php";
?>
</div>
<?php
require "grid/footer.php";
?>
</body>
</html>