diff --git a/mod/resource/lib.php b/mod/resource/lib.php index ed432f2a859..88de2667ee3 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -82,6 +82,7 @@ class resource_base { global $CFG; global $USER; + global $THEME; require_once($CFG->libdir.'/blocklib.php'); require_once($CFG->libdir.'/pagelib.php'); @@ -109,18 +110,40 @@ class resource_base { echo '
| '; - print_container_start(); - blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); - print_container_end(); - echo ' | '; + $lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable; + foreach ($lt as $column) { + $lt1[] = $column; + if ($column == 'middle') break; } + foreach ($lt1 as $column) { + switch ($column) { + case 'left': + if((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) { + echo ''; + print_container_start(); + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); + print_container_end(); + echo ' | '; + } + break; - echo '';
- print_container_start();
- echo ' ';
+ case 'middle':
+ echo ' ';
+ print_container_end();
+ echo '';
+ print_container_start(false, 'middle-column-wrap');
+ echo ' | ';
+ $lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable;
+ foreach ($lt as $column) {
+ if ($column != 'middle') {
+ array_shift($lt);
+ } else if ($column == 'middle') {
+ break;
+ }
+ }
+ foreach ($lt as $column) {
+ switch ($column) {
+ case 'left':
+ if((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
+ echo '';
+ break;
+ case 'right':
+ if((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
+ echo ' ';
- print_container_end();
- echo '';
+ print_container_start();
+ blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
+ print_container_end();
+ echo ' | ';
+ }
+ break;
+ }
+ }
}
@@ -130,21 +153,48 @@ class resource_base {
function display_course_blocks_end() {
global $CFG;
+ global $THEME;
$PAGE = $this->PAGE;
$pageblocks = blocks_setup($PAGE);
$blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
- echo '';
+ print_container_start();
+ blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+ print_container_end();
+ echo ' | ';
+ }
+ break;
- if((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
- echo '';
- print_container_start();
- blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
- print_container_end();
- echo ' | ';
+ case 'middle':
+ echo ' | ';
+ break;
+
+ case 'right':
+ if((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
+ echo ''; + print_container_start(); + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); + print_container_end(); + echo ' | '; + } + break; + } } echo '