I would like to have original assign module available but, also, another one with code-hacking to some specific points.
For example, I would like to edit email receipt, when a student submits an assignment, and print more information than original assignment module. As I would like teacher to give both available ways of assingment, I have to find a way to copy assign folder to assign_edited, make any code-hacking I want to assign_edited module and then, have both modules (the original one and assign_edited) available when teacher add an activity in a course..
How can this clone of module be done??
Thank you in advance!
Any help please?
The basic method is to copy the code into a new subdirectory within mod/ (e.g. mod/assign => mod/myassign), then go through and rename every relevant reference from 'assign' to 'myassign' (and rename lang/en/assign.php to lang/en/myassign.php).
The trick will be making sure that you change all the right references, without affecting any misc mentions of 'assign' which aren't directly references to the module itself. That's something you can only find out by trying it (and being very familiar with the internals of Moodle modules).
Personally, I'd advise against this - the assign module is probably the most complex of all the standard modules (especially considering all the submission + feedback plugins it contains). Renaming it this way will be a bit of a nightmare - one that will only get worse as you try to maintain it over Moodle version upgrades.
I think you would probably be better off making small, well commented changes to the original code (utilising the power of Git to maintain the changes over upgrades) and adding a setting to the settings page to allow teachers to choose between the two different modes of behaviour.
Thank you very much Davo for your question. I wish there was an easiest way to do it than this method you described which is the most obvious way..
Another relevant question. Do I have to create tables to database? For example mdl_myassign, mdl_myassign_submissions and so on?
Or this new module will write to the same tables as assign module?
Could you please help me with this?
Thank you in advance!
If you use the original code it will write to the original tables. If you modify the tables names in the code (e.g. to change mdl_assign to mdl_myassign) then it will use these tables which you will have to create.
But may I suggest that you first look to see if someone else has already done this work or something similar. Davo is right - maintaining separate code branches quickly becomes a nightmare if you do not have a professional programmer on the job.
You may find that other plugins and settings will allow you to get 80% of what you want without too much effort on your part. And before you ask, no, I don't know which plugins or settings - you have to search those yourself, sorry .
Hope this helps,
thank you for your answer. It is my mistake that it's not clear what I want to succeed.
I have customized the original assign module to cover the issue of uploading written assignments to my organization. I have changed language translations to the language I have installed, I have changed mails subjects', I have choosed to print more info to the receipt email such as student idnumber, student email and so on (I have add some lines of code to the file mod/assign/locallib.php). All this modifications are well documented and they are very clear to me.
Now, I want a module for thesis submission and not for the written submission. The receipt emails must have "thesis submission" text and not "written submission". The main problem for now is those translations which I would like to print at the subject and the body of the email.
And I thought that I have to duplicate the module assignment (as Davo wrote before) in order to succeed this functionality..
So, after describing with details the problem, is Davo's way the only one for now?
And what about the tables of the DB? Can't two similar modules (as these ones) write to the same tables?
Thank you much for your help.