Very flexible block system proposal
From MoodleDocs
Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.
Moodle 2.0
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 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.
- Navigation/Pagelib/Blocks_2.0_design
- Navigation_2.0
- Roadmap