View
453
Download
3
Category
Tags:
Preview:
DESCRIPTION
Presentation by Roger Kenner at Canada Moodle Moot: Friday, April 2, 2009Using Excel and Mailmerge to modify Moodle backup files so as to load new content into a site.
Citation preview
Automating the Posting of Automating the Posting of Content on MoodleContent on Moodle
Roger KennerRoger KennerMoodle Consultant & TrainerMoodle Consultant & Trainer
RK-IdRK-Idées, Montrealées, Montreal
An Overview of the ProcessAn Overview of the Process
• Posting a large number of structurally similar Posting a large number of structurally similar units on a units on a MoodleMoodle course course
• Having no access server beyond normal teacher Having no access server beyond normal teacher privileges for the sites in questionprivileges for the sites in question
• Using Using ExcelExcel and and WordWord to modify a carefully to modify a carefully constructed constructed MoodleMoodle ‘backup’ file ‘backup’ file– So as to cause it to place new content on the siteSo as to cause it to place new content on the site
Accessible to those who...Accessible to those who...
• Are comfortable with Are comfortable with ExcelExcel, , WordWord’s ’s mailmergemailmerge utility, utility, texttext files and manipulating files and file files and manipulating files and file names in Windowsnames in Windows
• Are not afraid to work directly with XML codeAre not afraid to work directly with XML code• Have a meticulous clerical bentHave a meticulous clerical bent• No programming of scripts in Php or knowledge No programming of scripts in Php or knowledge
of MySQL is necessary.of MySQL is necessary.
The TaskThe Task
• A major Canadian university and a major A major Canadian university and a major textbook publishertextbook publisher– (Neither will be cited here.)(Neither will be cited here.)
• Posting all supplementary materials for the Posting all supplementary materials for the method onto method onto MoodleMoodle, in mostly hidden form, in mostly hidden form– (Teachers can release materials as needed.)(Teachers can release materials as needed.)
• Eight textbooks comprising 280 units in totalEight textbooks comprising 280 units in total– (Onto 8 master Moodle sites)(Onto 8 master Moodle sites)
Clearly some sort of Clearly some sort of tooltool was was called for...called for...
After preliminary testing, to prove the After preliminary testing, to prove the concept, I proceeded with the concept, I proceeded with the
construction of the toolconstruction of the tool
Constructing the ToolConstructing the Tool
Step 1: Creating the BackupStep 1: Creating the Backup
• Build a model unit Build a model unit containing all elementscontaining all elements– (Actually more than (Actually more than
shown here; no such shown here; no such original unit exists original unit exists anymore.)anymore.)
• Create a backup of Create a backup of only that unitonly that unit
Step 2: Examining the BackupStep 2: Examining the Backup
• course_files contains all files used in the linkscourse_files contains all files used in the links• moodle.xml contains all entries from moodle.xml contains all entries from MoodleMoodle
database pertinent to what was backed updatabase pertinent to what was backed up
Step 2: Examining the BackupStep 2: Examining the Backup
• Placeholder Placeholder for all links not actually usedfor all links not actually used– (So there are no broken links)(So there are no broken links)
Step 3: Examining the XMLStep 3: Examining the XML• Only 3 Key sectionsOnly 3 Key sections::
– <info><details>...<info><details>...
InstancesInstances– <course><course>
SectionsSections– <course><course>
ModulesModules
• Carefully note and Carefully note and label each item label each item which must be which must be changedchanged
Step 3: Examining the XMLStep 3: Examining the XML• Every Every Instance Instance hashas• <id>...</id><id>...</id>
– used internally to link used internally to link the 3 sectionsthe 3 sections
– You will not touch You will not touch this, but must note itthis, but must note it
• <name>...</name><name>...</name>– Name given to itemName given to item– Hidden for labelsHidden for labels– Visible for resourcesVisible for resources
Step 3: Examining the XMLStep 3: Examining the XML• All All Sections Sections are are
empty except oneempty except one• Each section has aEach section has a
– <number></number><number></number>
• During operationDuring operation– Empty section moved Empty section moved
above active sectionabove active section– Section number Section number
changed to reflect changed to reflect new ordernew order
– Active section now Active section now points to empty points to empty section on sitesection on site
Step 3: Examining the XMLStep 3: Examining the XML• Need more sections?Need more sections?
– <course><header><course><header>
NumsectionsNumsections
• Recommend setting Recommend setting correct number of correct number of sections in course sections in course before beginning before beginning processprocess
Step 3: Examining the XMLStep 3: Examining the XML
• Items grouped by type under Modules: First the Items grouped by type under Modules: First the labelslabels– Match ID and Name to <instance>Match ID and Name to <instance>
(Modules are NOT in display order)(Modules are NOT in display order)– You will need to change Name (as in <instance>) and You will need to change Name (as in <instance>) and
<content><content>– Avoid formatting changes (< > ")Avoid formatting changes (< > ")
Step 3: Examining the XMLStep 3: Examining the XML
• Then resources: “Compose a Web Page”Then resources: “Compose a Web Page”– Match ID and Name to <instance>Match ID and Name to <instance>– You will need to change Name (as in <instance>) and You will need to change Name (as in <instance>) and
<alltext>, possibly <summary><alltext>, possibly <summary>– Avoid formatting changes (< > ")Avoid formatting changes (< > ")
Step 3: Examining the XMLStep 3: Examining the XML
• Then resources: “Link to a File”Then resources: “Link to a File”– Match ID and Name to <instance>Match ID and Name to <instance>– You will need to change Name (as in <instance>) and You will need to change Name (as in <instance>) and
<reference>, possibly <summary><reference>, possibly <summary>– Recommend keeping path constantRecommend keeping path constant
Step 4: Create the SpreadsheetStep 4: Create the Spreadsheet
• Two worksheetsTwo worksheets– Datasheet: Field names in row 1 and data in row 2Datasheet: Field names in row 1 and data in row 2– All data will be linked from second worksheet: All data will be linked from second worksheet:
EntrysheetEntrysheet
(Slowly and carefully)(Slowly and carefully)
Step 4: Create the SpreadsheetStep 4: Create the Spreadsheet• When filling in When filling in
EntrysheetEntrysheet– All data will be All data will be
linked to datasheetlinked to datasheet– Start Start Name Name of any of any
unused item with Xunused item with X– Use copy and Use copy and
paste for file namepaste for file name
(Files already in (Files already in place, no errors place, no errors in transcription)in transcription)
• Point any unused Point any unused links to Placeholder links to Placeholder filefile
Step 5: Prepare the MailmergeStep 5: Prepare the Mailmerge• Word Word does not want does not want
to open XML files as to open XML files as text, even if you text, even if you change the filename change the filename extensionextension– Use Use Wordpad Wordpad (once) (once)
to open .txt copy of to open .txt copy of XMLXML
Change extension Change extension from .xml to .txtfrom .xml to .txt
– Change all < to Change all < to something else #!something else #!
– Save as .doc fileSave as .doc file
Step 5: Prepare the MailmergeStep 5: Prepare the Mailmerge• Use Use mailmergemailmerge wizard wizard• Carefully replace text with variable Carefully replace text with variable
namesnames
• Save fileSave file
Using the ToolUsing the Tool
Step 1: Prepare the filesStep 1: Prepare the files
• Copy the backup.zip file, naming it for the new Copy the backup.zip file, naming it for the new unitunit
• Replace all the old files with the new ones for Replace all the old files with the new ones for the unit in questionthe unit in question
• Make sure ‘Placeholder’ is present in each folderMake sure ‘Placeholder’ is present in each folder
Step 2: Fill in the SpreadsheetStep 2: Fill in the Spreadsheet
• Enter all labels, titles, file names, etc for new Enter all labels, titles, file names, etc for new unit.unit.
• Name any unused item beginning with XName any unused item beginning with X• Point any unused links to Placeholder filePoint any unused links to Placeholder file• Copy and paste file names into spreadsheetCopy and paste file names into spreadsheet• Save copy of original spreadsheet with name of Save copy of original spreadsheet with name of
new unitnew unit
Step 3: Run MailmergeStep 3: Run Mailmerge
• Open Word document and attach new spreadsheet Open Word document and attach new spreadsheet at data sourceat data source
• Run mailmerge and “edit individual letters”Run mailmerge and “edit individual letters”– (Producing a new document)(Producing a new document)
– Eyeball document (the first few times), to spot visible Eyeball document (the first few times), to spot visible errors. Fix spreadsheet and/or Word document and start errors. Fix spreadsheet and/or Word document and start againagain
• Shift empty <section> above active <section> and Shift empty <section> above active <section> and update numbers. (This is a key step!)update numbers. (This is a key step!)
• Change all !# back to <Change all !# back to <• Save as “plain text” with .txt endingSave as “plain text” with .txt ending
Step 3: Moving the SectionStep 3: Moving the Section• All All Sections Sections are are
empty except oneempty except one• Each section has aEach section has a
– <number></number><number></number>
• During operationDuring operation– Empty section moved Empty section moved
above active sectionabove active section– Section number Section number
changed to reflect changed to reflect new ordernew order
– Active section now Active section now points to empty points to empty section on sitesection on site
Step 4: Package backup fileStep 4: Package backup file
• Change extension on moodle.txt, to read Change extension on moodle.txt, to read moodle.xmlmoodle.xml
• Copy new moodle.xml into backup zip file Copy new moodle.xml into backup zip file
Step 5: Restore BackupStep 5: Restore Backup
• Upload backup file to Moodle site (must be below site maximum in size)Upload backup file to Moodle site (must be below site maximum in size)• RestoreRestore
Step 5: Restore BackupStep 5: Restore Backup
• Restore as “Existing course, adding to itRestore as “Existing course, adding to it• Choose the target courseChoose the target course
Step 5: Restore BackupStep 5: Restore Backup• Select active Select active
item to restoreitem to restore– An X in name of An X in name of
unused items is unused items is very helpful very helpful here.here.
Step 6: Tidy UpStep 6: Tidy Up
• Check new unit for all itemsCheck new unit for all items• Some items may have to be movedSome items may have to be moved
– (Do not even attempt to move items around in the xml (Do not even attempt to move items around in the xml file. This technique assumes all units are more or file. This technique assumes all units are more or less structurally similar.)less structurally similar.)
• Add Unit Title, pictures, activities, etc. that were Add Unit Title, pictures, activities, etc. that were not included in processnot included in process
• Get ready to do the next unit....Get ready to do the next unit....
Recommended