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

New Web Service mod_lesson_get_page_data

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. In a course create a lesson with at least one content page and one question page, and with the Appearance -> Progress bar value set to Yes.
      2. Enrol one user as student in the course where the lesson is.
      3. As student access to the lesson (just view the first pageid)
      4. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      5. Create a Token for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. 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 the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=13&pageid=96&returncontents=1&wsfunction=mod_lesson_get_page_data&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool"

      7. Confirm that you receive all the page information, including title and contents, you receive also the pagecontents that matches the Moodle rendered content for the page.
      8. Check if that you progress in the lesson via the web interface, the progress field is update in further curl requests.
      Show
      In a course create a lesson with at least one content page and one question page, and with the Appearance -> Progress bar value set to Yes. Enrol one user as student in the course where the lesson is. As student access to the lesson (just view the first pageid) As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings 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 the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'lessonid=13&pageid=96&returncontents=1&wsfunction=mod_lesson_get_page_data&wstoken=12a2a65aeea2a177055e233f9e303218&moodlewssettingfilter=true' | python -m "json.tool" Confirm that you receive all the page information, including title and contents, you receive also the pagecontents that matches the Moodle rendered content for the page. Check if that you progress in the lesson via the web interface, the progress field is update in further curl requests.
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57693-master

      Description

      Return information of a given page, including its contents, the ongoing status, lesson progress and related area files.

      This function is similar to mod_quiz_get_attempt_data, it is returning the questions (if any) already rendered.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jleyva Juan Leyva
                Reporter:
                jleyva Juan Leyva
                Peer reviewer:
                Dani Palou
                Integrator:
                David Monllaó
                Tester:
                Andrew Nicols
                Participants:
                Component watchers:
                Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Jake Dallimore, Jun Pataleta
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/May/17