MDL-39876 Change get_record('course') calls to get_course

This commit is contained in:
sam marshall 2013-06-18 17:00:37 +01:00
parent 838d78a9ff
commit ab7632b74c
189 changed files with 231 additions and 233 deletions

View file

@ -3053,7 +3053,7 @@ function course_get_url($courseorid, $section = null, $options = array()) {
* @return object the created module info
*/
function create_module($moduleinfo) {
global $DB, $CFG;
global $CFG;
require_once($CFG->dirroot . '/course/modlib.php');
@ -3069,7 +3069,7 @@ function create_module($moduleinfo) {
}
// Some additional checks (capability / existing instances).
$course = $DB->get_record('course', array('id'=>$moduleinfo->course), '*', MUST_EXIST);
$course = get_course($moduleinfo->course);
list($module, $context, $cw) = can_add_moduleinfo($course, $moduleinfo->modulename, $moduleinfo->section);
// Load module library.
@ -3093,7 +3093,7 @@ function create_module($moduleinfo) {
* @return object the updated module info
*/
function update_module($moduleinfo) {
global $DB, $CFG;
global $CFG;
require_once($CFG->dirroot . '/course/modlib.php');
@ -3101,7 +3101,7 @@ function update_module($moduleinfo) {
$cm = get_coursemodule_from_id('', $moduleinfo->coursemodule, 0, false, MUST_EXIST);
// Check the course exists.
$course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
// Some checks (capaibility / existing instances).
list($cm, $context, $module, $data, $cw) = can_update_moduleinfo($cm);