merged from 1.9 :: MDL-11154 :: added the missing code and the config line and explanation in config.php for flexible columns.
This commit is contained in:
+68
-18
@@ -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 '<table id="layout-table"><tr>';
|
||||
|
||||
if((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
|
||||
echo '<td style="width: '.$blocks_preferred_width.'px;" id="left-column">';
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
$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 '<td style="width: '.$blocks_preferred_width.'px;" id="left-column">';
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
|
||||
echo '<td id="middle-column">';
|
||||
print_container_start();
|
||||
echo '<div id="resource">';
|
||||
case 'middle':
|
||||
echo '<td id="middle-column">';
|
||||
print_container_start(false, 'middle-column-wrap');
|
||||
echo '<div id="resource">';
|
||||
break;
|
||||
|
||||
case 'right':
|
||||
if((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
|
||||
echo '<td style="width: '.$blocks_preferred_width.'px;" id="right-column">';
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
}
|
||||
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 '</div>';
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
$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 '<td style="width: '.$blocks_preferred_width.'px;" id="left-column">';
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
|
||||
if((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
|
||||
echo '<td style="width: '.$blocks_preferred_width.'px;" id="right-column">';
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
case 'middle':
|
||||
echo '</div>';
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
break;
|
||||
|
||||
case 'right':
|
||||
if((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
|
||||
echo '<td style="width: '.$blocks_preferred_width.'px;" id="right-column">';
|
||||
print_container_start();
|
||||
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
|
||||
print_container_end();
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</tr></table>';
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user