Event List - Version 0.6.6

Version Description

(2014-06-16) = * added date_filter shortcode option * added option to change text for filterbar reset item * added option "years_order" for years filterbar element * preparations to include more date filters / filterbar elements in future versions * small css style modification * updated some help texts

Download this release

Release Info

Developer mibuthu
Plugin Icon 128x128 Event List
Version 0.6.6
Comparing to
See all releases

Code changes from version 0.6.5 to 0.6.6

admin/includes/admin-about.php CHANGED
@@ -24,7 +24,7 @@ class EL_Admin_About {
24
  if(!current_user_can('edit_posts')) {
25
  wp_die(__('You do not have sufficient permissions to access this page.'));
26
  }
27
- $out = '<div class="wrap">
28
  <div id="icon-edit-pages" class="icon32"><br /></div><h2>About Event List</h2>
29
  <h3>Help and Instructions</h3>
30
  <p>You can manage your events <a href="admin.php?page=el_admin_main">here</a>.</p>
@@ -42,8 +42,10 @@ class EL_Admin_About {
42
  </p>
43
  <p>Be sure to also check the <a href="admin.php?page=el_admin_settings">Settings page</a> to get Event List behaving just the way you want.</p>
44
  </div>';
45
- $out .= $this->show_atts();
46
- echo $out;
 
 
47
  }
48
 
49
  public function embed_about_scripts() {
@@ -89,5 +91,24 @@ class EL_Admin_About {
89
  </table>';
90
  return $out;
91
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
93
  ?>
24
  if(!current_user_can('edit_posts')) {
25
  wp_die(__('You do not have sufficient permissions to access this page.'));
26
  }
27
+ echo '<div class="wrap">
28
  <div id="icon-edit-pages" class="icon32"><br /></div><h2>About Event List</h2>
29
  <h3>Help and Instructions</h3>
30
  <p>You can manage your events <a href="admin.php?page=el_admin_main">here</a>.</p>
42
  </p>
43
  <p>Be sure to also check the <a href="admin.php?page=el_admin_settings">Settings page</a> to get Event List behaving just the way you want.</p>
44
  </div>';
45
+ echo $this->show_atts();
46
+ echo $this->show_filter_syntax();
47
+ echo $this->show_date_syntax();
48
+ echo $this->show_daterange_syntax();
49
  }
50
 
51
  public function embed_about_scripts() {
91
  </table>';
92
  return $out;
93
  }
94
+
95
+ private function show_filter_syntax() {
96
+ return '
97
+ <h3>'.__('Filter Syntax').'</h3>
98
+ <p>'.__('For date and cat filters you can specify complex filters with the following syntax:</p>').'
99
+ <p>'.__('You can use AND ( "<b>&amp;</b>" ) and OR ( "<b>&verbar;</b>" or "<b>&comma;</b>" ) connections to define complex filters. Additionally you can set brackets ( "<b>(</b>" and ("<b>)</b>" ) for nested queries.').'</p>
100
+ '.__('Examples for cat filters:').'
101
+ <p><code>tennis</code> ... '.__('Show all events with category "tennis".').'<br />
102
+ <code>tennis,hockey</code> ... '.__('Show all events with category "tennis" or "hockey".').'<br />
103
+ <code>tennis|(hockey&winter)</code> ... '.__('Show all events with category "tennis" and all events where category "hockey" as well as "winter" is selected.').'</p>';
104
+ }
105
+
106
+ private function show_date_syntax() {
107
+ return '';
108
+ }
109
+
110
+ private function show_daterange_syntax() {
111
+ return '';
112
+ }
113
  }
114
  ?>
admin/includes/admin-main.php CHANGED
@@ -29,6 +29,13 @@ class EL_Admin_Main {
29
  $this->filterbar = &EL_Filterbar::get_instance();
30
  $this->event_table = new EL_Event_Table();
31
  $this->action = $this->event_table->current_action();
 
 
 
 
 
 
 
32
  // check for real actions
33
  if($this->action) {
34
  switch($this->action) {
29
  $this->filterbar = &EL_Filterbar::get_instance();
30
  $this->event_table = new EL_Event_Table();
31
  $this->action = $this->event_table->current_action();
32
+ error_log("Action: ".$this->action);
33
+ foreach($_GET as $key => $value) {
34
+ error_log('GET value "'.$key.'": '.$value);
35
+ }
36
+ foreach($_POST as $key => $value) {
37
+ error_log('POST value "'.$key.'": '.$value);
38
+ }
39
  // check for real actions
40
  if($this->action) {
41
  switch($this->action) {
admin/includes/admin-new.php CHANGED
@@ -99,6 +99,9 @@ class EL_Admin_New {
99
  <td><input type="text" class="text datepicker form-required" name="start_date" id="start_date" value="'.date('Y-m-d', $start_date).'" />
100
  <span id="end_date_area"> - <input type="text" class="text datepicker" name="end_date" id="end_date" value="'.date('Y-m-d', $end_date).'" /></span>
101
  <label><input type="checkbox" name="multiday" id="multiday" value="1" /> Multi-Day Event</label>
 
 
 
102
  <input type="hidden" id="sql_start_date" name="sql_start_date" value="" />
103
  <input type="hidden" id="sql_end_date" name="sql_end_date" value="" />
104
  </td>
99
  <td><input type="text" class="text datepicker form-required" name="start_date" id="start_date" value="'.date('Y-m-d', $start_date).'" />
100
  <span id="end_date_area"> - <input type="text" class="text datepicker" name="end_date" id="end_date" value="'.date('Y-m-d', $end_date).'" /></span>
101
  <label><input type="checkbox" name="multiday" id="multiday" value="1" /> Multi-Day Event</label>
102
+ TestText: <input type="text" name="test_text" id="test_text" value ="" />
103
+ TestDate1: <input type="text" name="test_date1" id="test_date1" value ="" />
104
+ TestDate2: <input type="text" name="test_date2" id="test_date2" value ="" />
105
  <input type="hidden" id="sql_start_date" name="sql_start_date" value="" />
106
  <input type="hidden" id="sql_end_date" name="sql_end_date" value="" />
107
  </td>
admin/js/admin_new.js CHANGED
@@ -30,6 +30,9 @@ jQuery(document).ready(function($) {
30
  onClose: function(selectedDate) {
31
  // set minDate for end_date picker
32
  minDate = $.datepicker.parseDate( conf.el_date_format, selectedDate );
 
 
 
33
  minDate.setDate(minDate.getDate()+1);
34
  $("#end_date").datepicker("option", "minDate", minDate);
35
  }
30
  onClose: function(selectedDate) {
31
  // set minDate for end_date picker
32
  minDate = $.datepicker.parseDate( conf.el_date_format, selectedDate );
33
+ $("#test_text").val("Test");
34
+ $("#test_date1").val(minDate);
35
+ $("#test_date2").val($.datepicker.formatDate("yy-mm-dd", minDate));
36
  minDate.setDate(minDate.getDate()+1);
37
  $("#end_date").datepicker("option", "minDate", minDate);
38
  }
event-list.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Event List
4
  Plugin URI: http://wordpress.org/extend/plugins/event-list/
5
  Description: Manage your events and show them in a list view on your site.
6
- Version: 0.6.5
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
3
  Plugin Name: Event List
4
  Plugin URI: http://wordpress.org/extend/plugins/event-list/
5
  Description: Manage your events and show them in a list view on your site.
6
+ Version: 0.6.6
7
  Author: Michael Burtscher
8
  Author URI: http://wordpress.org/extend/plugins/event-list/
9
  License: GPLv2
includes/css/event-list.css CHANGED
@@ -1,7 +1,3 @@
1
- .event-list {
2
- clear: both;
3
- }
4
-
5
  ul.event-list-view, ul.single-event-view {
6
  list-style: none !important;
7
  margin: 1.5em 0 2em 0;
 
 
 
 
1
  ul.event-list-view, ul.single-event-view {
2
  list-style: none !important;
3
  margin: 1.5em 0 2em 0;
includes/db.php CHANGED
@@ -217,63 +217,72 @@ class EL_Db {
217
  // date filter
218
  $date_filter=str_replace(' ','',$date_filter);
219
  if(null != $date_filter && 'all' != $date_filter && '' != $date_filter) {
220
- if(is_numeric($date_filter)) {
221
- // get events of a specific year
222
- $range_start = $date_filter.'-01-01';
223
- $range_end = $date_filter.'-12-31';
224
- }
225
- elseif('past' === $date_filter) {
226
- // get only events in the past
227
- $range_start = '0000-01-01';
228
- $range_end = date('Y-m-d', current_time('timestamp')-86400); // previous day (86400 seconds = 1*24*60*60 = 1 day))
229
- }
230
- else { // upcoming
231
- // get only events from today and in the future
232
- $range_start = date('Y-m-d', current_time('timestamp'));
233
- $range_end = '9999-12-31';
234
- }
235
- $sql_filter_string .= '(end_date >= "'.$range_start.'" AND start_date <= "'.$range_end.'")';
236
  }
237
-
238
  // cat_filter
239
  $cat_filter=str_replace(' ', '', $cat_filter);
240
  if(null != $cat_filter && 'all' != $cat_filter && '' != $cat_filter) {
241
  if('' != $sql_filter_string) {
242
  $sql_filter_string .= ' AND ';
243
  }
244
- $sql_filter_string .= '(';
245
- $delimiters = array('&' => ' AND ',
246
- '|' => ' OR ',
247
- ',' => ' OR ',
248
- '(' => '(',
249
- ')' => ')');
250
- $delimiter_keys = array_keys($delimiters);
251
- $tmp_element = '';
252
- $len_cat_filter = strlen($cat_filter);
253
- for($i=0; $i<$len_cat_filter; $i++) {
254
- if(in_array($cat_filter[$i], $delimiter_keys)) {
255
- if('' !== $tmp_element) {
256
- $sql_filter_string .= 'categories LIKE "%|'.$tmp_element.'|%"';
257
- $tmp_element = '';
258
- }
259
- $sql_filter_string .= $delimiters[$cat_filter[$i]];
260
- }
261
- else {
262
- $tmp_element .= $cat_filter[$i];
 
 
 
 
 
263
  }
 
264
  }
265
- if('' !== $tmp_element) {
266
- $sql_filter_string .= 'categories LIKE "%|'.$tmp_element.'|%"';
267
  }
268
- $sql_filter_string .= ')';
269
  }
 
 
 
 
 
270
 
271
- // no filter
272
- if('' == $sql_filter_string) {
273
- $sql_filter_string = '1'; // in SQL "WHERE 1" is used to show all events
 
 
 
 
 
 
 
274
  }
 
 
 
 
 
 
 
275
 
276
- return $sql_filter_string;
 
277
  }
278
 
279
  /** ************************************************************************************************************
217
  // date filter
218
  $date_filter=str_replace(' ','',$date_filter);
219
  if(null != $date_filter && 'all' != $date_filter && '' != $date_filter) {
220
+ $sql_filter_string .= $this->filter_walker($date_filter, 'sql_date_filter');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  }
 
222
  // cat_filter
223
  $cat_filter=str_replace(' ', '', $cat_filter);
224
  if(null != $cat_filter && 'all' != $cat_filter && '' != $cat_filter) {
225
  if('' != $sql_filter_string) {
226
  $sql_filter_string .= ' AND ';
227
  }
228
+ $sql_filter_string .= $this->filter_walker($cat_filter, 'sql_cat_filter');
229
+ }
230
+ // no filter
231
+ if('' == $sql_filter_string) {
232
+ $sql_filter_string = '1'; // in SQL "WHERE 1" is used to show all events
233
+ }
234
+ return $sql_filter_string;
235
+ }
236
+
237
+ private function filter_walker(&$filter_text, $callback) {
238
+ $delimiters = array('&' => ' AND ',
239
+ '|' => ' OR ',
240
+ ',' => ' OR ',
241
+ '(' => '(',
242
+ ')' => ')');
243
+ $delimiter_keys = array_keys($delimiters);
244
+ $element = '';
245
+ $filter_length = strlen($filter_text);
246
+ $filter_sql = '(';
247
+ for($i=0; $i<$filter_length; $i++) {
248
+ if(in_array($filter_text[$i], $delimiter_keys)) {
249
+ if('' !== $element) {
250
+ $filter_sql .= call_user_func(array($this, $callback), $element);
251
+ $element = '';
252
  }
253
+ $filter_sql .= $delimiters[$filter_text[$i]];
254
  }
255
+ else {
256
+ $element .= $filter_text[$i];
257
  }
 
258
  }
259
+ if('' !== $element) {
260
+ $filter_sql .= call_user_func(array($this, $callback), $element);
261
+ }
262
+ return $filter_sql.')';
263
+ }
264
 
265
+ private function sql_date_filter($element) {
266
+ if(is_numeric($element)) {
267
+ // get events of a specific year
268
+ $range_start = $element.'-01-01';
269
+ $range_end = $element.'-12-31';
270
+ }
271
+ elseif('past' === $element) {
272
+ // get only events in the past
273
+ $range_start = '0000-01-01';
274
+ $range_end = date('Y-m-d', current_time('timestamp')-86400); // previous day (86400 seconds = 1*24*60*60 = 1 day))
275
  }
276
+ else { // upcoming
277
+ // get only events from today and in the future
278
+ $range_start = date('Y-m-d', current_time('timestamp'));
279
+ $range_end = '9999-12-31';
280
+ }
281
+ return '(end_date >= "'.$range_start.'" AND start_date <= "'.$range_end.'")';
282
+ }
283
 
284
+ private function sql_cat_filter ($element) {
285
+ return 'categories LIKE "%|'.$element.'|%"';
286
  }
287
 
288
  /** ************************************************************************************************************
includes/filterbar.php CHANGED
@@ -30,7 +30,7 @@ class EL_Filterbar {
30
  }
31
 
32
  // main function to show the rendered HTML output
33
- public function show($url, $args) {
34
  $out = '
35
  <style type="text/css">
36
  .filterbar { display:table; width:100% }
@@ -71,7 +71,7 @@ class EL_Filterbar {
71
  $out .= $this->show_cats($url, $args, $item_array[1], 'std', $options);
72
  break;
73
  case 'reset':
74
- $out .= $this->show_reset($url, $args);
75
  }
76
  }
77
  $out .= '
@@ -92,7 +92,7 @@ class EL_Filterbar {
92
  return $this->show_hlist($elements);
93
  }
94
  */
95
- public function show_years($url, $args, $type='hlist', $subtype='std', $options=array()) {
96
  $args = $this->parse_args($args);
97
  $argname = 'date'.$args['sc_id_for_url'];
98
  // prepare displayed elements
@@ -108,19 +108,27 @@ class EL_Filterbar {
108
  }
109
  $first_year = $this->db->get_event_date('first');
110
  $last_year = $this->db->get_event_date('last');
111
- for($year=$last_year; $year>=$first_year; $year--) {
112
- $elements[] = array('slug'=>$year, 'name'=>$year);
 
 
 
 
 
 
 
113
  }
114
- // filter elements acc. date_filter
115
- /* TODO: implement date_filter
116
- if('all' !== $args['date_filter']) {
117
- $filter_array = explode(',', $args['date_filter']);
 
118
  foreach($elements as $id => $element) {
119
  if(!in_array($element['slug'], $filter_array) && 'all' !== $element['slug'] && 'upcoming' !== $element['slug'] && 'past' !== $element['slug']) {
120
  unset($elements[$id]);
121
  }
122
  }
123
- }*/
124
  // set selection
125
  if(is_numeric($args['event_id'])) {
126
  $actual = null;
@@ -139,7 +147,7 @@ class EL_Filterbar {
139
  }
140
  }
141
 
142
- public function show_cats($url, $args, $type='dropdown', $subtype='std', $options=array()) {
143
  $args = $this->parse_args($args);
144
  $argname = 'cat'.$args['sc_id_for_url'];
145
  // prepare displayed elements
@@ -172,11 +180,14 @@ class EL_Filterbar {
172
  }
173
  }
174
 
175
- public function show_reset($url, $args) {
176
  $args_to_remove = array('event_id'.$args['sc_id_for_url'],
177
  'date'.$args['sc_id_for_url'],
178
  'cat'.$args['sc_id_for_url']);
179
- return $this->show_link(remove_query_arg($args_to_remove, $url), __('Reset'), 'link');
 
 
 
180
  }
181
 
182
  private function show_hlist($elements, $url, $name, $actual=null) {
30
  }
31
 
32
  // main function to show the rendered HTML output
33
+ public function show($url, &$args) {
34
  $out = '
35
  <style type="text/css">
36
  .filterbar { display:table; width:100% }
71
  $out .= $this->show_cats($url, $args, $item_array[1], 'std', $options);
72
  break;
73
  case 'reset':
74
+ $out .= $this->show_reset($url, $args, $options);
75
  }
76
  }
77
  $out .= '
92
  return $this->show_hlist($elements);
93
  }
94
  */
95
+ public function show_years($url, &$args, $type='hlist', $subtype='std', $options=array()) {
96
  $args = $this->parse_args($args);
97
  $argname = 'date'.$args['sc_id_for_url'];
98
  // prepare displayed elements
108
  }
109
  $first_year = $this->db->get_event_date('first');
110
  $last_year = $this->db->get_event_date('last');
111
+ if(isset($options['years_order']) && 'asc' == strtolower($options['years_order'])) {
112
+ for($year=$first_year; $year<=$last_year; $year++) {
113
+ $elements[] = array('slug'=>$year, 'name'=>$year);
114
+ }
115
+ }
116
+ else {
117
+ for($year=$last_year; $year>=$first_year; $year--) {
118
+ $elements[] = array('slug'=>$year, 'name'=>$year);
119
+ }
120
  }
121
+ // filter elements acc. date_filter (if only OR connections are used)
122
+ if('all' !== $args['date_filter'] && !strpos($args['cat_filter'], '&')) {
123
+ $tmp_filter = str_replace(array(' ', '(', ')'), '', $args['date_filter']);
124
+ $tmp_filter = str_replace(',', '|', $tmp_filter);
125
+ $filter_array = explode('|', $tmp_filter);
126
  foreach($elements as $id => $element) {
127
  if(!in_array($element['slug'], $filter_array) && 'all' !== $element['slug'] && 'upcoming' !== $element['slug'] && 'past' !== $element['slug']) {
128
  unset($elements[$id]);
129
  }
130
  }
131
+ }
132
  // set selection
133
  if(is_numeric($args['event_id'])) {
134
  $actual = null;
147
  }
148
  }
149
 
150
+ public function show_cats($url, &$args, $type='dropdown', $subtype='std', $options=array()) {
151
  $args = $this->parse_args($args);
152
  $argname = 'cat'.$args['sc_id_for_url'];
153
  // prepare displayed elements
180
  }
181
  }
182
 
183
+ public function show_reset($url, $args, $options) {
184
  $args_to_remove = array('event_id'.$args['sc_id_for_url'],
185
  'date'.$args['sc_id_for_url'],
186
  'cat'.$args['sc_id_for_url']);
187
+ if(!isset($options['caption'])) {
188
+ $options['caption'] = 'Reset';
189
+ }
190
+ return $this->show_link(remove_query_arg($args_to_remove, $url), __($options['caption']), 'link');
191
  }
192
 
193
  private function show_hlist($elements, $url, $name, $actual=null) {
includes/sc_event-list.php CHANGED
@@ -39,7 +39,7 @@ class SC_Event_List {
39
  'desc' => __('With this attribute you can specify an event from which the event-details are shown initially. The standard is to show the event-list.<br />
40
  Specify an event-id e.g. "13" to change this behavior. It is still possible to go back to the event-list via the filterbar or url parameters.')),
41
 
42
- 'initial_date' => array('val' => 'all<br />upcoming<br />year e.g. "2014"',
43
  'std_val' => 'upcoming',
44
  'desc' => __('This attribute specifies which events are initially shown. The standard is to show the upcoming events.<br />
45
  Specify a year e.g. "2014" to change this behavior. It is still possible to change the displayed event date range via the filterbar or url parameters.')),
@@ -48,23 +48,20 @@ class SC_Event_List {
48
  'std_val' => 'all',
49
  'desc' => __('This attribute specifies the category of which events are initially shown. The standard is to show events of all categories.<br />
50
  Specify a category slug to change this behavior. It is still possible to change the displayed categories via the filterbar or url parameters.')),
51
- /*
52
- 'date_filter' => array('val' => 'all<br />upcoming<br />year e.g. "2014"',
53
  'std_val' => 'all',
54
- 'desc' => 'This attribute specifies the date range of which events are displayed. The standard is "all" to show all events.<br />
55
- Events defined in date ranges not listed here are also not available in the date selection in the filterbar. It is also not possible to show them with a manual added url parameter<br />
56
- Specify a year or a list of years separated by a comma "," e.g. "2014,2015,2016".'),
57
- */
 
58
  'cat_filter' => array('val' => 'all<br />category slugs',
59
  'std_val' => 'all',
60
  'desc' => 'This attribute specifies the categories of which events are shown. The standard is "all" or an empty string to show all events.<br />
61
- Events defined in categories which doesn´t match cat_filter are not shown in the event list. They are also not available if a manual url parameter is added.<br />
62
- The filter is specified via the given category slug. You can use AND ("&") and OR ("|" or ",") connections to define complex filters. Additionally you can set brackets for nested queries.<br />
63
- Examples:<br />
64
- <code>tennis</code> ... Show all events with category "tennis".<br />
65
- <code>tennis,hockey</code> ... Show all events with category "tennis" or "hockey".<br />
66
- <code>tennis|(hockey&winter)</code> ... Show all events with category "tennis" and all events where category "hockey" as well as "winter" is selected.<br />
67
- If you only use OR connections (no AND connection) the category selection in the filterbar will also be filtered according to the given filter.<br />'),
68
 
69
  'num_events' => array('val' => 'number',
70
  'std_val' => '0',
@@ -83,10 +80,10 @@ class SC_Event_List {
83
  'desc' => 'This attribute specifies the available items in the filterbar. This options are only valid if the filterbar is displayed (see show_filterbar attribute).<br /><br />
84
  Find below an overview of the available filterbar items and their options:<br />
85
  <small><table class="el-filterbar-table">
86
- <th class="el-filterbar-item">filterbar item</th><th class="el-filterbar-desc">description</th><th class="el-filterbar-options">item options</th><th class="el-filterbar-values">option values</th><th class="el-filterbar-default">default value</th><th class="el-filterbar-desc2">description</th></thead>
87
- <tr><td>years</td><td>Show a list of all available years. Additional there are some special entries available (see item options).</td><td>show_all<br />show_upcoming<br />show_past</td><td>true | false<br />true | false<br />true | false</td><td>true<br />true<br />false</td><td>Add an entry to show all events.<br />Add an entry to show all upcoming events.<br />Add an entry to show events in the past.</tr>
88
- <tr><td>cats</td><td>Show a list of all available categories.</td><td>show_all</td><td>true<br />false</td><td>true</td><td>Add an entry to show events from all categories.</td></tr>
89
- <tr><td>reset</td><td>Only a link to reset the eventlist filter to standard.</td><td>none</td><td></td><td></td><td></td></tr>
90
  </table></small>
91
  Find below an overview of the available filterbar display options:<br />
92
  <small><table class="el-filterbar-table">
@@ -259,7 +256,7 @@ class SC_Event_List {
259
  if('upcoming' != $a['actual_date']) {
260
  $a['num_events'] = 0;
261
  }
262
- $date_filter = $this->get_date_filter('all', $a['actual_date']);
263
  $cat_filter = $this->get_cat_filter($a['cat_filter'], $a['actual_cat']);
264
  if( '1' !== $this->options->get( 'el_date_once_per_day' ) ) {
265
  // normal sort
@@ -430,34 +427,43 @@ class SC_Event_List {
430
  }
431
 
432
  private function get_actual_date(&$a) {
433
- $actual_date = $a['initial_date'];
434
  if(isset($_GET['event_id'.$a['sc_id']])) {
435
- $actual_date = null;
436
  }
437
  elseif(isset($_GET['date'.$a['sc_id']])) {
438
- $actual_date = $_GET['date'.$a['sc_id']];
439
  }
440
- return $actual_date;
441
  }
442
 
443
  private function get_actual_cat(&$a) {
444
- $actual_cat = $a['initial_cat'];
445
  if(isset($_GET['event_id'.$a['sc_id']])) {
446
- $actual_cat = null;
447
  }
448
  elseif(isset($_GET['cat'.$a['sc_id']])) {
449
- $actual_cat = $_GET['cat'.$a['sc_id']];
450
  }
451
- return $actual_cat;
452
  }
453
 
454
  private function get_date_filter($date_filter, $actual_date) {
455
- // TODO: date_filter not implemented yet
456
- if('all' == $actual_date) {
457
- return null;
 
 
 
 
458
  }
459
  else {
460
- return $actual_date;
 
 
 
 
 
 
 
461
  }
462
  }
463
 
@@ -471,6 +477,8 @@ class SC_Event_List {
471
  }
472
  }
473
  else {
 
 
474
  if('all' == $actual_cat || '' == $actual_cat) {
475
  return $cat_filter;
476
  }
39
  'desc' => __('With this attribute you can specify an event from which the event-details are shown initially. The standard is to show the event-list.<br />
40
  Specify an event-id e.g. "13" to change this behavior. It is still possible to go back to the event-list via the filterbar or url parameters.')),
41
 
42
+ 'initial_date' => array('val' => 'all<br />upcoming<br />past<br />year',
43
  'std_val' => 'upcoming',
44
  'desc' => __('This attribute specifies which events are initially shown. The standard is to show the upcoming events.<br />
45
  Specify a year e.g. "2014" to change this behavior. It is still possible to change the displayed event date range via the filterbar or url parameters.')),
48
  'std_val' => 'all',
49
  'desc' => __('This attribute specifies the category of which events are initially shown. The standard is to show events of all categories.<br />
50
  Specify a category slug to change this behavior. It is still possible to change the displayed categories via the filterbar or url parameters.')),
51
+
52
+ 'date_filter' => array('val' => 'all<br />upcoming<br />past<br />year',
53
  'std_val' => 'all',
54
+ 'desc' => 'This attribute specifies the dates and date ranges of which events are displayed. The standard is "all" to show all events.<br />
55
+ Filtered events according to date_filter value are not available in the event list.<br />
56
+ Specify a year or a list of years separated by a comma "," e.g. "2014,2015,2016".<br />
57
+ When you only use OR connections (no AND connection) the years selection in the filterbar will also be filtered accordingly.'),
58
+
59
  'cat_filter' => array('val' => 'all<br />category slugs',
60
  'std_val' => 'all',
61
  'desc' => 'This attribute specifies the categories of which events are shown. The standard is "all" or an empty string to show all events.<br />
62
+ Filtered events defined in categories which doesn´t match cat_filter are not shown in the event list. They are also not available if a manual url parameter is added.<br />
63
+ The filter is specified via the given category slug. See "Filter Syntax" description if you want to define complex filters.<br />
64
+ When you only use OR connections (no AND connection) the category selection in the filterbar will also be filtered accordingly.'),
 
 
 
 
65
 
66
  'num_events' => array('val' => 'number',
67
  'std_val' => '0',
80
  'desc' => 'This attribute specifies the available items in the filterbar. This options are only valid if the filterbar is displayed (see show_filterbar attribute).<br /><br />
81
  Find below an overview of the available filterbar items and their options:<br />
82
  <small><table class="el-filterbar-table">
83
+ <th class="el-filterbar-item">filterbar item</th><th class="el-filterbar-desc">description</th><th class="el-filterbar-options">item options</th><th class="el-filterbar-values">option values</th><th class="el-filterbar-default">default value</th><th class="el-filterbar-desc2">option description</th></thead>
84
+ <tr><td>years</td><td>Show a list of all available years. Additional there are some special entries available (see item options).</td><td>show_all<br />show_upcoming<br />show_past<br />years_order</td><td>true | false<br />true | false<br />true | false<br />desc | asc</td><td>true<br />true<br />false<br />desc</td><td>Add an entry to show all events.<br />Add an entry to show all upcoming events.<br />Add an entry to show events in the past.<br />Set descending or ascending order of year entries.</tr>
85
+ <tr><td>cats</td><td>Show a list of all available categories.</td><td>show_all</td><td>true | false</td><td>true</td><td>Add an entry to show events from all categories.</td></tr>
86
+ <tr><td>reset</td><td>Only a link to reset the eventlist filter to standard.</td><td>caption</td><td>any text</td><td>Reset</td><td>Set the caption of the link.</td></tr>
87
  </table></small>
88
  Find below an overview of the available filterbar display options:<br />
89
  <small><table class="el-filterbar-table">
256
  if('upcoming' != $a['actual_date']) {
257
  $a['num_events'] = 0;
258
  }
259
+ $date_filter = $this->get_date_filter($a['date_filter'], $a['actual_date']);
260
  $cat_filter = $this->get_cat_filter($a['cat_filter'], $a['actual_cat']);
261
  if( '1' !== $this->options->get( 'el_date_once_per_day' ) ) {
262
  // normal sort
427
  }
428
 
429
  private function get_actual_date(&$a) {
 
430
  if(isset($_GET['event_id'.$a['sc_id']])) {
431
+ return null;
432
  }
433
  elseif(isset($_GET['date'.$a['sc_id']])) {
434
+ return $_GET['date'.$a['sc_id']];
435
  }
436
+ return $a['initial_date'];
437
  }
438
 
439
  private function get_actual_cat(&$a) {
 
440
  if(isset($_GET['event_id'.$a['sc_id']])) {
441
+ return null;
442
  }
443
  elseif(isset($_GET['cat'.$a['sc_id']])) {
444
+ return $_GET['cat'.$a['sc_id']];
445
  }
446
+ return $a['initial_cat'];
447
  }
448
 
449
  private function get_date_filter($date_filter, $actual_date) {
450
+ if('all' == $date_filter || '' == $date_filter) {
451
+ if('all' == $actual_date || '' == $actual_date) {
452
+ return null;
453
+ }
454
+ else {
455
+ return $actual_date;
456
+ }
457
  }
458
  else {
459
+ // Convert html entities to correct characters, e.g. &amp; to &
460
+ $date_filter = html_entity_decode($date_filter);
461
+ if('all' == $actual_date || '' == $actual_date) {
462
+ return $date_filter;
463
+ }
464
+ else {
465
+ return '('.$date_filter.')&('.$actual_date.')';
466
+ }
467
  }
468
  }
469
 
477
  }
478
  }
479
  else {
480
+ // Convert html entities to correct characters, e.g. &amp; to &
481
+ $cat_filter = html_entity_decode($cat_filter);
482
  if('all' == $actual_cat || '' == $actual_cat) {
483
  return $cat_filter;
484
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mibuthu
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W54LNZMWF9KW2
4
  Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, filter, admin, attribute, widget, sidebar, feed, rss
5
  Requires at least: 3.3
6
- Tested up to: 3.9
7
- Stable tag: 0.6.5
8
  Plugin URI: http://wordpress.org/extend/plugins/event-list
9
  Licence: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -71,6 +71,14 @@ Another possibility would be to call the wordpress function "do_shortcode()".
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
 
 
 
74
  = 0.6.5 (2014-04-26) =
75
  * added shortcode attribute "initial_event_id"
76
  * added an option to only show umpcoming events in the feed
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W54LNZMWF9KW2
4
  Tags: event, events, list, listview, calendar, schedule, shortcode, page, category, categories, filter, admin, attribute, widget, sidebar, feed, rss
5
  Requires at least: 3.3
6
+ Tested up to: 3.9.1
7
+ Stable tag: 0.6.6
8
  Plugin URI: http://wordpress.org/extend/plugins/event-list
9
  Licence: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
71
 
72
  == Changelog ==
73
 
74
+ = 0.6.6 (2014-06-16) =
75
+ * added date_filter shortcode option
76
+ * added option to change text for filterbar reset item
77
+ * added option "years_order" for years filterbar element
78
+ * preparations to include more date filters / filterbar elements in future versions
79
+ * small css style modification
80
+ * updated some help texts
81
+
82
  = 0.6.5 (2014-04-26) =
83
  * added shortcode attribute "initial_event_id"
84
  * added an option to only show umpcoming events in the feed