-
-
Save muskie9/6685169bb5fa2e5a7e7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Function that gets any event, | |
* past or future with recursion | |
* turned on | |
* | |
* @param array $filter | |
* @return DataList | |
* | |
* @Todo incorporate category filtering | |
*/ | |
public static function getUpcomingRecurringEventList($filter = array()){ | |
$filter['Recursion'] = true; | |
return Event::get() | |
->filter($filter) | |
->filterByCallback( | |
function($item, $list){ | |
return ( | |
(($item->RecursionSchedule()->RecursionEnd) | |
&& (date('Y-m-d',strtotime($item->RecursionSchedule()->RecursionEnd)) >= date('Y-m-d'))) | |
|| !$item->RecursionSchedule()->RecursionEnd | |
); | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment