-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathagenda.php
200 lines (158 loc) · 4.29 KB
/
agenda.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
<?php
//Carrega WP como FW
require_once("../wp-load.php");
$user = wp_get_current_user();
if(!is_user_logged_in()): // Impede acesso de pessoas não autorizadas
/*** REMEMBER THE PAGE TO RETURN TO ONCE LOGGED IN ***/
$_SESSION["return_to"] = $_SERVER['REQUEST_URI'];
/*** REDIRECT TO LOGIN PAGE ***/
header("location: /");
endif;
//Carrega os arquivos de funções
require "inc/function.php";
?>
<?php //require_once("../../wp-load.php"); ?>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title><?php echo $GLOBALS['site_title']; ?></title>
<!-- Bootstrap core CSS -->
<link href="dist/css/bootstrap.min.css" rel="stylesheet">
<link href="css/scpsa.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/dashboard.css" rel="stylesheet">
<script src="js/jquery-3.2.1.js"></script>
<link href='calendario/fullcalendar.min.css' rel='stylesheet' />
<link href='calendario/fullcalendar.print.min.css' rel='stylesheet' media='print' />
<script src='calendario/lib/moment.min.js'></script>
<script src='calendario/lib/jquery.min.js'></script>
<script src='calendario/fullcalendar.min.js'></script>
<script src='calendario/locale/pt-br.js'></script>
<script>
$(document).ready(function() {
var initialLocaleCode = 'pt-br';
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listWeek'
},
defaultDate: '<?php echo date('Y-m-d'); ?>',
navLinks: true, // can click day/week names to navigate views
editable: true,
height: 'auto',
eventLimit: false, // allow "more" link when too many events
events: [
<?php
global $wpdb;
$local = "";
$linguagem = "";
$projeto = "";
if(isset($_GET['p'])){
switch($_GET['p']){
case "aniversario":
$aniversario = " AND sc_evento.categoria <> '' ";
break;
}
}else{
$aniversario = "";
}
if(isset($_GET['filtro'])){
if($_GET['local'] == 0){
$local = "";
}else{
$local = " AND idLocal = '".$_GET['local']."' ";
}
if($_GET['linguagem'] == 0){
$linguagem = "";
}else{
$linguagem = " AND idLinguagem = '".$_GET['linguagem']."' ";
}
if($_GET['projeto'] == 0){
$projeto = "";
}else{
$projeto = " AND idProjeto = '".$_GET['projeto']."' ";
}
}
if(isset($_GET['status'])){
switch($_GET['status']){
case 1:
$sql_status = " AND status = '2' ";
break;
case 2:
$sql_status = " AND status = '3' ";
break;
case 4:
$sql_status = " AND status = '4' ";
break;
default:
$sql_status = "";
break;
}
}else{
$sql_status = "";
}
$sql_busca = "SELECT sc_evento.idEvento,nomeEvento,data,hora,mapas,dataEnvio,idLocal,status FROM sc_agenda, sc_evento
WHERE sc_evento.idEvento = sc_agenda.idEvento AND dataEnvio IS NOT NULL $aniversario $linguagem $local $projeto $sql_status" ;
$res = $wpdb->get_results($sql_busca,ARRAY_A);
for($i = 0; $i < count($res); $i++){
$local = tipo($res[$i]['idLocal']);
$title = addslashes($res[$i]['nomeEvento']);
$data = $res[$i]['data'];
$hora = $res[$i]['hora'];
$loc = addslashes($local['tipo']);
echo "{title: '".$title."',";
echo "start: '".$data."T".$hora."',";
echo " url:'busca.php?p=view&tipo=evento&id=".$res[$i]['idEvento']."'";
if($res[$i]['status'] == 2){
echo " , backgroundColor: 'red'";
}
if($res[$i]['status'] == 3){
echo " , backgroundColor: 'blue'";
}
if($res[$i]['status'] == 4){
echo " , backgroundColor: 'green'";
}
echo "},";
}
?>
]
});
});
</script>
<style>
body {
margin: 40px 10px;
padding: 0;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
font-size: 14px;
}
#calendar {
margin: 0 auto;
padding-left: 270px;
}
.fc-scroller{
overflow: none !important;
}
@media (min-width: 992px){
#calendar{
padding-left: 270px;
}
@media print {
.sidebar { display:none; }
body { background: #fff; }
}
}
</style>
</head>
<body>
<?php include "menu/me_agenda.php"; ?>
<br /><br />
<div id='calendar'>
<?php //echo $sql_busca; ?>
<br /><br />
</div>
<?php
include "footer.php";
?>