Automating Content Import
David Lippman
Pierce College
Lumen Learning
The Problem
You have large quantities of content (text,
quizzes, etc.) you want in Canvas.
Option 1: Cut and Paste
Option ...
Key Format
Common Cartridge
• Basis for Canvas’s export format
• Exports are renamed zip files
Cartridge Components
Course settings XML
Files info XML
Syllabus HTML
Module layout as
modules_meta.xml
Using this will pr...
Cartridge Components
One folder per
assignment/discussion/quiz
Quizzes contain:
assessment_meta.xml
Display settings
asses...
Cartridge Components
All the wiki pages for the
course, in HTML format
Note: spaces and dots in wiki
page names get conver...
Cartridge Components
The main mainfest for the whole
cartridge
<resource>
shows type and location of items
<organization> ...
Best way to get familiar
Export a course
Rename it .zip and unzip it
Go exploring
So what can we do with this?
Universal search and replace on all wiki pages
Approach 1:
• Unzip the cartridge
• Use an edi...
So what can we do with this?
Universal search and replace on all wiki pages
Approach 2:
• Write a script
require("phpQuery-onefile.php");
$zip = new ZipArchive;
$zip->open($file);
phpQuery::newDocumentXML(
$zip->getFromName("im...
$items = pq(“item”);
foreach ($items as $item) {
$iref = pq($item)->attr("identifierref");
if (isset($reftype[$iref]) &&
$...
So what can we do with this?
Import a collection of files as wiki pages
• Start with a clean export file
• Add pages in wi...
QTI
• Standard format for quiz exchange
• Can import a QTI quiz into Canvas without a
full cartridge
Making it Easier
Generate QTI files from HTML or pasted Word
https://www.myopenmath.com/util/wordtoquiz.php
https://www.my...
Sample Code
https://github.com/drlippman/canvas-scripts
• Search-and-replace in a cartridge example
• Generic content-to-C...
Automating Content Import
Automating Content Import
Automating Content Import
Automating Content Import
Upcoming SlideShare
Loading in …5
×

Automating Content Import

728 views

Published on

A talk from Washington Canvas User Group about using the Common Cartridge and QTI formats to import content into Canvas. Code up at https://github.com/drlippman/canvas-scripts

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
728
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Before you start:Load up a Canvascourse https://lumen.instructure.com/courses/196787Load up one of the wordtoquiz.php pagesPaste in some quiz questions
  • Show a course
  • Automating Content Import

    1. 1. Automating Content Import David Lippman Pierce College Lumen Learning
    2. 2. The Problem You have large quantities of content (text, quizzes, etc.) you want in Canvas. Option 1: Cut and Paste Option 2: Use the API Option 3: Build a course cartridge
    3. 3. Key Format Common Cartridge • Basis for Canvas’s export format • Exports are renamed zip files
    4. 4. Cartridge Components Course settings XML Files info XML Syllabus HTML Module layout as modules_meta.xml Using this will provide a more predictable Module structure than using standard common cartridge
    5. 5. Cartridge Components One folder per assignment/discussion/quiz Quizzes contain: assessment_meta.xml Display settings assessment_qti.xml Actual questions, in QTI format
    6. 6. Cartridge Components All the wiki pages for the course, in HTML format Note: spaces and dots in wiki page names get converted to dashes in the file name.
    7. 7. Cartridge Components The main mainfest for the whole cartridge <resource> shows type and location of items <organization> <item> shows item structure (modules)
    8. 8. Best way to get familiar Export a course Rename it .zip and unzip it Go exploring
    9. 9. So what can we do with this? Universal search and replace on all wiki pages Approach 1: • Unzip the cartridge • Use an editor that can do multi-file search and replace • Run against the wiki_content directory • Rezip and upload
    10. 10. So what can we do with this? Universal search and replace on all wiki pages Approach 2: • Write a script
    11. 11. require("phpQuery-onefile.php"); $zip = new ZipArchive; $zip->open($file); phpQuery::newDocumentXML( $zip->getFromName("imsmanifest.xml")); $ref = pq("resource"); foreach ($ref as $r) { $reflist[pq($r)->attr("identifier")] = pq($r)->attr("href"); $reftype[pq($r)->attr("identifier")] = pq($r)->attr("type"); }
    12. 12. $items = pq(“item”); foreach ($items as $item) { $iref = pq($item)->attr("identifierref"); if (isset($reftype[$iref]) && $reftype[$iref]=="webcontent") { $filename = $reflist[$iref]); $html = $zip->getFromName($filename); $html = str_replace(„</body>‟, $attribution.‟</body>‟, $html); $zip->addFromString($filename, $html); } }
    13. 13. So what can we do with this? Import a collection of files as wiki pages • Start with a clean export file • Add pages in wiki_content • Add new <resource> listings • Add new <item> to imsmanifest and modules_meta • Or, just create new imsmanifest and modules_meta files
    14. 14. QTI • Standard format for quiz exchange • Can import a QTI quiz into Canvas without a full cartridge
    15. 15. Making it Easier Generate QTI files from HTML or pasted Word https://www.myopenmath.com/util/wordtoquiz.php https://www.myopenmath.com/util/wordtoquiz2.php https://www.myopenmath.com/util/wordtoquiz3.php
    16. 16. Sample Code https://github.com/drlippman/canvas-scripts • Search-and-replace in a cartridge example • Generic content-to-CC • Some specific examples of content-to-CC • QTI generating scripts

    ×