Skip to content

Instantly share code, notes, and snippets.

@muskie9
Created July 15, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muskie9/6685169bb5fa2e5a7e7b to your computer and use it in GitHub Desktop.
Save muskie9/6685169bb5fa2e5a7e7b to your computer and use it in GitHub Desktop.
/**
* 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