Skip to content

Commit

Permalink
MDL-49174 webservices: Return front page contents in get_contents ws
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyva committed Feb 19, 2015
1 parent 95751e8 commit 12da294
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions course/externallib.php
Expand Up @@ -77,11 +77,14 @@ public static function get_course_contents($courseid, $options = array()) {
//retrieve the course
$course = $DB->get_record('course', array('id' => $params['courseid']), '*', MUST_EXIST);

//check course format exist
if (!file_exists($CFG->dirroot . '/course/format/' . $course->format . '/lib.php')) {
throw new moodle_exception('cannotgetcoursecontents', 'webservice', '', null, get_string('courseformatnotfound', 'error', '', $course->format));
} else {
require_once($CFG->dirroot . '/course/format/' . $course->format . '/lib.php');
if ($course->id != SITEID) {
// Check course format exist.
if (!file_exists($CFG->dirroot . '/course/format/' . $course->format . '/lib.php')) {
throw new moodle_exception('cannotgetcoursecontents', 'webservice', '', null,
get_string('courseformatnotfound', 'error', $course->format));
} else {
require_once($CFG->dirroot . '/course/format/' . $course->format . '/lib.php');
}
}

// now security checks
Expand Down

0 comments on commit 12da294

Please sign in to comment.