API Proposal for modules printing to the course page

API Proposal for modules printing to the course page

by François Marier -
Number of replies: 1
Hi,

I'd like to propose that the label module be refactored in order to allow other modules to display their own contents on the course pages.

I have posted a patch (against 1.9) on MDL-16820.

This allows module writes to do things like this:

http://docs.moodle.org/en/Integrating_Face-to-face_sessions_on_the_course_page#Result

Does the API look reasonable?

Francois
Average of ratings: -
In reply to François Marier

Re: API Proposal for modules printing to the course page

by Martín Langhoff -

My main concern is cost in includes, sql queries and memory footprint. So far the existing API is awkward but efficient -- you can have courses with a lot of modinstances from different modules without worrying about it causing more DB queries.

It still has other costs, but the slowdown is not so bad. Compare it with the very visible slowdown you get (and the server hammering) with courses with lots of blocks enabled. The blocks API is "nice" but it's a huge pig.

So I would suggest...

  • provide a means for the modinstance to say "yes, I need to be included and called" so modinstances and module types that don't do fancy stuff don't pay include() costs
  • provide a way to include a smaller lib file. lib.php is often largeish
  • maybe a cache (like the modinfo serialised array) to store cacheable bits