Exporting from Lesson to GIFT

Exporting from Lesson to GIFT

by Steve Garcia -
Number of replies: 4
I don't know if anyone other than myself would be interested in this....

For one course I've been teaching, I haven't needed the Quiz module, but I've found it useful to create Lessons for students to practice with before they actually take the exam (on paper.)  Thus, I've fed a bunch of questions into the Lesson module.

Now I have reason to want to make these same questions available as actual quizzes (I'll be teaching a summer session.)  When I looked I discovered that (as of 1.5.3) there is no way to share these questions from within Moodle, and the Lesson module has no way to export those questions so I can later import them to the Quiz module.

Now I realize that these two modules are being brought closer together in a future version of Moodle, and this will be the perfect solution, but I doubt that's going to be ready before my summer session starts.  So in the mean time, I've cobbled together a script that extracts all the lessons in a particular course and creates GIFT files from the questions.

The script is fairly simple -- I only use T/F and single value Multiple Choice questions, so those are the only type of questions it handles.  It wouldn't be too hard to add other types, I just haven't.  It's a command line PHP script -- it could probably be made to work over the web, but I have access to the command line, so it was easier for me to do it this way.  It's also written to require PEAR and PEAR DB.

Given these limitations, and the limited application (export from Lessons only), would anyone be interested in this script?  If so, I can easily attach it to this forum (if that's the approved method of distributing stuff like this.)
Average of ratings: -
In reply to Steve Garcia

Re: Exporting from Lesson to GIFT

by Chris Collman -
Picture of Documentation writers
Yes I would be interested.   Let us wait for  Mark or Michael or somebody else tell you how to distribute it.   I think there are better places to store the code.

That is why I like to write my questions for a lesson in GIFT because I can import them into a lesson but have the option to import them into a quiz.  Some of my teachers call this "too many extra steps", and insert their questions into the lesson.  Few of these questions are repeated in a Quiz.   Darn, sounds like your script will prove them correct.  

Chris
In reply to Steve Garcia

Re: Exporting from Lesson to GIFT

by Mark Nielsen -
Hi Steve,

Since this is a very custom script, posting it in the forum would be fine. You could also shove it into CVS/contrib, which is a great place to store code for distributing and for updating.

Cheers,
Mark
In reply to Mark Nielsen

Re: Exporting from Lesson to GIFT

by Steve Garcia -
OK, here is the command line script as a zipped up attachment.  It does require PEAR DB, and you need to know the numeric ID of the course you want to extract.  When you invoke it  like so:

./exportlesson.php 7

It will look inside whichever course has numeric id=7 and extract all the questions in each lesson into its own GIFT file.  If you don't specify a course number it will choose 9, since that's the one I was interested in extracting when I wrote it.  The file name will be taken from the title of the lesson in question, with all the spaces squeezed out.  There's no provision for a extracting a single question or even a single lesson, since that wasn't what I was after, but it probably could be done.

Again, the only question types I dealt with were T/F and single answer multiple choice.  It probably wouldn't be too hard to add others.

How would I go about adding it to the CVS/contrib repository?
In reply to Steve Garcia

Re: Exporting from Lesson to GIFT

by Steve Bilton -
Hello there

This sounds very interesting, i would also quite interested to see if it were possible to export as a word doc,txt etc, or maybe some other form of editable format.
Does anyone have any suggestions?

Cheers

Steve