Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCORM Availability field is affected by Restrict access field #21

Open
jlsandino opened this issue Jul 16, 2019 · 1 comment
Open

SCORM Availability field is affected by Restrict access field #21

jlsandino opened this issue Jul 16, 2019 · 1 comment

Comments

@jlsandino
Copy link

jlsandino commented Jul 16, 2019

In a course, when you use metadata local plugin for a scorm module, I suspect something is overriding scorm availabiliy field. The steps for replying the problem are:

Step 1. Upload a scorm package and configure Restrict access date. For example I want to allow access to scorm package for student from an specific date until other date.

Step 2. Later, when I edit Scorm setting, both restrisct access date are displayed in Availability field label.

This problem only ocurrs when you use local_metadata plugins for module. I reported this bug in Moodle tracker, https://tracker.moodle.org/browse/MDL-66155 , and they closed it because this bug relates to 3rd party code.

I attach two urls for showing two screenshot:

Step1

Step2

Thanks

@jjs105
Copy link

jjs105 commented Jan 27, 2021

Although nearly 2 years on, we have just run into this same problem. It is not specific to SCORM activities but rather all activities - i.e.

  1. Enable local_metadata for modules and add some fields
  2. Go to the 'Edit Settings' page for an activity
  3. Set a restriction under the 'Restrict Access' section (this does not need to be date based)
  4. Save and then go back to the activity 'Edit Settings' page
  5. The 'Availability' section title has been replaced by the underlying 'Restrict Access' configuration (which is a JSON string)

On further investigation this happens in the coursemodule_standard_elements function in the context_handler.php file.

This function first adds the metadata heading and fields to the form (which works fine). However after that is sets the entirety of the form data using a copy of the module/activity instance.

This data structure does not map to the form data and there are name clashes - namely the 'availability' data field in the instance matches the 'availability' form field in the form which then gets overridden.

To fix this my suggestion would be to only pass the metadata plugin's field data to the form set_data function. i.e. build the metadata specific data structure during the loop which creates the form fields and then pass that to the function call.

I will be doing this on our instance of Moodle and will report back with a specific fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants