Note:

This site is no longer used and is in read-only mode. Instead please go to our new Moodle Developer Resource site.

Very flexible block system proposal: Difference between revisions

From MoodleDocs
New page: {{Work_in_progress}} {{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 th...
 
No edit summary
Line 3: Line 3:


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 ;-))
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==
==Setting the scene==
This relies on some ideas from [[Navigation/Pagelib/Blocks_2.0_design]].


===What happens when a page is requested===
===What happens when a page is requested===
The page, for example, mod/quiz/attempt.php, ...


==Inner workings of this proposal==
==Inner workings of this proposal==
Line 20: Line 31:


===What happens when a page is requested===
===What happens when a page is requested===
<pre>
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
</pre>


==User interface==
==User interface==

Revision as of 08:17, 6 February 2009

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