MDL-38147 Added function coursecat::search_courses(), get_courses()

Also search_courses_count(), get_courses_count();
Added unittests
- MDL-38147 attempt to preload course contacts