Note: You are currently viewing documentation for Moodle 3.4. Up-to-date documentation for the latest stable version of Moodle is likely available here: Very flexible block system proposal.

Development:Very flexible block system proposal

From MoodleDocs
Revision as of 08:17, 6 February 2009 by Tim Hunt (talk | contribs)

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.


Template: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 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

Proposed BlocksDB.png

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