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()
This commit is contained in:
@@ -1293,6 +1293,10 @@ function get_course_mods($courseid) {
|
||||
/**
|
||||
* Given an id of a course module, finds the coursemodule description
|
||||
*
|
||||
* Please note that this function performs 1-2 DB queries. When possible use cached
|
||||
* course modinfo. For example get_fast_modinfo($courseorid)->get_cm($cmid)
|
||||
* See also {@link cm_info::get_course_module_record()}
|
||||
*
|
||||
* @global object
|
||||
* @param string $modulename name of module type, eg. resource, assignment,... (optional, slower and less safe if not specified)
|
||||
* @param int $cmid course module id (id in course_modules table)
|
||||
@@ -1347,6 +1351,10 @@ function get_coursemodule_from_id($modulename, $cmid, $courseid=0, $sectionnum=f
|
||||
/**
|
||||
* Given an instance number of a module, finds the coursemodule description
|
||||
*
|
||||
* Please note that this function performs DB query. When possible use cached course
|
||||
* modinfo. For example get_fast_modinfo($courseorid)->instances[$modulename][$instance]
|
||||
* See also {@link cm_info::get_course_module_record()}
|
||||
*
|
||||
* @global object
|
||||
* @param string $modulename name of module type, eg. resource, assignment,...
|
||||
* @param int $instance module instance number (id in resource, assignment etc. table)
|
||||
|
||||
Reference in New Issue
Block a user