| Server IP : 20.75.53.88 / Your IP : 216.73.217.72 [ Web Server : Apache System : Linux VMRALP-3 4.4.0-256-generic #290~14.04.1-Ubuntu SMP Thu Jun 20 09:24:50 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29+esm15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Domains : 3 Domains MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/portais/camarabeberibe/paginas/prefeitura__/ |
Upload File : |
<?php
require_once('bdd.php');
$sql = "SELECT id, title, start, end, color, resume FROM events ";
$req = $bdd->prepare($sql);
$req->execute();
$events = $req->fetchAll();
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FullCalendar -->
<link href='./assets/FullCalendar/css/fullcalendar.css' rel='stylesheet'/>
</head>
<body>
<section>
<div class="container">
<div class="row">
<div class="col-lg-12 content text-justify">
<div class="col-lg-16">
<div class="page-header">
<h1><?php echo $h->agenda_titulo ?></h1>
<ol class="breadcrumb">
<li><a href="#" onclick="window.history.back();">Voltar</a></li>
</ol>
</div>
<div class="col-lg-16 text-center">
<h1>Agenda do Prefeito</h1>
<p></p>
<div id="calendar" class="col-centered">
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="ModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form class="form-horizontal" method="POST" action="editEventTitle.php">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">X</span></button>
<h4 class="modal-title" id="myModalLabel">Visualizar Evento</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="title" class="col-md-2 control-label">Evento</label>
<div class="col-md-13">
<input type="text" name="title" class="form-control" id="title" placeholder="Titulo" readonly>
</div>
</div>
<div class="form-group">
<label for="resume" class="col-md-2 control-label">Resumo</label>
<div class="col-md-13">
<textarea class="form-control" rows="7" id="resume" placeholder="Resumo da agenda" name="resume" readonly></textarea>
</div>
</div>
<div class="form-group">
<label for="start" class="col-md-2 control-label">Data</label>
<div class="col-md-13">
<input type="text" name="start" class="form-control" id="start" placeholder="Data inicial" readonly>
</div>
</div>
<input type="hidden" name="id" class="form-control" id="id">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-info" data-dismiss="modal">Fechar</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!--INICIO DA BARRA LATERAL-->
<?php include "menu_lateral.php" ?>
<!--FIM DA BARRA LATERAL-->
</div>
</div>
</section>
</body>
<!-- FullCalendar -->
<script src='./assets/FullCalendar/js/moment.min.js'></script>
<!--<script src='./assets/FullCalendar/js/fullcalendar/fullcalendar.min.js'></script>-->
<script src='./assets/FullCalendar/js/fullcalendar/fullcalendar.js'></script>
<script src='./assets/FullCalendar/js/fullcalendar/locale/pt-br.js'></script>
<script>
$(document).ready(function () {
var date = new Date();
var yyyy = date.getFullYear().toString();
var mm = (date.getMonth() + 1).toString().length == 1 ? "0" + (date.getMonth() + 1).toString() : (date.getMonth() + 1).toString();
var dd = (date.getDate()).toString().length == 1 ? "0" + (date.getDate()).toString() : (date.getDate()).toString();
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listMonth'
},
locale: 'pt-br',
height: 900,
contentHeight: 900,
defaultDate: yyyy + "-" + mm + "-" + dd,
editable: true,
eventLimit: true, // allow "more" link when too many events
selectable: true,
selectHelper: true,
select: function (start, end) {
$('#ModalAdd #start').val(moment(start).format('YYYY-MM-DD HH:mm:ss'));
$('#ModalAdd #end').val(moment(end).format('YYYY-MM-DD HH:mm:ss'));
$('#ModalAdd').modal('show');
},
eventRender: function (event, element) {
element.bind('click', function () {
$('#ModalEdit #id').val(event.id);
$('#ModalEdit #title').val(event.title);
$('#ModalEdit #resume').val(event.resume);
$('#ModalEdit #start').val(event.start.format('DD/MM/YYYY - HH:mm'));
$('#ModalEdit #end').val(event.end);
$('#ModalEdit').modal('show');
});
},
eventDrop: function (event, delta, revertFunc) { // si changement de position
edit(event);
},
eventResize: function (event, dayDelta, minuteDelta, revertFunc) { // si changement de longueur
edit(event);
},
events: [
<?php foreach($events as $event):
$start = explode(" ", $event['start']);
$end = explode(" ", $event['end']);
if ($start[1]=='00:00:00') {
$start = $start[0];
} else {
$start = $event['start'];
}
if ($end[1]=='00:00:00') {
$end = $end[0];
} else {
$end = $event['end'];
}
?>
{
id: '<?php echo $event['id']; ?>',
title: '<?php echo $event['title']; ?>',
start: '<?php echo $start; ?>',
end: '<?php echo $end; ?>',
color: '<?php echo $event['color']; ?>',
resume: '<?php echo $event['resume']; ?>',
},
<?php endforeach; ?>
],
timeFormat: 'H:mm'
});
function edit(event) {
start = event.start.format('YYYY-MM-DD HH:mm:ss');
if (event.end) {
end = event.end.format('YYYY-MM-DD HH:mm:ss');
} else {
end = start;
}
id = event.id;
Event = [];
Event[0] = id;
Event[1] = start;
Event[2] = end;
$.ajax({
url: 'editEventDate.php',
type: "POST",
data: {Event: Event},
success: function (rep) {
if (rep == 'OK') {
alert('Evento gravado com sucesso!');
} else {
alert('Não foi possivel salvar o evento.');
}
}
});
}
});
</script>
</html>