Fix problem of get_context_course

Fix the problem of different ways to get context course in moodle version minor to 2.2 and  moodle version greater than 2.2