-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpage-dataset-detail.php
83 lines (73 loc) · 2.59 KB
/
page-dataset-detail.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
<?php
/*
* Template Name: WPCKAN Dataset detail
*/
?>
<?php get_header(); ?>
<?php
$search_query = isset($_GET["search_query"]) ? base64_decode($_GET["search_query"]) : null; ?>
<?php if(have_posts()) : the_post(); ?>
<section id="content" class="container single-post">
<div class="row">
<div class="eleven columns">
<?php the_content(); ?>
<?php
// this should really be only allowing [-_A-Za-z0-9] for names or uuids, but put in a library.
$dataset_id = esc_attr($_GET['id']);
if (isset($dataset_id)):
echo do_shortcode('[wpckan_dataset_detail id="' . $dataset_id . '"]');
else:
echo "<p>" . _e('Please provide an id as parameter', 'wpckan') . "</p>";
endif;
?>
</div>
<aside id="sidebar" class="four columns offset-by-one">
<?php
if (is_user_logged_in()): ?>
<div class="sixteen columns widgets">
<div class="widget">
<h2 class="widget-title"><?php _e('Manage on CKAN','odm') ?></h2>
</br>
<a target="_blank" class="button" href="<?php echo wpckan_get_ckan_domain(); ?>/dataset/edit/<?php echo $dataset_id;?>"><?php _e('Manage', 'odm')?></a>
</div>
</div>
<?php
endif;?>
<div class="sixteen columns widgets">
<?php
if (isset($search_query)):
$result = WP_Odm_Solr_UNIFIED_Manager()->query_by_params($search_query);
if (count($result["resultset"]) > 0): ?>
<div class="sixteen columns widgets">
<div class="widget">
<h2 class="widget-title"><?php _e('Other search results', 'odm'); ?></h2>
<ul>
<?php
foreach ($result["resultset"] as $document):
$link_to_dataset = wpckan_get_link_to_dataset($document->name,$search_query);?>
<li>
<h5><a target="_blank" href="<?php echo esc_url($link_to_dataset); ?>"><?php echo $document->title; ?></a></h5>
</li>
<?php
endforeach; ?>
</ul>
</div>
</div>
<?php
endif;
endif; ?>
<div class="sixteen columns">
<ul class="widgets">
<?php dynamic_sidebar('wpckan-dataset-detail-sidebar'); ?>
</ul>
</div>
</aside>
</div>
</section>
<?php endif; ?>
<?php get_footer(); ?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('.download').prepend($('<i class="fa fa-download"></i> '));
})
</script>