Update Completion Status without Refresh Browser

Re: Update Completion Status without Refresh Browser

by Tristan Pease -
Number of replies: 3
Commenting to bump - this is a spec for my project as well. 
In reply to Tristan Pease

Re: Update Completion Status without Refresh Browser

by Raymon Akbar -
Picture of Testers
I updated my resource on the course page with embed, so the file is displayed in the same page. Then user can go to previous page using back button or click course name on the navigation bar.

Any find the best ways to update completion status without refresh browser?
In reply to Raymon Akbar

Re: Update Completion Status without Refresh Browser

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You'd have to have to write some javascript that runs on your course page (probably as part of a course format plugin, but a block would probably work too), which makes an AJAX request to get the latest completion status (probably by calling the core_completion_get_activities_completion_status() web service function), and updates the completion indicators on the page.

That said, when are you expecting the completion state of an activity to change which doesn't involve you leaving the page?  Surely actions that trigger a change in the completion status would usually involve you going in to the activity and doing something?

In reply to Mark Johnson

Re: Update Completion Status without Refresh Browser

by Tristan Pease -

For my project required file resources are opened in new tabs.


Thanks for the tip Mark. I ended up deciding AJAX was the answer as well, but haven't had the time to write it out. If I do I'll post code snippets here.