-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpage-hearing-list.php
125 lines (102 loc) · 4.83 KB
/
page-hearing-list.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
<?php
/**
* Template Name: Hearing List
*
* @package Hale
* @copyright Ministry of Justice
* @version 2.0
*/
get_header();
$filters = [
[
'filter_name' => 'hearing-witness',
'filter_type' => 'multiselect-taxonomy',
'taxonomy_key' => 'hearing-witness',
'value' => [],
'validated_value' => []
],
[
'filter_name' => 'published-date',
'filter_type' => 'date-range',
'value' => ['from_date' => '', 'to_date' => ''],
'validated_value' => ['from_date' => '', 'to_date' => '']
],
[
'filter_name' => 'hearing-type',
'filter_type' => 'select-taxonomy',
'taxonomy_key' => 'hearing-type',
'value' => [],
'validated_value' => []
]
];
//Currently 'published-date' is the only filter validated - option to add others in future
$filters = hale_validate_hearing_filters($filters);
$listing_search_text = stripslashes(sanitize_text_field(esc_html(get_query_var('listing_search'))));
// Start the post loop
while (have_posts()) :
the_post();
?>
<div id="primary" class="govuk-grid-column-full-from-desktop">
<?php get_template_part('template-parts/hearing-list/hearing-list-error-banner', false, array('filters' => $filters)); ?>
<div class="hearing-list-shaded-section">
<div class="hearing-list-shaded-section-content">
<h1 class="govuk-heading-xl govuk-!-static-margin-bottom-6">
<?= esc_html(get_the_title()); ?>
</h1>
<?php
// Page body content
get_template_part('template-parts/content', 'page');
?>
</div>
</div>
<div class="govuk-grid-row">
<!-- Lefthand column with filters and search -->
<div class="govuk-grid-column-one-third">
<div class="listing-search-section">
<div class="listing-search-form">
<form action="<?= esc_url(get_permalink()); ?>" method="GET">
<h2 class="govuk-fieldset__heading">Search and filter</h2>
<div class="listing-filter-field-wrapper">
<fieldset class="govuk-fieldset govuk-!-margin-bottom-2">
<div class="govuk-form-group govuk-!-margin-bottom-4">
<label class="govuk-label" for="listing-search-field">
<?php _e('Search', 'hale'); ?>
</label>
<div id="listing-search-field-hint" class="govuk-hint">
<?php _e('For example, witness name or hearing day', 'hale'); ?>
</div>
<input class="govuk-input" id="listing-search-field" name="listing_search"
value="<?= esc_attr($listing_search_text); ?>" type="search"
aria-describedby="listing-search-field-hint"
/>
</div>
<?php
get_template_part('template-parts/hearing-list/hearing-list-filters', false, array('filters' => $filters));
?>
</fieldset>
<div>
<button class="govuk-button">
<?php _e('Apply filters', 'hale'); ?>
</button>
<div class="govuk-body govuk-!-margin-left-3 govuk-!-padding-top-1" style="display:inline-block">
<a href="<?= esc_url(get_permalink()); ?>" class="govuk-link">
<?php _e('Clear', 'hale'); ?>
</a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Righthand column with listing page results -->
<div class="govuk-grid-column-two-thirds">
<?php
get_template_part('template-parts/hearing-list/hearing-list-results', false, array('filters' => $filters));
?>
</div>
</div>
</div><!-- #primary -->
<?php
endwhile;
get_footer();