tonytw1/n0tice-api-java-client — Issue #1: Date range for events
Author: bluedaniel
Created: 2012-03-05 16:13:43+00:00
State: open
Labels: request

In order to utilize the search endpoint for event index pages, I need to differentiate between future and past events.

The ordering and filtering of the sql for events was something like:

````
- public function setEventOrder($select, $op) {
-
- if (isset($op ['date_start_from'])) {
- $select->where('e.date_start <= ?', $op ['date_start_from']);
- }
- if (isset($op ['date_start_to'])) {
- $select->where('e.date_start >= ?', $op ['date_start_to']);
- }
- if (isset($op ['date_end_from'])) {
- $select->where('e.date_end <= ?', $op ['date_end_from']);
- }
- if (isset($op ['date_end_to'])) {
- $select->where('e.date_end >= ?', $op ['date_end_to']);
- }
- if ($op ['orderby'] == 'newest_start') {
- $select->order('e.date_start ASC');
- } elseif ($op ['orderby'] == 'oldest_start') {
- $select->order('e.date_start DESC');
- } elseif ($op ['orderby'] == 'newest_end') {
- $select->order('e.date_end ASC');
- } elseif ($op ['orderby'] == 'oldest_end') {
- $select->order('e.date_end DESC');
- } elseif ($op ['orderby'] == 'oldest_created') {
- $select->order('e.date_created ASC');
- } else {
- $select->order('e.date_created DESC'); // Default
- }
- return $select;
- }
````