]> git.mjollnir.org Git - moodle.git/commitdiff
merged from 1.9 :: MDL-11154 :: added the missing code and the config line and explan...
authorurs_hunkler <urs_hunkler>
Sat, 12 Jan 2008 18:14:49 +0000 (18:14 +0000)
committerurs_hunkler <urs_hunkler>
Sat, 12 Jan 2008 18:14:49 +0000 (18:14 +0000)
mod/resource/lib.php
theme/custom_corners/config.php

index ed432f2a859dbdab4e7d4b398304b6ce05b344fa..88de2667ee343c9b7afe245fb9acb259bb6e9657 100644 (file)
@@ -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;
+
+                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;
+            }
         }
-
-        echo '<td id="middle-column">';
-        print_container_start();
-        echo '<div id="resource">';
-
     }
 
 
@@ -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>';
-
-        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>';
+        $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;
+
+                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>';
index 5038756d5f8912df524382be0c784292e0ad0a3c..f7ae3ea3632cb8ed24e5d125c7f7ed52cd2cb4ed 100644 (file)
@@ -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