-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar-agenda.php
126 lines (121 loc) · 4.05 KB
/
sidebar-agenda.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
<?php
/**
* Custom sidebar for agenda page, taxonomy sd_txn_dates with upcoming event dates.
*
* @package HelloIVY
*/
defined( 'ABSPATH' ) or die ( 'not allowed to access this file' );
/**
* includes here...
*/
/**
* parameters here...
*/
$wp_timestamp_this_month = strtotime(wp_date('Y-m-d'));
?>
<div class="sidebar-content" id="sidebar-agenda">
<!-- <h2>Agenda Sidebar</h2> -->
<?php
// load search form
// get_search_form(); //default search form
require( get_stylesheet_directory() . '/sidebar-agenda-searchform.php' ); // custom search form
/**
* Filters
*/
$filter_terms = array(
'level' => get_term_by( 'name', 'lg_id_5', 'sd_txn_labels'),
'category' => get_term_by( 'name', 'lg_id_13', 'sd_txn_labels'),
'access' => get_term_by( 'name', 'lg_id_12', 'sd_txn_labels'),
);
?>
<h3 class="sidebar-headline">Filter</h3>
<!-- Filter - Date -->
<div class="sd-filters">
<div class="lg-details">
<form action="">
<label for="dates">Daten</label>
<select name="date" id="select-sd-date" onchange="onchangeSelect(this)">
<?php
$date_posts = ivy_get_dates_upcoming_all();
if ( !empty( $date_posts ) ){
$wp_timestamp_now = strtotime('now');
$date_sd_begin_first = $date_posts[0]->sd_date_begin/1000;
if ( $date_date_first < $wp_timestamp_now ){
$date_months = array( IVY_STRINGS['current'] );
}else{
$date_months = array();
}
foreach ( $date_posts as $date_post ){
$event_post = get_post( $date_post->wp_event_id );
$sd_event_data = $event_post->sd_data;
if( $sd_event_data['previewAvailable'] ){
$date_sd_begin = $date_post->sd_date_begin/1000;
if( wp_date( 'F Y', $date_sd_begin ) != end( $date_months ) && $date_sd_begin > $wp_timestamp_now ){
array_push( $date_months, wp_date( 'F Y', $date_sd_begin ) );
}
}
}
}
echo '<option value="all">Alle Termine</option>';
foreach( $date_months as $date_month){
echo '<option value="' . $date_month . '">' . ucfirst( $date_month ) . '</option>';
}
?>
</select>
</form>
</div>
<!-- Filter - Level -->
<div class="lg-details">
<form action="">
<label for="levels">Level</label>
<select name="level" id="select-sd-level" onchange="onchangeSelect(this)">
<?php
$labels_level_id = get_term_children( $filter_terms['level']->term_id, 'sd_txn_labels' );
echo '<option for="all" value="all">alle Levels</option>';
foreach ( $labels_level_id as $label_level_id ){
$term_level = get_term( $label_level_id );
echo '<option value="' . $term_level->slug . '">' . ucfirst( $term_level->description ) . '</option>';
}
?>
</select>
</form>
</div>
<!-- Filter - Category -->
<div class="lg-details">
<form action="">
<label for="categories">Kategorie</label>
<select name="category" id="select-sd-category" onchange="onchangeSelect(this)">
<?php
$labels_category_id = get_term_children( $filter_terms['category']->term_id, 'sd_txn_labels' );
echo '<option value="all">alle Kategorien</option>';
foreach ( $labels_category_id as $label_category_id ){
$term_category = get_term( $label_category_id);
echo '<option value="' . $term_category->slug . '">' . ucfirst( $term_category->description ) . '</option>';
}
?>
</select>
</form>
</div>
</div>
<!-- Filter - Online -->
<div class="filter-attendance-type">
<div class="cbox-online">
<label>Online</label>
<input type="checkbox" id="cbox-sd-online" name="cbox-sd-online" value="yes" onclick="onclickCbox()" checked>
</div>
<!-- Filter - Onsite -->
<div class="cbox-onsite">
<label class=container >live</label>
<input type="checkbox" id="cbox-sd-onsite" name="onsite" value="yes" onclick="onclickCbox()" checked>
</div>
</div>
<?php
// reset button for filters
global $wp;
?>
<div class="filter-reset">
<button class="filter-button" onclick="window.location.href='<?php echo home_url( $wp->request ) . '#content'; ?>';">Réinitialiser les filtres</button>
</div>
<?php
?>
</div>