eventbrite api json export to be parsed as schedule directly

This commit is contained in:
Peter Molnar 2021-09-08 09:47:06 +01:00
parent f98c8e9ee7
commit 70654cdbc6
2 changed files with 14 additions and 34 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
**.odt **.odt
eventbrite*.json

View file

@ -175,38 +175,17 @@ $event_templates = json_decode('{
} }
}', True); }', True);
$event_schedules = json_decode('[ $archery_schedules = json_decode(file_get_contents('eventbrite-archery.json'), True);
{ $archery_schedules = $archery_schedules["events"]
"start": "2021-10-02T17:00:00+01:00",
"end": "2021-10-02T19:00:00+01:00",
"type": "archery",
"url": "https://www.eventbrite.co.uk/e/pa-kua-chinese-archery-tickets-169252373405"
},
{
"start": "2021-11-06T17:00:00+00:00",
"end": "2021-11-06T19:00:00+00:00",
"type": "archery",
"url": "https://www.eventbrite.co.uk/e/pa-kua-chinese-archery-tickets-169252373405"
},
{
"start": "2021-12-04T17:00:00+00:00",
"end": "2021-12-04T19:00:00+00:00",
"type": "archery",
"url": "https://www.eventbrite.co.uk/e/pa-kua-chinese-archery-tickets-169252373405"
},
{
"start": "2022-01-08T17:00:00+00:00",
"end": "2022-01-08T19:00:00+00:00",
"type": "archery",
"url": "https://www.eventbrite.co.uk/e/pa-kua-chinese-archery-tickets-169252373405"
}
]', True);
?> ?>
<?php foreach($event_schedules as $event_schedule) : ?> <?php foreach($archery_schedules as $event_schedule) : ?>
<?php $event = $event_templates[$event_schedule['type']]; ?> <?php
<?php if(strtotime($event_schedule['start']) < (time() + 3600)) { continue; } ?> if(stristr($event_schedule['name']['text'], 'archery')){
$event = $event_templates['archery'];
}
?>
<?php if(strtotime($event_schedule['start']['utc']) < (time() + 3600)) { continue; } ?>
<?php date_default_timezone_set("Europe/London"); ?> <?php date_default_timezone_set("Europe/London"); ?>
<div class="h-event" vocab="https://schema.org/" typeof="Event"> <div class="h-event" vocab="https://schema.org/" typeof="Event">
@ -216,12 +195,12 @@ $event_schedules = json_decode('[
<img class="u-photo photo" property="image" src="<?php echo($event['img']) ?>" alt="<?php echo($event['alt']) ?>" hidden="hidden" /> <img class="u-photo photo" property="image" src="<?php echo($event['img']) ?>" alt="<?php echo($event['alt']) ?>" hidden="hidden" />
<div> <div>
<strong>When:</strong> <strong>When:</strong>
<time class="dt-start" property="startDate" datetime="<?php echo($event_schedule['start']) ?>"> <time class="dt-start" property="startDate" datetime="<?php echo($event_schedule['start']['utc']) ?>">
<?php echo(strftime("%d %B %Y, %A, %I %p", strtotime($event_schedule['start']))); ?> <?php echo(strftime("%d %B %Y, %A, %I %p", strtotime($event_schedule['start']['utc']))); ?>
</time> </time>
<span class="to">to</span> <span class="to">to</span>
<time class="dt-end" property="endDate" datetime="<?php echo($event_schedule['end']) ?>"> <time class="dt-end" property="endDate" datetime="<?php echo($event_schedule['end']['utc']) ?>">
<?php echo(strftime("%I %p", strtotime($event_schedule['end']))); ?> <?php echo(strftime("%I %p", strtotime($event_schedule['end']['utc']))); ?>
</time> </time>
</div> </div>
<div class="addr"> <div class="addr">