getting a SCORM activity completion status with the activity's ID

getting a SCORM activity completion status with the activity's ID

by Thibault Jeuland -
Number of replies: 2

Hello everyone !

Here's my probem :

In some course, I put all SCORM activities in a hidden section. I then use another block (a personnalized one) to display and give access to those activities (see picture). 

I would like to show on this block an element if the activity is completed, just to show students which activities are completed. 
I would need a "get_activity_progress($activityID)" function to do that, but it doesn't seem to exist. 🤔

Have I missed it? Is there another way to do it? or is it not possible?

Moodle version : 3.11+
Theme based on Bootstrap (Edumy)
Using Edwiser course format

Thanks 🙂


Attachment Capture d’écran 2021-09-15 175204.png
Average of ratings: -
In reply to Thibault Jeuland

Re: getting a SCORM activity completion status with the activity's ID

by Brian Merritt -
Picture of Particularly helpful Moodlers
I think the code you want will be found in /lib/completionlib.php

You should find there a function that does what you want

Alternatively you can get user activity completion from the database with a query

select * from {course_modules} as cm inner join {modules} as md on md.id = cm.module inner join{course_modules_completion} as cmp on cmp.coursemoduleid = cm.id WHERE cm.course = {insert id of course}
In reply to Brian Merritt

Re: getting a SCORM activity completion status with the activity's ID

by Brian Merritt -
Picture of Particularly helpful Moodlers
If you only want scorm results add

AND md.name = "scorm"

to restrict to module just as scorm