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

Return additional fields in mod_assing_get_assignments external function

XMLWordPrintable

    • MOODLE_28_STABLE
    • MOODLE_29_STABLE
    • MDL-49617-master
    • Hide
      1. Create a new course with a couple of assignment activities.
      2. Configure one of the activities to not display always the description, configure this activity to be available in a year (submission from date). This means that the activity description will not be showed to the user until the next year. In the other activity, add a couple of attachments for the description.
      3. Enable "Mobile services": Plugins ► Web Services ► Mobile
      4. Create a Token for the user (student) your are going to test with:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Click add, select user and service (Mobile Service)
      6. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the wstoken and the URL of your moodle instance and the course id

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Cookie: MoodleSession=hs46mckao127eh1655cdq4fqn0' -H 'Connection: keep-alive' --data 'courseids%5B0%5D=4&wsfunction=mod_assign_get_assignments&wstoken=1b9b8bd8d01acbf452c2bd77ca0d2925' --compressed
          

      7. Confirm that:
        • You receive a list of courses with the two assignments.
      • One of the assignments (the one you configured to not display allways the description) does not display the intro and introformat fields.
      • The other assignment displays the description and a list of attached files
      Show
      Create a new course with a couple of assignment activities. Configure one of the activities to not display always the description, configure this activity to be available in a year (submission from date). This means that the activity description will not be showed to the user until the next year. In the other activity, add a couple of attachments for the description. Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the user (student) your are going to test with: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) Next, you can do a CURL REST call simulating a WS client: You need to replace the wstoken and the URL of your moodle instance and the course id curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' -H 'Pragma: no-cache' -H 'Origin: file://' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: es,en;q=0.8,de-DE;q=0.6,de;q=0.4,nb;q=0.2' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1798.0 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Cookie: MoodleSession=hs46mckao127eh1655cdq4fqn0' -H 'Connection: keep-alive' --data 'courseids%5B0%5D=4&wsfunction=mod_assign_get_assignments&wstoken=1b9b8bd8d01acbf452c2bd77ca0d2925' --compressed Confirm that: You receive a list of courses with the two assignments. One of the assignments (the one you configured to not display allways the description) does not display the intro and introformat fields. The other assignment displays the description and a list of attached files

      The get_assignments function does not return two fields that are very important:

      intro
      and
      introformat

      it is also not returning the description file attachments

      It's important to note that the description and attachments may be hidden depending on the value of this setting:

      Always show description
      If disabled, the Assignment Description above will only become visible to students at the "Allow submissions from" date.

            jleyva Juan Leyva
            jleyva Juan Leyva
            David Monllaó David Monllaó
            Dan Poltawski Dan Poltawski
            Rajesh Taneja Rajesh Taneja
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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