My name is Mohamed Alsharaf. I am newbie moodler and here is my first attempt to contribute to Moodle.
I have created a simple builder to create sub questions in embedded answers question type. The builder is in a popup window with a form and preview screen. I have attached the source code in this post.
How to install this new feature?
- Unzip the attached file
- There is a patch file “patch_multianswer”. Apply it to your code and you are done.
- There are several files and folder included in the zip file. They are all what you need to for this new feature; most of them are new files except for edit_multianswer_form.php
- Copy all of the files/folder except for edit_multianswer_form.php into question/type/multianswer/
- Open edit_multianswer_form.php
- Copy the code from line 20 to 127, then paste it into your copy of edit_multianswer_form.php
- In your copy of edit_multianswer_form.php go to method “definition_inner”. Paste this code inside it
- You are done
How to use it
- Create a new Embedded answers (Cloze)
- You will see a link under question text field “Show Sub-Question Builder “ click the link to open the builder.
Missing features :
Currently the insert button works when you don’t have html editor enabled or if you are using TinyMCE editor.
More validations to the builder form. For example, if the question type is numerical then the answer must be numeric.
I Hope you like this new feature.