From f58fcc82340c4e4661658bafea565f68ee40997b Mon Sep 17 00:00:00 2001 From: urs_hunkler Date: Sat, 12 Jan 2008 18:14:49 +0000 Subject: [PATCH] merged from 1.9 :: MDL-11154 :: added the missing code and the config line and explanation in config.php for flexible columns. --- mod/resource/lib.php | 92 +++++++++++++++++++++++++-------- theme/custom_corners/config.php | 8 +++ 2 files changed, 79 insertions(+), 21 deletions(-) diff --git a/mod/resource/lib.php b/mod/resource/lib.php index ed432f2a85..88de2667ee 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 ''; - if((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) { - 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 ''; + } + break; + + case 'middle': + echo ''; + } + break; + } } - - echo ''; - - if((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) { - 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 'middle': + echo ''; + print_container_end(); + echo ''; + break; + + case 'right': + if((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) { + echo ''; + } + break; + } } echo '
'; - print_container_start(); - blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); - print_container_end(); - echo ''; + print_container_start(); + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); + print_container_end(); + echo ''; + print_container_start(false, 'middle-column-wrap'); + 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 ''; - print_container_start(); - echo '
'; - } @@ -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_end(); - echo '
'; - print_container_start(); - blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); - print_container_end(); - echo ''; + print_container_start(); + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); + print_container_end(); + echo ''; + print_container_start(); + blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); + print_container_end(); + echo '
'; diff --git a/theme/custom_corners/config.php b/theme/custom_corners/config.php index 5038756d5f..f7ae3ea363 100644 --- a/theme/custom_corners/config.php +++ b/theme/custom_corners/config.php @@ -88,6 +88,14 @@ $THEME->block_r_max_width = 210; /// values are taken. +// $THEME->layouttable = array('left', 'middle', 'right'); + +/// $THEME->layouttable defines the way the columns are displayed +/// on the pages. You can rearange the columns to have the content +/// left and the two columns on the right page side. +/// $THEME->layouttable = array('middle', 'left', 'right'); + + $THEME->courseformatsheets = true; /// When this is enabled, this theme will search for files -- 2.39.5