2018-03-21 18:19:20 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2021-01-09 11:13:06 +00:00
|
|
|
* The template for displaying archive pages.
|
|
|
|
*
|
|
|
|
* @subpackage Omphaloskepsis
|
|
|
|
* @since Omphaloskepsis 1.0
|
|
|
|
*/
|
2018-03-21 18:19:20 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<?php get_header(); ?>
|
|
|
|
|
|
|
|
<?php $loop = new WP_Query( $args ); ?>
|
|
|
|
<header class="entry-content tile location-block">
|
|
|
|
<div class="post-header-title">
|
2021-01-23 14:41:19 +00:00
|
|
|
<h1 id="page-title">Experience</h1>
|
|
|
|
<h2 id="page-subtitle">by location</h2>
|
|
|
|
<?php
|
2021-01-09 11:13:06 +00:00
|
|
|
while ( have_posts() ) :
|
|
|
|
the_post();
|
|
|
|
?>
|
2021-01-23 14:41:19 +00:00
|
|
|
<div class="entry-content" id="taxonomy-description">
|
2021-01-09 11:13:06 +00:00
|
|
|
<?php the_content(); ?>
|
|
|
|
<div>
|
2021-01-23 14:41:19 +00:00
|
|
|
<a class="hyperlink-button" href="?view=countries">Countries</a>
|
|
|
|
<!--<a class="hyperlink-button" href="?view=regions">Regions</a>-->
|
|
|
|
<a class="hyperlink-button" href="?view=locations">Locations</a>
|
2021-01-09 11:13:06 +00:00
|
|
|
</div>
|
2021-01-23 14:41:19 +00:00
|
|
|
</div>
|
|
|
|
<?php endwhile; ?>
|
2018-03-21 18:19:20 +00:00
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<?php
|
2021-01-09 11:13:06 +00:00
|
|
|
$locations = get_terms( 'location', array( 'hide_empty' => 0 ) );
|
2018-03-21 18:19:20 +00:00
|
|
|
// Gets all of the top-level location terms.
|
2021-01-09 11:13:06 +00:00
|
|
|
$terms = get_terms(
|
|
|
|
array(
|
|
|
|
'taxonomy' => 'location',
|
|
|
|
'term_args' => array( 'parent' => 0 ),
|
|
|
|
)
|
|
|
|
);
|
2018-03-21 18:19:20 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<div id="primary" class="content-area">
|
|
|
|
<main id="company-main" class="site-main" role="main">
|
2021-01-23 14:41:19 +00:00
|
|
|
<div class="row">
|
|
|
|
<div id="map" style="height:100vh; width:100%;"></div>
|
|
|
|
</div>
|
|
|
|
<?php if ( ! empty( $locations ) ) : ?>
|
2021-01-09 11:13:06 +00:00
|
|
|
<?php if ( $_GET['view'] == 'countries' ) : ?>
|
|
|
|
<?php
|
|
|
|
$locationsSubset = array_filter(
|
|
|
|
$locations,
|
|
|
|
function ( $t ) {
|
|
|
|
return $t->parent != 0 && get_term( $t->parent, 'location' )->parent == 0;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
?>
|
|
|
|
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
|
|
|
<script type="text/javascript">
|
2021-01-23 14:41:19 +00:00
|
|
|
google.charts.load('current', {'packages':['geochart']});
|
|
|
|
google.charts.setOnLoadCallback(drawMap);
|
|
|
|
|
|
|
|
function drawMap() {
|
|
|
|
var data = google.visualization.arrayToDataTable([
|
|
|
|
['Country'],
|
2021-01-09 11:13:06 +00:00
|
|
|
<?php foreach ( (array) $locationsSubset as $term ) : ?>
|
2021-01-23 14:41:19 +00:00
|
|
|
['<?php echo $term->description; ?>'],
|
|
|
|
<?php endforeach; ?>
|
|
|
|
]);
|
|
|
|
var options = {};
|
|
|
|
var chart = new google.visualization.GeoChart(document.getElementById('map'));
|
|
|
|
|
|
|
|
chart.draw(data, options);
|
|
|
|
}
|
2021-01-09 11:13:06 +00:00
|
|
|
</script>
|
2021-01-23 14:41:19 +00:00
|
|
|
<?php elseif ( $_GET['view'] == 'locations' ) : ?>
|
|
|
|
<?php
|
2021-01-09 11:13:06 +00:00
|
|
|
$locationsSubset = array_filter(
|
|
|
|
$locations,
|
|
|
|
function ( $t ) {
|
|
|
|
return $t->parent != 0 && get_term( $t->parent, 'location' )->parent != 0 && get_term( get_term( $t->parent, 'location' )->parent, 'location' )->parent != 0 && get_term( get_term( get_term( $t->parent, 'location' )->parent, 'location' )->parent, 'location' )->parent == 0;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">
|
2021-01-23 14:41:19 +00:00
|
|
|
var locations = [
|
|
|
|
<?php foreach ( (array) $locationsSubset as $term ) : ?>
|
|
|
|
{<?php echo $term->description; ?>},
|
|
|
|
<?php endforeach; ?>
|
|
|
|
]
|
|
|
|
|
|
|
|
function initMap() {
|
|
|
|
var map = new google.maps.Map(document.getElementById('map'), {
|
|
|
|
zoom: 3,
|
|
|
|
center: {lat: 51.483462, lng: 0.0586198}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Create an array of alphabetical characters used to label the markers.
|
|
|
|
var labels = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
|
|
|
|
|
|
// Add some markers to the map.
|
|
|
|
// Note: The code uses the JavaScript Array.prototype.map() method to
|
|
|
|
// create an array of markers based on a given "locations" array.
|
|
|
|
// The map() method here has nothing to do with the Google Maps API.
|
|
|
|
var markers = locations.map(function(location, i) {
|
|
|
|
return new google.maps.Marker({
|
2018-03-21 18:19:20 +00:00
|
|
|
position: location,
|
|
|
|
label: labels[i % labels.length]
|
2021-01-23 14:41:19 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Add a marker clusterer to manage the markers.
|
|
|
|
var markerCluster = new MarkerClusterer(map, markers, {
|
|
|
|
imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'
|
|
|
|
});
|
|
|
|
}
|
2021-01-09 11:13:06 +00:00
|
|
|
</script>
|
|
|
|
<script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js"></script>
|
|
|
|
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBsMPnuCM59sC_n11CGxbpbqNY7FRUXnD0&callback=initMap"></script>
|
2021-01-23 14:41:19 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
<?php endif; ?>
|
2018-03-21 18:19:20 +00:00
|
|
|
</main><!-- .site-main -->
|
|
|
|
</div><!-- .content-area -->
|
|
|
|
|
|
|
|
<?php get_footer(); ?>
|