Upload and stock flash file in new question type

Upload and stock flash file in new question type

by Gilles-Philippe Leblanc -
Number of replies: 4

Hello,

I need advice about programming to create a new type of question using a flash file.

Indeed. My goal is to create a question using a flash file previously filed by the teacher when creating the question moodle.

I want the flash movie displayed for students and when they click in the flash file, the answer is transmitted in the response field of my new type of question.

The problem is that I can not properly configure the filemanager in the file "edit_myquestiontype_form.php" for it saves correctly the swf file so I can reuse it in the file "renderer.php." The only documentation I found is this but it is not detailed enough.

Thank you for your help.

Average of ratings: -
In reply to Gilles-Philippe Leblanc

Re: Upload and stock flash file in new question type

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Well, that is the right documentation to be reading. You may find it more helpful to look at some other Moodle code that does what you want and works, rather than just reading the docs. https://github.com/jamiepratt/moodle-qtype_ddimageortext might be a good model.

In reply to Tim Hunt

Re: Upload and stock flash file in new question type

by Gilles-Philippe Leblanc -

Thank you. The example helped me a lot. I almost managed to set up a working example.

The only thing I notice is that when I specify a file in the file picker, I save the form and when I open again the file picker says: "No file submitted." I can not find the code that calls this file in the list when opening the form.

In reply to Gilles-Philippe Leblanc

Re: Upload and stock flash file in new question type

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

There is a function you have to call to copy the files into the right draft file area before you display the form. It should be there in the ddimagetoimage qtype.

In reply to Tim Hunt

Re: Upload and stock flash file in new question type

by Gilles-Philippe Leblanc -

He was there indeed. I copied the code but I had not renamed the qtype to the one of my type of question in the method data_preprocessing. I'll put it under the account of tiredness because it was late ... Sorry and thank you our your help, it works fine now!