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

It is not possible to retrieve via WebServices the options in the new course overview block custom field filter

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Critical Critical
    • 3.8
    • 3.8
    • Blocks
    • MOODLE_38_STABLE
    • MOODLE_38_STABLE
    • MDL-67047-master
    • Hide
      Test
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a Token in the mobile app service for any user in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      3. Create one custom field (type short text) for courses via Site Administration > Courses > Course custom fields
      4. Create a couple of courses in the site setting some random and different values to the custom field you created
      5. Enrol the user you created the token for in those courses
      6. Go to Site Administration > Plugins > Blocks > Manage Blocks
      7. Ensure that the Course overview block is enabled
      8. Open the settings of the block and enable the option: "Custom field" and select from the dropdown menu the course custom field you created before
      9. Now, as the user you created the token for in step 2 access the web site
      10. Go to dashboard and check that you see the "Course overview" block.
        #Confirm that:
        • Among the course filters you will see the custom field values you typed for the courses
      11. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours.

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool"

      12. Please confirm that:
        • In the curl response you see the list of blocks in the user Dashboard
        • For the "courseoverview" block you see a field named "customfieldsexport" that is a JSON encoded string that contains all the course custom fields values you entered when you created the courses
      Show
      Test As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for any user in the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Create one custom field (type short text) for courses via Site Administration > Courses > Course custom fields Create a couple of courses in the site setting some random and different values to the custom field you created Enrol the user you created the token for in those courses Go to Site Administration > Plugins > Blocks > Manage Blocks Ensure that the Course overview block is enabled Open the settings of the block and enable the option: "Custom field" and select from the dropdown menu the course custom field you created before Now, as the user you created the token for in step 2 access the web site Go to dashboard and check that you see the "Course overview" block. #Confirm that: Among the course filters you will see the custom field values you typed for the courses Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_block_get_dashboard_blocks&wstoken=WSTOKEN' | python -m "json.tool" Please confirm that: In the curl response you see the list of blocks in the user Dashboard For the "courseoverview" block you see a field named "customfieldsexport" that is a JSON encoded string that contains all the course custom fields values you entered when you created the courses

      In MDL-66017 a new filter based on custom course fields was introduced for Moodle 3.8.

      Currently, there is no way to get all the potential options (names and values) so we can display them in external clients like the Moodle app.

      The only way to fix this would be to return the possible options and values as a JSON encoded string as part of the block plugin settings that are returned via Web Services when retrieving the blocks(thanks to the recent changes in MDL-65400)

      This is partially blocking MOBILE-3190

            jleyva Juan Leyva
            jleyva Juan Leyva
            Pau Ferrer Pau Ferrer
            Adrian Greeve Adrian Greeve
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 55 minutes
                4h 55m

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