MDL-44720 modinfo: make it easier to use cm_info instead of get_coursemodule_from_id

by adding function cm_info::get_course_module_record()