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

New Web Service mod_quiz_get_quizzes_by_courses

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9
    • Fix Version/s: 3.1
    • Component/s: Quiz, Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Bump your /version.php file to force Moodle to reload the Mobile service, alternatively you may run mdk run external_functions.php (to include the new external functions)
      2. Create a course with a teacher and a student.
      3. Create a couple of quizzes activities. Hide one of the activities.
      4. Enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a Token for the teacher and the student:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user .
        • You need to replace the wstoken, courseid and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=4&wsfunction=mod_quiz_get_quizzes_by_courses&wstoken=1b9cc9f44630b554bb2c9428b8744338'

          Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output

      7. Confirm that
        • As student you only see the visible quiz activity and all the settings fields except shuffleanswers', 'timecreated', 'timemodified', 'password' and'subnet'
        • As a teacher you see all the quiz activities and all the settings
      8. Now, add a time restriction to the quiz (for example, in the Time close add a passed date)
      9. As student, run the same CURL requests
      10. Confirm that now you can only see this fields 'id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'timeopen', 'timeclose', 'grademethod', 'section', 'visible', 'groupmode', 'groupingid'
      Show
      Bump your /version.php file to force Moodle to reload the Mobile service, alternatively you may run mdk run external_functions.php (to include the new external functions) Create a course with a teacher and a student. Create a couple of quizzes activities. Hide one of the activities. Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the teacher and the student: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a couple of CURL REST call simulating a WS client with the teacher and the student user . You need to replace the wstoken, courseid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=4&wsfunction=mod_quiz_get_quizzes_by_courses&wstoken=1b9cc9f44630b554bb2c9428b8744338' Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output Confirm that As student you only see the visible quiz activity and all the settings fields except shuffleanswers', 'timecreated', 'timemodified', 'password' and'subnet' As a teacher you see all the quiz activities and all the settings Now, add a time restriction to the quiz (for example, in the Time close add a passed date) As student, run the same CURL requests Confirm that now you can only see this fields 'id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'timeopen', 'timeclose', 'grademethod', 'section', 'visible', 'groupmode', 'groupingid'
    • Affected Branches:
      MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-50546-master

      Description

      Retrieve a list of quizzes from several courses

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  23/May/16