When an activity is hidden, presumably the events that it has created should be hidden as well. Are there any ideas already on how this will be implemented? It appears to me that when a coursemodule instance is hidden or unhidden, Moodle should set or unset a hidden flag for all the corresponding events in the event table. This will be easy to do because luckily the event table has 'modulename' and 'instance' fields. Thus the events corresponding to a coursemodule id will be easy to find. The calendar should be modified to ignore all events with the hidden flag set.
Martin, can you remind me of why we have a 'modulename' and 'instance' field in the event table rather than a single 'coursemodule' field? And then: why did you go for 'modulename' rather than 'moduleid'?