Moodle2Word Format in 2.1

Moodle2Word Format in 2.1

by Alick Brown -
Number of replies: 11

Hi,

I've been using Eoin Campbell's Moodle2Word Question converter. Worked fine in Moodle 2.0 but I have a problem after upgrading to 2.1 and reinstalling the Moodle2Word Question format.

In the Format table when importing to or exporting from a Question Bank, Moodle2Word appears as 'wordtable' instead of 'wordtable (Microsoft Word table format)'. Screenshot:
File Format Table

Export works fine, but Import produces this error: 'The type of the file you selected (application/msword) does not match the type expected by this import format (application/xml)'
Screenshot:
Import error

Loading...
Any advice? Many thanks
Alick
Average of ratings: -
In reply to Alick Brown

Re: Moodle2Word Format in 2.1

by Jean-Michel Védrine -

hello,

to correct the first problem (name of the format not correctly displayed in the format list) just navigate on your server to the question/format/wordtable/lang/ folder and rename the subfolder en_utf8 to en (ie suppress the "_utf8")

correction of the second problem is a little more uneasy as you need to edit a file. If you are unsure on how to do it, you can try to forward this message to the wordtable author and I am sure he can publish an updated version for Moodle 2.1 very soon.

You need to edit the file question/format/wordtable/format.php

just after the line

class qformat_wordtable extends qformat_xml {

add the lines :

    public function mime_type() {
        return 'application/msword';
    }

Please note that :

  • I have been unable to test myseft that this change is enought to make the wordtable format run with Moodle 2.1 because I don't use it, but looking at the code I saw that these lines were missing (the mime_type function is new in Moodle 2.1).
  • As there is little or no change in question formats from Moodle 2.0 to 2.1 apart this new function, I am rather confindent that once the mime_type function will be added the format will work

hope this will help you

In reply to Jean-Michel Védrine

Re: Moodle2Word Format in 2.1

by Alick Brown -

Hello Jean-Michel,

Thanks for the quick response.

Unfortunately changing 'en_utf8' to 'en' in the question/format/wordtable/lang/ folder did not work.

And changing the mime_type, produced a new error:

'record_exists() not available anymore'

Firebug shows this:

element is undefined
https://[my domain]/question/import.php?courseid=42
Line 123

Best wishes

Alick

In reply to Alick Brown

Re: Moodle2Word Format in 2.1

by Jean-Michel Védrine -

Hello,

Are you sure that you have installed the version of Moodle2Word for Moodle 2.0 and not the one for Moodle 1.9 ?

This error message should not be displayed with version of Moodle2Word for Moodle 2.0 because I have verified and E Campbell has correctly upgraded his code and I see absolutely no possiblity that this message could be displayed with the version for Moodle 2.0

Please can you :

In reply to Jean-Michel Védrine

Re: Moodle2Word Format in 2.1

by Jean-Michel Védrine -

Hello,

The page to download the 2.0 version is this one :

http://www.moodle2word.net/course/view.php?id=2

choose :

Moodle 2.0 question import plug-in for Word tables (Zip file containing PHP code) (Updated: 2011-06-06)

I have tried to do a complete test, I took a free inscription to E Campbell site but unfortunately I have no sample file to test the import but I don't get the same error message you have : I get noquestioninfile wich is quite understandable because I submitted an empty word file !!

EDIT : After downloading the blank model from Campbell's website I just created an MCQ question and imported it in one of my Moodle 2.1 test sites with no problem. So yes it is working with Moodle 2.1 with the addition of the mime_type function.

In reply to Jean-Michel Védrine

Re: Moodle2Word Format in 2.1

by Alick Brown -

Hello Jean-Michel,

I asked the network manager to reinstall the plug-in and it is working fine now. I'm not sure where the error came from - maybe as you say, the wrong version.

I still have the wordtable error so I must check the 'lang' folder again.

Many thanks for your time investigating this.

Best wishes

Alick

In reply to Alick Brown

Re: Moodle2Word Format in 2.1

by Jean-Michel Védrine -

Hello Alick,

Very nice to hear your imports are nwo working.

The problem of the "wordtable error" is caused by a missing string in the question/format/wordtable/lang/en/qformat_wordtable.php.

If you add something like

$string['wordtable'] = 'Moodle to Microsoft Word format';

in this file all should be back to normal.

Maybe it would be good to report both issues to E Campbell ?

In reply to Jean-Michel Védrine

Re: Moodle2Word Format in 2.1

by Eoin Campbell -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

I was away last week, but I implemented the fixes you suggested, tested on a clean Moodle 2.1 installation, and it seems OK. I have now updated the source code repository, and the latest code is now available from http://moodle.org/mod/data/view.php?d=13&rid=4012&filter=1

In reply to Eoin Campbell

Re: Moodle2Word Format in 2.1

by Tawfeeq Jaafar -

Great plugin, Eoin.

Just recently I tried to export questions which has a table in the question statement, the export to Word had shown the tables correctly.

However, I tried to vise versa (check image below).  I added a question in the Word file, and tried to create a table inside the question statement cell (or any of the feedback/option cell), and then tried to import it into Moodle.

Unfortunately, the table was not imported as a table.  Instead, each cell in that table has become a new paragraph line.  Is there a way to work this issue out?

Moodle2Word with a table in question statement

In reply to Tawfeeq Jaafar

Re: Moodle2Word Format in 2.1

by Eoin Campbell -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Unfortunately Moodle2Word does not currently support putting tables inside the table cells for the question stem or answers, and it's a big job to add it in as a feature.

In reply to Eoin Campbell

Re: Moodle2Word Format in 2.1

by Darren Besanko -

I've tried to import for the first time, but have these errors. Does anyone have a good suggestion?

Thanks, Darren


importpreprocess:92: Word file = Pre-sales Questions_Automation Systems_DB.docx; path = /home/nhp/moodledata/temp/questionimport/Pre-sales Questions_Automation Systems_DB.docx
•line 92 of /question/format/wordtable/format.php: call to debugging()
•line 114 of /question/import.php: call to qformat_wordtable->importpreprocess()

importpreprocess:116: XSLT not installed
•line 116 of /question/format/wordtable/format.php: call to debugging()
•line 114 of /question/import.php: call to qformat_wordtable->importpreprocess()


In reply to Darren Besanko

Re: Moodle2Word Format in 2.1

by Eoin Campbell -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Darren, your problem is that the PHP XSLT extension is not installed (cf. "importpreprocess:116: XSLT not installed").

Read the section "Pre-requisites" on the WordTable plugins page for instructions on how to fix this.