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

core_course_get_courses_by_field should return course format options

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.5
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a new course using “Course format” -> Topics or Weeks
      3. In the course settings (section Course format) change “Hidden sections” to “Hidden sections are completely invisible”, change also “Course layout” to “Show one section per page”
      4. Enrol one student in the course
      5. Create a Token in the mobile app service for the student user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken, value with the course created in step2 and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_courses_by_field&wstoken=12a2a65aeea2a177055e233f9e303218&field=id&value=21' | python -m "json.tool"

      7. Check that in the curl response you see the following structure courseformatoptions, where the fields hiddensections and coursedisplay have 1 as value
      8. Go back to the course settings and change Hidden sections and Course layout to its default values (“Hidden sections are shown in collapsed form” and “Show all sections on one page”)
      9. Execute the same curl request and check now that the fields hiddensections and coursedisplay have 0 as value
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a new course using “Course format” -> Topics or Weeks In the course settings (section Course format) change “Hidden sections” to “Hidden sections are completely invisible”, change also “Course layout” to “Show one section per page” Enrol one student in the course Create a Token in the mobile app service for the student user: 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, value with the course created in step2 and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_course_get_courses_by_field&wstoken=12a2a65aeea2a177055e233f9e303218&field=id&value=21' | python -m "json.tool" Check that in the curl response you see the following structure courseformatoptions, where the fields hiddensections and coursedisplay have 1 as value Go back to the course settings and change Hidden sections and Course layout to its default values (“Hidden sections are shown in collapsed form” and “Show all sections on one page”) Execute the same curl request and check now that the fields hiddensections and coursedisplay have 0 as value
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-61198-master

      Description

      We should add a callback (get_config_for_external) to the course format interface so external course format can return settings information like is done in assignment and other modules like data base.

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/18