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

Return active filters in course modules: core_filter_get_available_in_context WS

XMLWordPrintable

    • MOODLE_32_STABLE, MOODLE_34_STABLE
    • MOODLE_34_STABLE
    • MDL-58713-master
    • Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for one user enrolled in a course:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'contexts[0][contextlevel]=coursecat&contexts[0][instanceid]=1&wsfunction=core_filters_get_available_in_context&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool"

      4. Now, go to your category with id 1 in Moodle: http://localhost/m/stable_master/course/index.php?categoryid=1
      5. Via the settings menu (gear) go to the Filter section and check that all the filters listed in that page are returned by the curl request
      6. You may also check that the localstate field from the curl request for every filter is 0 when the filter "Active" status in web is set to "Default", 1 when is set to "On" and -1 when set to "Off"
      7. Now, execute the same request but at course level: replace the contextlevel field that is set to coursecat with course, and the instanceid to the course id you are going to check
      8. Check again that you receive all the filters that are listed in the course filters page (accesible via the course page settings) and that the "Active" status is set to the correct values (as indicated in step 6)
      9. Do the same checks for a course module, in this case replace contextlevel to module and instanceid with the module cmid
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for one user enrolled in a course: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken, and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'contexts [0] [contextlevel] =coursecat&contexts [0] [instanceid] =1&wsfunction=core_filters_get_available_in_context&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool" Now, go to your category with id 1 in Moodle: http://localhost/m/stable_master/course/index.php?categoryid=1 Via the settings menu (gear) go to the Filter section and check that all the filters listed in that page are returned by the curl request You may also check that the localstate field from the curl request for every filter is 0 when the filter "Active" status in web is set to "Default", 1 when is set to "On" and -1 when set to "Off" Now, execute the same request but at course level: replace the contextlevel field that is set to coursecat with course, and the instanceid to the course id you are going to check Check again that you receive all the filters that are listed in the course filters page (accesible via the course page settings) and that the "Active" status is set to the correct values (as indicated in step 6) Do the same checks for a course module, in this case replace contextlevel to module and instanceid with the module cmid

      We should return wich filters are active in the different course modules to be able to enable/disable the same filters in the mobile app (especially those that requires javascript in the client side like Mathjax, for example)

            jleyva Juan Leyva
            jleyva Juan Leyva
            Pau Ferrer Pau Ferrer
            Jun Pataleta Jun Pataleta
            Mihail Geshoski Mihail Geshoski
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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