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

New Web Service mod_lesson_process_page

    XMLWordPrintable

Details

    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57696-master
    • Hide
      1. In a course create a lesson with at least three content pages.
      2. The first content page should have a button to jump to next page.
      3. The second content page should have a button to jump to previous page and to jump to the end of lesson.
      4. Enrol one user as student in the course where the lesson is.
      5. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      6. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      7. Next, you can do a CURL REST call simulating a WS client with the student user .
        • You need to replace the wstoken, lessonid (the lesson instance value), pageid with the lesson first page id and cmid with the lesson course module id and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=4&wsfunction=mod_lesson_process_page&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true&pageid=49&data[0][name]=jumpto&data[0][value]=-1&data[1][name]=id&data[1][value]=cmid' | python -m "json.tool"

      8. The last call forced a jump to the next page. So you have to confirm that after executing the WS, the newpageid field received as response is the page id of the next page in the lesson.
      9. Now, replace pageid with the newpageid and replace the -1 with -40 (we are forcing a jump to the previous page)
      10. Execute the WS request and check that the newpageid is the lesson first page id (the one we used in the first curl request)
      11. Now, in the WS request, replace the -40 with -9 (forcing a jump to last page)
      12. Execute the WS request and check that the newpageid is -9 (the code for a lesson last page)
      Show
      In a course create a lesson with at least three content pages. The first content page should have a button to jump to next page. The second content page should have a button to jump to previous page and to jump to the end of lesson. Enrol one user as student in the course where the lesson is. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student user Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user . You need to replace the wstoken, lessonid (the lesson instance value), pageid with the lesson first page id and cmid with the lesson course module id and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=4&wsfunction=mod_lesson_process_page&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true&pageid=49&data [0] [name] =jumpto&data [0] [value] =-1&data [1] [name] =id&data [1] [value] =cmid' | python -m "json.tool" The last call forced a jump to the next page. So you have to confirm that after executing the WS, the newpageid field received as response is the page id of the next page in the lesson. Now, replace pageid with the newpageid and replace the -1 with -40 (we are forcing a jump to the previous page) Execute the WS request and check that the newpageid is the lesson first page id (the one we used in the first curl request) Now, in the WS request, replace the -40 with -9 (forcing a jump to last page) Execute the WS request and check that the newpageid is -9 (the code for a lesson last page)

    Description

      Processes page responses (when a user answer a question or choose where to go)

      Attachments

        Issue Links

          Activity

            People

              jleyva Juan Leyva
              jleyva Juan Leyva
              Dani Palou Dani Palou
              David Monllaó David Monllaó
              David Monllaó David Monllaó
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Clockify

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