MDL-31176 add missing global $DB when looking for group related context in calendar