Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-63522

WebService core_course_get_contents should return all the information required by the course frontpage

XMLWordPrintable

    • MOODLE_35_STABLE
    • MOODLE_36_STABLE
    • MDL-63522-master
    • Hide
      1. As admin, go to Site Administration > Advanced features an enable/tick the "Enable completion tracking" setting
      2. Create or use an existing course, turn edition on via the cog
      3. Create an URL resource, pointing to any URL like https://moodle.com, set Appareance -> Display to "In pop up", set "Pop up width/height" to a value like 600/400.
      4. Create a file resource, upload a PDF or PNG, JPG file and enable the Appareance -> "Show size" and "Show type" and "Show upload/modified" date settings. Set also "Activity completion" -> "Completion tracking" to "Student can manually mark..."
      5. Enrol a user as student in the course
      6. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      7. Create a Token in the mobile app service for the student user you just enroled in the course
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      8. Open the system console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. Remember to replace the courseid also with the id of the course you created or used.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=2&wsfunction=core_course_get_contents&wstoken=3af67232a7596ceb658df4db329e5ad6' --compressed | python -m "json.tool"

      9. Now check that:
        • Among all the data returned for the URL mod, the onclick field contains javascript code starting by "window.open.."
        • In the Resource (file) mod you see the field "customdata" containing serialized data (json encoded) containing text strings like showzie showtype
        • In the Resource mod you see the field "afterlink" containing the type of the document uploaded and the size between HTML TAGS
        • In all the modules returned by the WS call the "completiondata -> state" field is set to 0
      10. Now, log in into your Moodle installation as the student user.
      11. Go to the course and mark manually as completed the file you uploaded (clicking on the completion box at the right of the resource/file name)
      12. Execute again the CURL request and check that:
        • This time the completiondata->state field for the resource module is set to 1 and the timecompleted to a timestamp value
      Show
      As admin, go to Site Administration > Advanced features an enable/tick the "Enable completion tracking" setting Create or use an existing course, turn edition on via the cog Create an URL resource, pointing to any URL like https://moodle.com , set Appareance -> Display to "In pop up", set "Pop up width/height" to a value like 600/400. Create a file resource, upload a PDF or PNG, JPG file and enable the Appareance -> "Show size" and "Show type" and "Show upload/modified" date settings. Set also "Activity completion" -> "Completion tracking" to "Student can manually mark..." Enrol a user as student in the course Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the student user you just enroled in the course Click on Site administration ► Plugins ► Web services ► Manage tokens Open the system console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. Remember to replace the courseid also with the id of the course you created or used. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseid=2&wsfunction=core_course_get_contents&wstoken=3af67232a7596ceb658df4db329e5ad6' --compressed | python -m "json.tool" Now check that: Among all the data returned for the URL mod, the onclick field contains javascript code starting by "window.open.." In the Resource (file) mod you see the field "customdata" containing serialized data (json encoded) containing text strings like showzie showtype In the Resource mod you see the field "afterlink" containing the type of the document uploaded and the size between HTML TAGS In all the modules returned by the WS call the "completiondata -> state" field is set to 0 Now, log in into your Moodle installation as the student user. Go to the course and mark manually as completed the file you uploaded (clicking on the completion box at the right of the resource/file name) Execute again the CURL request and check that: This time the completiondata->state field for the resource module is set to 1 and the timecompleted to a timestamp value

      This WS was originally designed to be used by the Mobile app in order to print all the course activities and resources information.

      Current problem is that is missing some important information like:

      • Availability data (only part of it)
      • Completion status for activities
      • Display options data (cmi_info_view) data

      So we have to retrieve that information via additional WS calls and this has a direct impact on server side performance and mobile app responsiveness

      We need to double check that we are not missing any formation used by the core function course_section_cm

            jleyva Juan Leyva
            jleyva Juan Leyva
            Albert Gasset Albert Gasset
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.