This isn't a question - just some useful information in case others need it.
------------------------------------------
I have my Calendar Events categories setup as checkboxes rather than a dropdown, so each event can be assigned to more than one category.
So when I wanted to add the filter to the calendar I had to add each of the checkboxes to the filterFields list like so:
$this->addFilterField(
new CheckboxField('CalendarEvent_AcademicCalendar', 'Academic Calendar Events')
);
... etc.
No problems there. However, when filtering, the filter string gets built like: WHERE "AcademicCalendar = 'on'", but boolean values aren't stored as 'on' or 'off' in the db, they are stored as '1' and '0'. So a quick fix in the getFiltersForID() function was needed:
//Line below added by Me
if(strcmp($value,'on')==0){ $value = 1;}
//Line below is for place reference
$for_db[] = "$db_field = '$value'";
The other problem I found was that when I filtered by selecting multiple checkboxes the filter string gets built like: WHERE "AcademicCalendar = '1'" AND "LibraryEvents = '1'" which is exclusive rather than inclusive. This called for another quick fix in the Events() function:
//Just replace " AND " with " OR "
$filter = (sizeof($filter_list > 1)) ? implode(" AND ", $filter_list) : $filter_list;
----------------------------------
I will admit that this isn't the slickest way of doing this - but it is quick, easy, and works.
Cheers!