Proposal/questions: Support for "cloning" assets

Re: Proposal/questions: Support for "cloning" assets

by Brad Smith -
Number of replies: 1

Thanks for the tip about LTI. I'll look into that.

I'm still curious as to why that "one and only one course module" limitation exists, if anyone has the time and inclination to explain. If there's a reason for it other than the fact that other stuff has already been built on top of it then great, but if it's a design flaw then perhaps correcting it could be considered for the next major version that doesn't guarantee backwards compatibility? Either way, I acknowledge that this isn't the sort of thing that would just be changed in an update to the 2.x line. 

In reply to Brad Smith

Re: Proposal/questions: Support for "cloning" assets

by Simon Coggins -

I don't know of any specific reason, other than I guess that it wasn't a requirement at the time it was implemented the way it is.

As a feature I think it would be great, and we actually gave it some thought as to if we could implement something like this for Totara, but it is hard to see a path to making such a fundamental change to the existing code.

For example, I suspect it would break moodle's hierarchical capabilities system. If you have a forum activity for example, in mdl_forum:

id name
1 My forum

And you put the same instance in two courses via mdl_course_modules:

id course module instance
1 2 11 1
2 2 11 1

Then the context table will need to look like this:

id contextlevel instanceid path  
1 10 0 /1 Site context
2 50 1 /1/2 Site course
3 40 1 /1/3 Miscellaneous category
...        
23 50 2 /1/3/23 Our first course
24 70 1 /1/3/23/24 Our forum activity in course 1
..        
47 50 3 /1/3/47 Our second course
48 70 1 /1/3/47/48 Our forum activity in course 2
...        

So now any changes to activity level capabilities are no longer stored in one place, plus you need to figure out which courses contain the activity so you can rebuild the cache, and before you know it you have to rewritten accesslib.php smile.

You can see how a single modified assumption (one course module record per instance) can lead to further changes to other assumptions (one context per instance), which then leads to more changes...

So yes, something for Moodle 3.x I suspect.

Simon