$course->fullname = external_format_string($course->fullname, $context->id);
$course->shortname = external_format_string($course->shortname, $context->id);
+ $progress = null;
+ if ($course->enablecompletion) {
+ $progress = \core_completion\progress::get_course_progress_percentage($course);
+ }
+
$result[] = array(
'id' => $course->id,
'shortname' => $course->shortname,
'showgrades' => $course->showgrades,
'lang' => $course->lang,
'enablecompletion' => $course->enablecompletion,
- 'category' => $course->category
+ 'category' => $course->category,
+ 'progress' => $progress,
);
}
'enablecompletion' => new external_value(PARAM_BOOL, 'true if completion is enabled, otherwise false',
VALUE_OPTIONAL),
'category' => new external_value(PARAM_INT, 'course category id', VALUE_OPTIONAL),
+ 'progress' => new external_value(PARAM_FLOAT, 'Progress percentage', VALUE_OPTIONAL),
)
)
);
defined('MOODLE_INTERNAL') || die();
-$version = 2017040300.10; // YYYYMMDD = weekly release date of this DEV branch.
+$version = 2017040300.11; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.