-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtaxonomy-technology_lending_include.php
273 lines (272 loc) · 13.9 KB
/
taxonomy-technology_lending_include.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
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
<?php
/*
Description: Include file for Tech Lending Taxonomies.
*/
?>
<?php
global $wp_query;
query_posts(
array_merge(
$wp_query->query,
array(
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => 1000
)
)
);
?>
<?php $taxonomies = get_taxonomies();?>
<?php get_header(); ?>
<div id="main">
<div id="title_bar" class="container">
<!-- taxonomy.php -->
<div class="row">
<div class="col-sm-8">
<header><h1>Technology Lending</h1></header>
<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>
</div><!-- col-sm-8 -->
<div class="col-sm-4">
<div class="header-search"><?php get_search_form(); ?></div>
</div><!-- col-sm-4 -->
</div><!-- row -->
</div><!-- container -->
<div class="background-color-gray">
<div id="content" class="container">
<div class="row">
<div id="sidebar" class="col-sm-3">
<aside>
<div id="secondary" class="secondary taxonomy-filter">
<div id="widget-area-2" class="widget-area" role="complementary">
<p class="widget-link"><a href="<?php echo get_post_type_archive_link( 'tech' ); ?>">View All Technology</a></p>
<h2>Filters</h2>
<p>Select filters below to narrow results:</p>
<p style="text-align:center;"><button id="clear_all" class="btn btn-default">Clear All Filters</button></p>
<?php if ($current_taxonomy != 'library'): ?>
<div class="sidebar-collapse">
<div class="widget-title"><a class="menu-toggle" data-toggle="collapse" href="#Library" aria-expanded="true" aria-controls="Library"><span class="glyphicon glyphicon-minus-sign" style="float:right"></span><i class="fa fa-university"></i> Library</a></div>
<div class="collapse in" id="Library">
<?php taxonomy_filter('library'); ?>
</div>
</div>
<?php endif; ?>
<?php if ($current_taxonomy != 'tech_type'): ?>
<div class="sidebar-collapse">
<div class="widget-title"><a class="menu-toggle" data-toggle="collapse" href="#Tech_Type" aria-expanded="true" aria-controls="Tech Type"><span class="glyphicon glyphicon-minus-sign" style="float:right"></span><i class="fa fa-info-circle" aria-hidden="true"></i> Tech Type</a></div>
<div class="collapse in" id="Tech_Type">
<?php taxonomy_filter('tech_type'); ?>
</div>
</div>
<?php endif; ?>
<?php if ($current_taxonomy != 'loan_period'): ?>
<div class="sidebar-collapse">
<div class="widget-title"><a class="menu-toggle" data-toggle="collapse" href="#Loan_Period" aria-expanded="true" aria-controls="Loan Period"><span class="glyphicon glyphicon-minus-sign" style="float:right"></span><i class="fa fa-hourglass"></i> Loan Period</a></div>
<div class="collapse in" id="Loan_Period">
<?php taxonomy_filter('loan_period'); ?>
</div>
</div>
<?php endif; ?>
<?php if ($current_taxonomy != 'eligible_user'): ?>
<div class="sidebar-collapse">
<div class="widget-title"><a class="menu-toggle" data-toggle="collapse" href="#Eligible_User" aria-expanded="true" aria-controls="Eligible User"><span class="glyphicon glyphicon-minus-sign" style="float:right"></span><i class="fa fa-users"></i> Eligible User</a></div>
<div class="collapse in" id="Eligible_User">
<?php taxonomy_filter('eligible_user'); ?>
</div>
</div>
<?php endif; ?>
</div><!-- .widget-area -->
</div>
</aside>
</div>
<div id="content_area" class="col-sm-9">
<h2 class="subpage-title"><?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?></h2>
<div class="tech-description">
<?php echo term_description( ) ?>
</div>
<div class="tech-description">
<?php dynamic_sidebar( 'technology-lending' ); ?>
</div>
<div class="btn-group btn-grid-list" data-toggle="buttons">
<label class="btn btn-primary view-button active">
<input type="radio" name="views" autocomplete="off" value="grid" checked><i class="fa fa-th"></i> Grid
</label>
<label class="btn btn-primary view-button">
<input type="radio" name="views" autocomplete="off" value="list"> <i class="fa fa-th-list"></i> List
</label>
</div>
<div class="lds-spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
<div id="list_view" class="view">
<div class="card">
<div class="table-responsive">
<table class="table table-striped table-sorter tech-list">
<thead>
<tr>
<th class="empty-cell"></th>
<th><i class="fa fa-exclamation-circle"></i> Item Name</th>
<th><i class="fa fa-hourglass"></i> Loan Period</th>
<th><i class="fa fa-users"></i> Eligible Users</th>
<th><i class="fa fa-university"></i> Library</th>
<th><i class="fa fa-usd"></i> Fine Policy</th>
<th><i class="fa fa-check-circle"></i> Availability</th>
</tr>
</thead>
<tbody>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $slug = get_post_field( 'post_name', get_post() ); ?>
<?php $data_categories =''; ?>
<?php
foreach($taxonomies as $taxonomy) {
if(get_the_term_list( $post->ID, $taxonomy, true)){
$term_list = strip_tags( get_the_term_list( $post->ID, $taxonomy, '', 'tagplace', '' ));
$term_list = title_to_slug($term_list);
$term_list = str_replace('tagplace', ' ', $term_list);
$term_list = str_replace('-amp', '', $term_list);
$data_categories = $data_categories.' data-'.$taxonomy.'="'.$term_list.'" ';
}
}
?>
<tr class="taxonomy-item" data-id="<?php echo ($slug) ?>" <?php echo ($data_categories) ?>>
<td><a href="<?php echo get_permalink(); ?>"><?php the_post_thumbnail('thumbnail', array('class' => 'list-thumbnail')); ?></a></td>
<td><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></td>
<td>
<?php
if(get_the_term_list( $post->ID, 'loan_period', true)):
echo strip_tags(get_the_term_list( $post->ID, 'loan_period', '', ', ', '' ));
endif;
?>
</td>
<td>
<?php
if(get_the_term_list( $post->ID, 'eligible_user', true)):
echo strip_tags(get_the_term_list( $post->ID, 'eligible_user', '', ', ', '' ));
endif;
?>
</td>
<td>
<?php
if(get_the_term_list( $post->ID, 'library', true)):
echo strip_tags(get_the_term_list( $post->ID, 'library', '', ', ', '' ));
endif;
?>
</td>
<td>
<?php if(get_post_meta($post->ID, 'fine-policy', true)): ?>
<a href="<?php echo get_post_meta($post->ID, 'fine-policy', true); ?>">Fine Policy</a></li>
<?php endif; ?>
</td>
<td>
<?php if(get_post_meta($post->ID, 'availability', true)): ?>
<a href="<?php echo get_permalink(); ?>#item_availability">Check Availability</a></li>
<?php endif; ?>
</td>
</tr>
<?php endwhile; else: ?>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<div id="grid_view" class="directory grid view">
<?php $i = 0; ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $i++; ?>
<?php $slug = get_post_field( 'post_name', get_post() ); ?>
<?php $data_categories =''; ?>
<?php
foreach($taxonomies as $taxonomy) {
if(get_the_term_list( $post->ID, $taxonomy, true)){
$term_list = strip_tags( get_the_term_list( $post->ID, $taxonomy, '', 'tagplace', '' ));
$term_list = title_to_slug($term_list);
$term_list = str_replace('tagplace', ' ', $term_list);
$term_list = str_replace('-amp', '', $term_list);
$data_categories = $data_categories.' data-'.$taxonomy.'="'.$term_list.'" ';
}
}
?>
<div class="grid-item taxonomy-item" data-id="<?php echo ($slug) ?>" <?php echo ($data_categories) ?>>
<div class="thumbnail">
<figure><a href="<?php echo get_permalink(); ?>"><?php the_post_thumbnail('staff-thumbnail', array('class' => 'staff-thumbnail')); ?></a></figure>
<div class="caption">
<h3><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php if(get_the_term_list( $post->ID, 'tech_type', true) ||
get_the_term_list( $post->ID, 'loan_period', true) ||
get_the_term_list( $post->ID, 'eligible_user', true) ||
get_the_term_list( $post->ID, 'library', true) ||
get_post_meta($post->ID, 'fine-policy', true) ||
get_post_meta($post->ID, 'availability', true)
): ?>
<ul>
<?php if(get_the_term_list( $post->ID, 'tech_type', true)): ?>
<li><i class="fa fa-info-circle" data-toggle="tooltip" data-placement="right" title="Tech Type"></i><?php echo strip_tags(get_the_term_list( $post->ID, 'tech_type', '', ', ', '' )); ?></li>
<?php endif; ?>
<?php if(get_the_term_list( $post->ID, 'loan_period', true)): ?>
<li><i class="fa fa-hourglass" data-toggle="tooltip" data-placement="right" title="Loan Period"></i><?php echo strip_tags(get_the_term_list( $post->ID, 'loan_period', '', ', ', '' )); ?></li>
<?php endif; ?>
<?php if(get_the_term_list( $post->ID, 'eligible_user', true)): ?>
<li><i class="fa fa-users" data-toggle="tooltip" data-placement="right" title="Eligible Users"></i><?php echo strip_tags(get_the_term_list( $post->ID, 'eligible_user', '', ', ', '' )); ?></li>
<?php endif; ?>
<?php if(get_the_term_list( $post->ID, 'library', true)): ?>
<li><i class="fa fa-university" data-toggle="tooltip" data-placement="right" title="Library"></i><?php echo strip_tags(get_the_term_list( $post->ID, 'library', '', ', ', '' )); ?></li>
<?php endif; ?>
<?php if(get_post_meta($post->ID, 'fine-policy', true)): ?>
<li><i class="fa fa-usd" data-toggle="tooltip" data-placement="right" title="Fine Policy"></i> <a href="<?php echo get_post_meta($post->ID, 'fine-policy', true); ?>">Fine Policy</a></li>
<?php endif; ?>
<?php if(get_post_meta($post->ID, 'availability', true)): ?>
<li><i class="fa fa-check-circle" data-toggle="tooltip" data-placement="right" title="Check Availability"></i> <a href="<?php echo get_permalink(); ?>#item_availability">Check Availability</a></li>
<?php endif; ?>
</ul>
<?php endif; ?>
</div><!-- caption -->
</div><!-- thumbnail -->
</div><!-- grid-item -->
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?>
<?php wpbeginner_numeric_posts_nav(); ?>
</div><!-- directory row -->
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
</div><!-- col-sm-9 -->
</div><!-- row -->
</div><!-- container -->
</div><!-- background-color-gray -->
</div><!-- main -->
<script>
let categories = [
{
'name' : 'library',
'filter' : ''
},
{
'name' : 'tech_type',
'filter' : ''
},
{
'name' : 'loan_period',
'filter' : ''
},
{
'name' : 'eligible_user',
'filter' : ''
},
]
$('.taxonomy-filter').on('change', 'input:checkbox', function (){taxonomy_filter(categories);});
$('#clear_all').on('click', function(){
$('input:checkbox').removeAttr('checked');
taxonomy_filter(categories);
});
$(document).ready( function(){
$('.lds-spinner').hide();
$('#grid_view').addClass('view-active');
pre_check_box();
});
</script>
<?php get_footer(); ?>