Development:Very flexible block system proposal
From MoodleDocs
Note: This article is a work in progress. Please use the page comments or an appropriate moodle.org forum for any recommendations/suggestions for improvement.
This is my attempt the devise the most flexible possible blocks system I could, which still had reasonable performance. (Whether that was a sensible thing to do remains to be seen ;-))
Goals
- Existing blocks should continue to work in the new scheme. (If absolutely necessary, we may require small changes.)
- Consistent implementation of (essentially) every page in Moodle.
- Let themes, and possibly the page itself, determine where on the page the blocks should appear. (I.e, not just 'right' and 'left'.)
- Much more flexible sticky blocks. (Every course, in a category, any page of any type in this course, etc.)
Setting the scene
This relies on some ideas from Development:Navigation/Pagelib/Blocks_2.0_design.
What happens when a page is requested
The page, for example, mod/quiz/attempt.php, ...
Inner workings of this proposal
Database tables
Column | Type | Comment |
---|
What happens when a page is requested
SELECT * FROM mdl_block_instances bi LEFT JOIN mdl_block_positions bp ON bp.blockinstanceid = bi.id AND bp.contextid = $contextid AND bp.pagetype = $pagetype AND bp.subtype = $subtype WHERE bi.contextid IN ($thiscontextandparents) AND $pagetype LIKE bi.pagetypepattern $subtype LIKE bi.subtypepattern ORDER BY bp.position, bp.weight
User interface
Configuring blocks
Rearranging blocks
Configuring sticky blocks
See also
- http://moodle.org/mod/forum/discuss.php?d=95882 General Developer Forum thread about this.
- Development:Navigation/Pagelib/Blocks_2.0_design
- Development:Navigation_2.0
- Roadmap