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

Create core_course_get_state webservice

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Covered by unit tests.

       

      If required, it can also be tested manually. You'll need to:

      1. Create a course. You can add some activities with different visibility/restrictions.
      2. Create user tokens from "Site administration > Server > Web services > Manage tokens".
      3. Execute the following, replacing your Moodle URL, USERTOKEN and COURSEID:

      curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_state&wstoken=[USERTOKEN]&courseid=[COURSEID]' | python -m json.tool

       

      Show
      Covered by unit tests.   If required, it can also be tested manually. You'll need to: Create a course. You can add some activities with different visibility/restrictions. Create user tokens from "Site administration > Server > Web services > Manage tokens". Execute the following, replacing your Moodle URL, USERTOKEN and COURSEID: curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_state&wstoken=[USERTOKEN]&courseid=[COURSEID]' | python -m json.tool  
    • Affected Branches:
      MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_400_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-71135-master
    • Sprint:
      Moppies Kanban, Moppies Kanban, Moppies Kanban

      Description

      Create an ajax webservice to load the initial state of the current course. This is a web service needed for the new course editor of Moodle 4.0.

      The web service will get the course id as param and will return a structure containing all the needed information the UI components needs to operate. This will include:

      • course: edition mode (bool) and section order (array of ids) (sample code)
      • section: an array with all the sections data (sample code)
      • cm: an array of the course-modules data (sample code)

      This information will conform the initial course state each component will receive and interact with. The state will only contain information that the user can see in the course (regardless its visibility). So, for instance, hidden sections won't be returned for students.

      A sample code of that web service can be checked at this proof of concept : https://github.com/ferranrecio/moodle/blob/coursecreatetest02/course/classes/external/course_get_state.php

       

      More information about this approach with the general architecture and how this external method will be used can be found in the section "External Interface Requirements" of the course creation document

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sarjona Sara Arjona (@sarjona)
              Reporter:
              tusefomal Ferran Recio
              Peer reviewer:
              Ilya Tregubov Ilya Tregubov
              Integrator:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tester:
              CiBoT CiBoT
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Dec/21

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days, 2 hours, 20 minutes
                  2d 2h 20m