Duplicate (part of) an existing module?

Duplicate (part of) an existing module?

by Jean-Luc Delghust -
Number of replies: 10
Hi all,

We use Moodle for Language teaching, and in that, we use the Online text Assignment module a lot. It's great, though lacking a feature for us. Now, as we share the installation of Moodle with the rest of the university, so we can't just modify a module to fit our needs.
I'm not a programmer, unfortunately, I can maybe get somene to work on it, but I'd need some info first, and I'd appreciate any suggestions/help.
Here's what I'd like to do:
- Duplicate the "Online Text" assignemnt module with another name, so in the dropdown list, when you click on "Add an Activity > Assignement" there would be something like "Online Text EFL (English Foreign Language)"
- That duplicated module would behave exactly like the original except that the text editor in the feedback field (when a teacher clicks on "grade" to add feedback and grades for students) would be replaced by a TinyMCE including a custom-made plugin we developed here (basically, that plugin allows us to easily add tags to identfy students' language mistakes.

I have found discussions about replacing the text editor by TinyMCE for the whole moodle install, and although I'd really like that very much, I don't think our admin will be very fond of the idea...

Any help or suggestion very welcome!


Average of ratings: -
In reply to Jean-Luc Delghust

Re: Duplicate (part of) an existing module?

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Should be a fairly simple job.

Copy everything in the 'mod/assignment/type/online' folder into a new folder (e.g. 'mod/assignment/type/onlineefl' )

Rename the 4 times the phrase 'assignment_online' appears in 'assignment.class.php' to 'assignment_onlineefl'.

Copy the 'function display_submission' code from 'mod/assignment/lib.php' into the 'assignment_onlineefl' class defined in 'assignment.class.php', then change the 'print_textarea' line to whatever you want to display instead.

You also need to add a sub-folder called 'lang/en_utf8', put a file called 'assignment_onlineefl.php' in there and add the following code:
<?php
$string['typeonlineefl'] = 'Online Text EFL';
?>
(this last bit will only work if you have the latest version of Moodle, with the following fix in it: http://tracker.moodle.org/browse/MDL-16796 )

That should cover it, but I may have missed something somewhere along the lines...
In reply to Davo Smith

Re: Duplicate (part of) an existing module?

by Jean-Luc Delghust -
Thanks fo the quick reply, will try as soon as I can and post any results here! I'll also need to check if the fix is included in the install we're running...
In reply to Davo Smith

Re: Duplicate (part of) an existing module?

by Jean-Luc Delghust -
I'm currently working on it. Maybe I missed something, but what code should I add in 'lang/en_utf8'?

TIA
In reply to Jean-Luc Delghust

Re: Duplicate (part of) an existing module?

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Oops, didn't notice that the forum had stripped out the code I inserted there.

Have a look at this page for some details:

http://docs.moodle.org/en/Development:Assignment_types

(just remember to replace 'PLUGINNAME' with 'onlineefl', or whatever you have called the plugin)

In reply to Davo Smith

Re: Duplicate (part of) an existing module?

by Jean-Luc Delghust -
OK thanks for all the help, really much appreciated!

Part 1, the duplication, was successful. Still looking into how to integrate TinyMCE, one step at the time smile
Two little "bugs" though:
- now when I go to admin > notifications, I get a blank screen. The rest works OK...
- When I want to add an assignment, it is displayed as "typeonlineeslfr" - which is the name I chose for the plugin. I have upgraded my install to the latest weekly built, maybe I did something wrong... Not a big issue though..
In reply to Davo Smith

Re: Duplicate (part of) an existing module?

by Jean-Luc Delghust -
Hmm, I spoke too soon. I must have done something wrong, because the module is duplicated, but when I click on "grade", page that appears is the normal assignment feedback page, not a modified version...
In reply to Jean-Luc Delghust

Re: Duplicate (part of) an existing module?

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I've just sent you a message with my email address in it.

If you zip up the module and email it to me, I'll take a look at it and see if I can figure out what's gone wrong...
In reply to Davo Smith

Re: Duplicate (part of) an existing module?

by Jean-Luc Delghust -
Thanks, I sent you the email. Many thanks!
In reply to Jean-Luc Delghust

Re: Duplicate (part of) an existing module?

by StratBeans Consulting -
Was curious if your integration was finally successful. If yes do share what all went into it in terms of addition of TinyMCE and language plugin.
In reply to StratBeans Consulting

Re: Duplicate (part of) an existing module?

by Jean-Luc Delghust -

Hi, sorry, but it didn't work out in the end.. I decided to wait for our install to upgrade to Moodle 2.0, and in the meantime I'm finalizing different translations of the plugin...