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

Create core_course_get_state webservice

    XMLWordPrintable

Details

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-71135-master
    • 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  
    • 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

              sarjona Sara Arjona (@sarjona)
              tusefomal Ferran Recio
              Ilya Tregubov Ilya Tregubov
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              CiBoT CiBoT
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                19/Apr/22

                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