-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevento.php
More file actions
458 lines (404 loc) · 16.1 KB
/
evento.php
File metadata and controls
458 lines (404 loc) · 16.1 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
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<?php
session_start();
if(!isset($_SESSION["id"])){
header('Location: login.php');
}
$nombre = $_SESSION["nombre"];
$id = $_SESSION["id"];
$idEvento = $_GET["idEvento"];
require ('connection.php');
$connection=connect();
$query = "SELECT * FROM evento e, adminsevento adm WHERE e.id_evento = '$idEvento' and adm.idEvento = '$idEvento';";
$result=$connection->query($query);
if($result){
$row = $result->fetch_assoc();
$creador = @$row['idUsuario'];
$query2 = "SELECT idEvento,SUM(boletosConfirmados) as sumaBoletos FROM invitadosevento WHERE idEvento='$idEvento' GROUP BY idEvento;";
$result2=$connection->query($query2);
$row2 = $result2->fetch_assoc();
$boletos = @$row2['sumaBoletos'];
disconnect($connection);
} else {
disconnect($connection);
echo "<script>window.alert('Evento No Mostrado Correctamente:');window.location.href = 'index.php';</script>";
}
$connection=connect();
$query = "SELECT * FROM evento WHERE id_evento = '$idEvento';";
$result=$connection->query($query);
$row = $result->fetch_assoc();
$fecha = $row['fecha'];
$ubicacion = $row['lugar'];
$descripcion = $row['descripcion'];
$hashtag = $row['hashtag'];
$nombreE = $row['nombre'];
// $boletos = $row['boletosConfirmados'];
//$creador = $row['idUsuario'];
$dir_fotos = $row['ubicacion_Media'];
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="style.css">
<link rel="shortcut icon" href="logo.png">
<title>Agrega Evento</title></head>
<body>
<nav class="navbar navbar-expand-lg static-top navbar-dark" style="background-color:rgb(52, 13, 95);">
<div class="container">
<a class="navbar-brand" href="index.php">
<img src="logo.png" alt="Logo" srcset="">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ms-auto">
<li class="nav-item active">
<a class="nav-link" href="index.php">Inicio</a>
</li>
<li class="nav-item">
<a class="nav-link" href="agregar.php">Agregar Fiesta</a>
</li>
<li class="nav-item">
<a class="nav-link" href="buscar.php">Buscar Fiesta</a>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle active" data-bs-toggle="dropdown"><?php echo $_SESSION["nombre"]; ?></a>
<div class="dropdown-menu dropdown-menu-end">
<a href="eventos_usuario.php" class="dropdown-item">Ver Mis Eventos</a>
<a href="invitaciones_usuario.php" class="dropdown-item">Ver Mis Invitaciones</a>
<a href="logout.php?salir=true" class="dropdown-item">Logout</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
<pre id="content" style="white-space: pre-wrap;"></pre>
<br>
<h1 style="text-align: center;">¡<?php echo $nombreE;?>!</h1>
<br>
<div class="container" style="margin-left: auto;margin-right: auto;">
<!-- class="row row-cols-1 row-cols-md-3 "-->
<div id="datos" class="grid row g-4" style="text-align:center;">
<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<div class="card-body">
<h5 class="card-title">Fecha del Evento</h5>
<p class="card-text"><?php echo $fecha;?></p>
</div>
</div>
</div>
<?php if($id == $creador){ ?>
<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<div class="card-body">
<h5 class="card-title">Boletos confirmados</h5>
<p class="card-text"><?php echo $boletos;?></p>
</div>
</div>
</div>
<?php } ?>
<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<img src="cumpleaños3.jpg" class="card-img-top" alt="...">
</div>
</div>
<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<div class="container">
<div id="map" style="margin-left: auto;margin-right: auto;height: 350px;width: 100%;"></div>
</div>
<div class="card-body">
<h5 class="card-title">Ubicación</h5>
<p class="card-text"><?php echo $ubicacion; ?></p>
</div>
</div>
</div>
<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<div class="card-body">
<h5 class="card-title">Descripción</h5>
<p class="card-text"><?php echo $descripcion; ?></p>
</div>
</div>
</div>
<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<div class="card-body">
<h5 class="card-title"><?php echo $hashtag; ?></h5>
</div>
</div>
</div>
<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<div class="card-body">
<h5 class="card-title">Agregar a mi calendario en Google Calendar</h5>
<p class="card-text"><button onclick="callHAC()" id="Add Event"> Añadir Evento</button> </p>
</div>
</div>
</div>
<?php
$dirname = substr($dir_fotos,1).'/';
$images = glob($dirname."*.{jpg,gif,png}",GLOB_BRACE);
echo '<script>console.log("El directorio es '.$dirname.'")</script>';
foreach($images as $image) {
echo '<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<img class="card-img-top" src="'.$image.'"/>
</div>
</div>';
}
?>
<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<img src="cumpleaños.jpg" class="card-img-top" alt="...">
</div>
</div>
<div class="col-sm-4 col-md-3 py-3">
<div class="card">
<img src="cumpleaños2.jpg" class="card-img-top" alt="...">
</div>
</div>
</div>
</div>
<br><br>
<footer class="footer">
<br><br>
Comparte La Fiesta © 2021 Copyright
<br>
Ubicación: Aguascalientes, México
</footer>
<script>
window.onload = function() {
let parametros = {"hashtag":"<?php echo $hashtag;?>"}
$.ajax({
data:parametros,
type: 'POST',
url: 'instagramAPI.php',
success: function(data){
console.log(data);
document.getElementById("datos").innerHTML += data;
setTimeout(() => {
var $grid = $('.grid').masonry({
percentPosition: true,
});
$grid.masonry();
}, 50);
}
});
};
let lugar="<?php echo $ubicacion; ?>";
let map;
let infowindow;
let service;
function initMap() {
google.maps.event.addDomListener(window, 'load');
map = new google.maps.Map(document.getElementById("map"), {
center: { lat: 21.9338292, lng: -102.3196637 },
zoom: 15,
});
const request = {
query: lugar,
fields: ["name", "geometry"],
};
service = new google.maps.places.PlacesService(map);
service.findPlaceFromQuery(request, (results, status) => {
if (status === google.maps.places.PlacesServiceStatus.OK && results) {
for (let i = 0; i < results.length; i++) {
createMarker(results[i]);
}
map.setCenter(results[0].geometry.location);
}
});
}
function createMarker(place) {
if (!place.geometry || !place.geometry.location) return;
const marker = new google.maps.Marker({
map,
position: place.geometry.location,
});
google.maps.event.addListener(marker, "click", () => {
infowindow.setContent(place.name || "");
infowindow.open(map);
});
}
</script>
<!--Bootstrap y jQuery JS-->
<script src="https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js" integrity="sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D" crossorigin="anonymous" async></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyABYfdNAPibREcz-3Clw0sKIQlkW6QzgLg&libraries=places&callback=initMap" async>
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script async defer src="https://apis.google.com/js/api.js"
onload="this.onload=function(){};handleClientLoad()"
onreadystatechange="if (this.readyState === 'complete') this.onload()">
</script>
<script>
function testP(event){
console.log('Working');
}
var AddEventButton=null;
// Client ID and API key from the Developer Console
var CLIENT_ID = '705113182929-2412er76mrocql9c8n18obp2uvaca13r.apps.googleusercontent.com';
var API_KEY = 'AIzaSyCSoXISVENbLOHL06lUWvIPkpYiTzONGMc';
// Array of API discovery doc URLs for APIs used by the quickstart
var DISCOVERY_DOCS = ["https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest"];
// Authorization scopes required by the API; multiple scopes can be
// included, separated by spaces.
var SCOPES = "https://www.googleapis.com/auth/calendar";
// var authorizeButton = document.getElementById('authorize_button');
//var signoutButton = document.getElementById('signout_button');
/**
* On load, called to load the auth2 library and API client library.
*/
function handleClientLoad() {
gapi.load('client:auth2', initClient);
}
/**
* Initializes the API client library and sets up sign-in state
* listeners.
*/
function initClient() {
gapi.client.init({
apiKey: API_KEY,
clientId: CLIENT_ID,
discoveryDocs: DISCOVERY_DOCS,
scope: SCOPES
}).then(function () {
// Listen for sign-in state changes.
gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
//console.log('Hola');
// Handle the initial sign-in state.
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
AddEventButton = document.getElementById('Add Event');
//AddEventButton.onclick= handleAddEvent;
console.log('AEB: '+AddEventButton.id+' '+AddEventButton.onclick);
//authorizeButton.onclick = handleAuthClick;
// signoutButton.onclick = handleSignoutClick;
}, function(error) {
appendPre(JSON.stringify(error, null, 2));
});
}
/**
* Called when the signed in status changes, to update the UI
* appropriately. After a sign-in, the API is called.
*/
function updateSigninStatus(isSignedIn) {
if (isSignedIn) {
// authorizeButton.style.display = 'none';
//signoutButton.style.display = 'block';
AddEventButton.style.display = 'block';
listUpcomingEvents();
} else {
// authorizeButton.style.display = 'block';
//signoutButton.style.display = 'none';
}
}
/**
* Sign in the user upon button click.
*/
function handleAuthClick(myCallBack) {
Promise.resolve(window.gapi.auth2.getAuthInstance().signIn())
.then(() => { myCallBack(null); })
/* gapi.auth2.getAuthInstance().signIn().onfinish=function (){
};*/
}
function callHAC(event){
handleAuthClick(handleAddEvent);
}
/**
* Sign out the user upon button click.
*/
function handleSignoutClick(event) {
gapi.auth2.getAuthInstance().signOut();
}
/**
* Append a pre element to the body containing the given message
* as its text node. Used to display the results of the API call.
*
* @param {string} message Text to be placed in pre element.
*/
function appendPre(message) {
var pre = document.getElementById('content');
var textContent = document.createTextNode(message + '\n');
pre.appendChild(textContent);
}
/**
* Print the summary and start datetime/date of the next ten events in
* the authorized user's calendar. If no events are found an
* appropriate message is printed.
*/
function listUpcomingEvents() {
gapi.client.calendar.events.list({
'calendarId': 'primary',
'timeMin': (new Date()).toISOString(),
'showDeleted': false,
'singleEvents': true,
'maxResults': 10,
'orderBy': 'startTime'
}).then(function(response) {
var events = response.result.items;
//appendPre('Upcoming events:');
if (events.length > 0) {
for (i = 0; i < events.length; i++) {
var event = events[i];
var when = event.start.dateTime;
if (!when) {
when = event.start.date;
}
// appendPre(event.summary + ' (' + when + ')')
}
} else {
// appendPre('No upcoming events found.');
}
});
}
function handleAddEvent(event){
//console.log('HOLA!!!');
// Refer to the JavaScript quickstart on how to setup the environment:
// https://developers.google.com/calendar/quickstart/js
// Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
// stored credentials.
var evento = {
'summary': '<?php echo $nombreE; ?>',
'location': '<?php echo $ubicacion; ?>',
'description':"Comparte la fiesta!",
'start': {
'dateTime': "<?php $date = new DateTime($fecha);echo $date->format('Y-m-d\TH:i:s'); ?>",
'timeZone': 'America/Los_Angeles'
},
'end': {
'dateTime': "<?php $date = new DateTime($fecha);$date->add(new DateInterval('P1D'));echo $date->format('Y-m-d\TH:i:s');?>",
'timeZone': 'America/Los_Angeles'
},
'recurrence': [
'RRULE:FREQ=DAILY;COUNT=1'
],
'attendees': [
{'email': 'lpage@example.com'},
{'email': 'sbrin@example.com'}
],
'reminders': {
'useDefault': false,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10}
]
}
};
var request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': evento
});
request.execute(function(event) {
//console.log('');
// appendPre('Event created: ' + event.htmlLink);
});
}
</script>
</body>
</html>