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

Implement the imscp_export_contents function

XMLWordPrintable

    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MOODLE_29_STABLE
    • MDL-48718-master
    • 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.

      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.

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Marina Glancy Marina Glancy
            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.