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

Return via existing Web Services the activity modules purpose (to be able to use the right colour in the activity icons)

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.4
    • 4.3
    • Other
    • MOODLE_403_STABLE
    • MOODLE_404_STABLE
    • MDL-79786-main
    • Hide
      1. As admin add a forum, page, and assignment modules in a course
      2. Enable “Web services for mobile devices” on Site administration ► Advanced features
      3. Create a Token in the mobile app service for any user on the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      4. Use the following CURL command to test if the webservice works as required. Please note that the `$MOODLE_URL` , `$wstoken` and `$courseid` are parameters that need to be filled by you.

        curl '$MOODLE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_contents&wstoken=$wstoken&courseid=$courseid' --compressed | python -m "json.tool" 

      5. Check if inside modules we have in the structure the purpose values:
        • Forum: purpose = collaboration
        • Page: purpose = content
        • Assignment: purpose = assessment
      Show
      As admin add a forum, page, and assignment modules in a course Enable “Web services for mobile devices” on Site administration ► Advanced features Create a Token in the mobile app service for any user on the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Use the following CURL command to test if the webservice works as required. Please note that the `$MOODLE_URL` , `$wstoken` and `$courseid` are parameters that need to be filled by you. curl '$MOODLE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_contents&wstoken=$wstoken&courseid=$courseid' --compressed | python -m "json.tool" Check if inside modules we have in the structure the purpose values: Forum: purpose = collaboration Page: purpose = content Assignment: purpose = assessment

      This is necessary for third-party plugins mostly (non-core ones)

      The core_course_get_contents() is the generic Web Service that looks more suitable for this.

      We just need to return the purpose by doing something like:
      >purpose = plugin_supports('mod', $mod->modname, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER),

            rodrigo.mady@moodle.com Rodrigo Mady
            jleyva Juan Leyva
            Juan Leyva Juan Leyva
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 2 hours, 46 minutes
                1d 2h 46m

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