-
Notifications
You must be signed in to change notification settings - Fork 3
/
evento.php
269 lines (258 loc) · 10.5 KB
/
evento.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
<?php
//session_start();
include_once 'evento/conexao.php';
$result_events = 'SELECT id, title, color, start, end FROM events';
$resultado_events = mysqli_query($conn, $result_events);
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset='utf-8' />
<title>Agendamento de Salas - UDF</title>
<link href='evento/css/bootstrap.min.css' rel='stylesheet'>
<link href='evento/css/fullcalendar.min.css' rel='stylesheet' />
<link href='evento/css/fullcalendar.print.min.css' rel='stylesheet' media='print' />
<link href='evento/css/personalizado.css' rel='stylesheet' />
<script src='evento/js/personalizado.js'></script>
<script src='evento/js/jquery.min.js'></script>
<script src='evento/js/bootstrap.min.js'></script>
<script src='evento/js/moment.min.js'></script>
<script src='evento/js/fullcalendar.min.js'></script>
<script src='evento/locale/pt-br.js'></script>
<!--<script src="js/jquery-3.3.1.slim.min.js"></script>-->
<script src="evento/js/popper.min.js"></script>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: Date(),
navLinks: true, // can click day/week names to navigate views
editable: true,
eventLimit: true, // allow "more" link when too many events
eventClick: function(event) {
$('#visualizar #id').text(event.id);
$('#visualizar #id').val(event.id);
$('#visualizar #title').text(event.title);
$('#visualizar #title').val(event.title);
$('#visualizar #start').text(event.start.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #start').val(event.start.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #end').text(event.end.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #end').val(event.end.format('DD/MM/YYYY HH:mm:ss'));
$('#visualizar #color').val(event.color);
$('#visualizar').modal('show');
return false;
},
selectable: true,
selectHelper: true,
select: function(start, end){
$('#cadastrar #start').val(moment(start).format('DD/MM/YYYY HH:mm:ss'));
$('#cadastrar #end').val(moment(end).format('DD/MM/YYYY HH:mm:ss'));
$('#cadastrar').modal('show');
},
events: [
<?php
while ($row_events = mysqli_fetch_array($resultado_events)) {
?>
{
id: '<?php echo $row_events['id']; ?>',
title: '<?php echo $row_events['title']; ?>',
start: '<?php echo $row_events['start']; ?>',
end: '<?php echo $row_events['end']; ?>',
color: '<?php echo $row_events['color']; ?>',
},<?php
}
?>
]
});
});
//Mascara para o campo data e hora
function DataHora(evento, objeto){
var keypress=(window.event)?event.keyCode:evento.which;
campo = eval (objeto);
if (campo.value == '00/00/0000 00:00:00'){
campo.value=""
}
caracteres = '0123456789';
separacao1 = '/';
separacao2 = ' ';
separacao3 = ':';
conjunto1 = 2;
conjunto2 = 5;
conjunto3 = 10;
conjunto4 = 13;
conjunto5 = 16;
if ((caracteres.search(String.fromCharCode (keypress))!=-1) && campo.value.length < (19)){
if (campo.value.length == conjunto1 )
campo.value = campo.value + separacao1;
else if (campo.value.length == conjunto2)
campo.value = campo.value + separacao1;
else if (campo.value.length == conjunto3)
campo.value = campo.value + separacao2;
else if (campo.value.length == conjunto4)
campo.value = campo.value + separacao3;
else if (campo.value.length == conjunto5)
campo.value = campo.value + separacao3;
}else{
event.returnValue = false;
}
}
</script>
</head>
<body>
<div class="container">
<div class="page-header">
<h3>Agende sua aula ou evento selecionando uma data</h3>
</div>
<?php
if (isset($_SESSION['msg'])) {
echo $_SESSION['msg'];
unset($_SESSION['msg']);
}
?>
<div id='calendar'></div>
</div>
<div class="modal fade" id="visualizar" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title text-center">Dados do Evento</h4>
</div>
<div class="modal-body">
<div class="visualizar">
<dl class="dl-horizontal">
<dt>ID do Evento</dt>
<dd id="id"></dd>
<dt>Titulo do Evento</dt>
<dd id="title"></dd>
<dt>Inicio do Evento</dt>
<dd id="start"></dd>
<dt>Fim do Evento</dt>
<dd id="end"></dd>
</dl>
<button class="btn btn-canc-vis btn-warning">Editar</button>
<!--ainda em construção - opção 1-->
<button class="btn btn-data-confirm btn-danger">Apagar</button>
</div>
<div class="form">
<form class="form-horizontal" method="POST" action="evento/proc_edit_evento.php">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Titulo</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="title" id="title" placeholder="Titulo do Evento">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Cor</label>
<div class="col-sm-10">
<select name="color" class="form-control" id="color">
<option value="">Selecione</option>
<option style="color:#FFD700;" value="#FFD700">Amarelo</option>
<option style="color:#0071c5;" value="#0071c5">Azul Turquesa</option>
<option style="color:#FF4500;" value="#FF4500">Laranja</option>
<option style="color:#8B4513;" value="#8B4513">Marrom</option>
<option style="color:#1C1C1C;" value="#1C1C1C">Preto</option>
<option style="color:#436EEE;" value="#436EEE">Royal Blue</option>
<option style="color:#A020F0;" value="#A020F0">Roxo</option>
<option style="color:#40E0D0;" value="#40E0D0">Turquesa</option>
<option style="color:#228B22;" value="#228B22">Verde</option>
<option style="color:#8B0000;" value="#8B0000">Vermelho</option>
</select>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Data Inicial</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="start" id="start" onKeyPress="DataHora(event, this)">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Data Final</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="end" id="end" onKeyPress="DataHora(event, this)">
</div>
</div>
<input type="hidden" class="form-control" name="id" id="id">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="button" class="btn btn-canc-edit btn-primary">Cancelar</button>
<button type="submit" class="btn btn-warning">Salvar Alterações</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="cadastrar" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title text-center">Cadastrar Evento</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" method="POST" action="evento/proc_cad_evento.php">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Titulo</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="title" placeholder="Titulo do Evento">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Cor</label>
<div class="col-sm-10">
<select name="color" class="form-control" id="color">
<option value="">Selecione</option>
<option style="color:#FFD700;" value="#FFD700">Amarelo</option>
<option style="color:#0071c5;" value="#0071c5">Azul Turquesa</option>
<option style="color:#FF4500;" value="#FF4500">Laranja</option>
<option style="color:#8B4513;" value="#8B4513">Marrom</option>
<option style="color:#1C1C1C;" value="#1C1C1C">Preto</option>
<option style="color:#436EEE;" value="#436EEE">Royal Blue</option>
<option style="color:#A020F0;" value="#A020F0">Roxo</option>
<option style="color:#40E0D0;" value="#40E0D0">Turquesa</option>
<option style="color:#228B22;" value="#228B22">Verde</option>
<option style="color:#8B0000;" value="#8B0000">Vermelho</option>
</select>
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Data Inicial</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="start" id="start" onKeyPress="DataHora(event, this)">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Data Final</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="end" id="end" onKeyPress="DataHora(event, this)">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-success">Cadastrar</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
$('.btn-canc-vis').on("click", function() {
$('.form').slideToggle();
$('.visualizar').slideToggle();
});
$('.btn-canc-edit').on("click", function() {
$('.visualizar').slideToggle();
$('.form').slideToggle();
});
</script>
</body>
</html>