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

Implement the imscp_export_contents function

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create a new course with just one section, create a new resource type imscp uploading an imscp valid package
      2. You can create an imscp package using the book resource, you can create a new book and use the "Export imscp" tool.
      3. Enable "Mobile services": Plugins ► Web Services ► External services
      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 'Connection: keep-alive' --data 'courseid=4&wsfunction=core_course_get_contents&wstoken=1b9cc9f44630b554bb2c9428b8744338' --compressed
          

      7. Confirm that:
        • You receive a list of course sections including your imscp resource information, the imscp module has a field named "contents" with a list of files.
          The first file will be a "content" type file, containing the imscp structure in json format.
          Confirm that you can download any of the html files or images appending ?token=yourtoken to the URL, example:
          localhost/m/stable_master/webservice/pluginfile.php/235/mod_imscp/content/1/2/index.html?token=1b9cc9f44630b554bb2c9428b8744338
          You may use www.jsonlint.com for validate and view the json returned.
      Show
      Create a new course with just one section, create a new resource type imscp uploading an imscp valid package You can create an imscp package using the book resource, you can create a new book and use the "Export imscp" tool. Enable "Mobile services": Plugins ► Web Services ► External services 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 'Connection: keep-alive' --data 'courseid=4&wsfunction=core_course_get_contents&wstoken=1b9cc9f44630b554bb2c9428b8744338' --compressed Confirm that: You receive a list of course sections including your imscp resource information, the imscp module has a field named "contents" with a list of files. The first file will be a "content" type file, containing the imscp structure in json format. Confirm that you can download any of the html files or images appending ?token=yourtoken to the URL, example: localhost/m/stable_master/webservice/pluginfile.php/235/mod_imscp/content/1/2/index.html?token=1b9cc9f44630b554bb2c9428b8744338 You may use www.jsonlint.com for validate and view the json returned.
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-48718-master

      Description

      This function is used by the Web Service (course_get_contents) to retrieve all the contents of a course.

      The function should return an ordered list of files and resources (images, etc..) used in an IMS CP package in a similar way is done in the page or resource module.

      The returned information should allow a remote site to create an structured view of the package organization, this means that in the returned information should be indicate a category/subcategories order for the main organization.

        Attachments

          Activity

            People

            Assignee:
            jleyva Juan Leyva
            Reporter:
            jleyva Juan Leyva
            Peer reviewer:
            Dani Palou
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Marina Glancy
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/May/15