]> git.mjollnir.org Git - moodle.git/commitdiff
Adding blocks to lesson
authormark-nielsen <mark-nielsen>
Sat, 24 Mar 2007 23:07:59 +0000 (23:07 +0000)
committermark-nielsen <mark-nielsen>
Sat, 24 Mar 2007 23:07:59 +0000 (23:07 +0000)
 * added pagelib.php with lesson_page class definition
 * Lesson view now uses standard page layout classes
Other fixes:
 * minor fix to mod settings form
 * fixed function names (some were missing lesson_ prefix)

mod/lesson/action/continue.html
mod/lesson/action/continue.php
mod/lesson/lib.php
mod/lesson/locallib.php
mod/lesson/mod_form.php
mod/lesson/pagelib.php [new file with mode: 0644]
mod/lesson/styles.php
mod/lesson/view.php
mod/lesson/viewend.html
mod/lesson/viewstart.html

index b9c59c71787c7ce126d720691a850302b877ab34..8fd055055a66252396924e2cf5f0d8cee22f7fbc 100644 (file)
@@ -8,14 +8,24 @@
 ?>
 
 <!-- Primary layout table -->
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-    <tr valign="top">
+<table id="layout-table" cellpadding="0" cellspacing="0">
+    <tr>
         <!-- First Column -->
-        <td valign="top">
-            <?php print_menu_block($cm->id, $lesson); ?>
+        <?php if (lesson_blocks_have_content($lesson, $pageblocks, BLOCK_POS_LEFT)) { ?>
+        <td id="left-column" style="width: <?php echo $leftcolumnwidth; ?>px;">
+            <?php
+                lesson_print_menu_block($cm->id, $lesson);
+
+                if (!empty($CFG->showblocksonmodpages)) {
+                    if ((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
+                        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+                    }
+                }
+            ?>
         </td>
+        <?php } ?>
         <!-- Start Primary column -->
-        <td align="center" width="100%">
+        <td id="middle-column">
     
 <?php if ($lesson->displayleft) { // Skip navigation anchor ?>
         
     }
 ?>
 
-            <table border="0" align="center">
-                <tr>
-                    <td class="c0"><?php echo $feedback ?></td>
-                </tr>
-            </table>
+            <?php echo $feedback ?>
 
 <?php if (isset($USER->modattempts[$lesson->id])) { // User is modifying attempts - save button and some instructions ?>
 
             </form>
         </td>
         <!-- End primary column -->
-        <td>
+        <?php if (lesson_blocks_have_content($lesson, $pageblocks, BLOCK_POS_RIGHT)) { ?>
+        <td id="right-column" style="width: <?php echo $rightcolumnwidth; ?>px;">
             <!-- Third column -->
-            <?php print_clock_block($cm->id, $lesson, $timer); ?>
-            <?php print_mediafile_block($cm->id, $lesson); // If there is one ?>
+            <?php
+                lesson_print_clock_block($cm->id, $lesson, $timer);
+                lesson_print_mediafile_block($cm->id, $lesson);
+
+                if (!empty($CFG->showblocksonmodpages)) {
+                    if ((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
+                        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
+                    }
+                }
+            ?>
         </td>
+        <?php } ?>
     </tr>
 </table>
 <!-- End primary layout table -->
\ No newline at end of file
index 6cd9e6b794f1cb3a09ff94cfacdb4d2994e106c6..97d60511174a1161e0d7f7a47dbac74755fd7fa2 100644 (file)
@@ -8,6 +8,9 @@
  **/
     confirm_sesskey();
 
+    require_once($CFG->dirroot.'/mod/lesson/pagelib.php');
+    require_once($CFG->libdir.'/blocklib.php');
+
     // left menu code
     // check to see if the user can see the left menu
     if (!has_capability('mod/lesson:manage', $context)) {
     if ($maxattemptsreached != 0) { 
         lesson_set_message('('.get_string("maximumnumberofattemptsreached", "lesson").')');
     }
-    
-    lesson_print_header($cm, $course, $lesson, 'view');
+
+    $PAGE = page_create_object('mod-lesson-view', $lesson->id);
+    $PAGE->set_lessonpageid($page->id);
+    $pageblocks = blocks_setup($PAGE);
+
+    $leftcolumnwidth  = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
+    $rightcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
+
+/// Print the header, heading and tabs
+    $PAGE->print_header();
 
     include(dirname(__FILE__).'/continue.html');
 ?>
index 3a3ea184745d3c0aa7effd777bdc08e1499d6636..9cd26f4d4185658e5ce7fb15a2f63b64a1569cff 100644 (file)
@@ -238,6 +238,12 @@ function lesson_delete_instance($id) {
             delete_event($event->id);
         }
     }
+    $pagetypes = page_import_types('mod/lesson/');
+    foreach ($pagetypes as $pagetype) {
+        if (!delete_records('block_instance', 'pageid', $lesson->id, 'pagetype', $pagetype)) {
+            $result = false;
+        }
+    }
 
     return $result;
 }
index 98a9390a2d6e96bdb1e417986d5cf58094ae84aa..8162eb0780e1377a5daffe9252f78540feb00bde 100644 (file)
@@ -225,55 +225,19 @@ if (!defined("LESSON_RESPONSE_EDITOR")) {
  **/
 function lesson_print_header($cm, $course, $lesson, $currenttab = '') {
     global $CFG, $USER;
-    
+
     $strlessons = get_string('modulenameplural', 'lesson');
     $strlesson  = get_string('modulename', 'lesson');
     $strname    = format_string($lesson->name, true);
-    
+
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
-    
-    // Changed the update_module_button and added another button when a teacher is checking the navigation of the lesson
+
     if (has_capability('mod/lesson:edit', $context)) {
-        
         $button = update_module_button($cm->id, $course->id, $strlesson);
-
-        if ($currenttab == 'view') {
-            if (!$pageid = optional_param('pageid', 0, PARAM_INT)) {
-                $pageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id, 'prevpageid', 0);
-            }
-            if (!empty($pageid) and $pageid != LESSON_EOL) {
-                $button =  '<table><tr><td>'.$button.
-                           '</td><td>'.
-                           '<form '.$CFG->frametarget.' method="get" action="'. $CFG->wwwroot .'/mod/lesson/lesson.php">'.
-                           '<div>'.
-                           '<input type="hidden" name="id" value="'. $cm->id .'" />'.
-                           '<input type="hidden" name="action" value="editpage" />'.
-                           '<input type="hidden" name="redirect" value="navigation" />'.
-                           '<input type="hidden" name="pageid" value="'. $pageid .'" />'.
-                           '<input type="submit" value="'. get_string('editpagecontent', 'lesson') .'" />'.
-                           '</div>'.
-                           '</form>'.
-                           '</td></tr></table>';
-            }
-        }
     } else {
         $button = '';
     }
-    
-    if (!optional_param('pageid', 0, PARAM_INT) and !empty($lesson->mediafile)) {
-        // open our pop-up
-        $url = '/mod/lesson/mediafile.php?id='.$cm->id;
-        $name = 'lessonmediafile';
-        $options = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. $lesson->mediawidth .',height='. $lesson->mediaheight;
-        $meta = "\n<script type=\"text/javascript\">";
-        $meta .= "\n<!--\n";
-        $meta .= "     openpopup('$url', '$name', '$options', 0);";
-        $meta .= "\n-->\n";
-        $meta .= '</script>';
-    } else {
-        $meta = '';
-    }
-    
+
 /// Header setup
     $navigation = array();
     if ($course->id != SITEID) {
@@ -294,20 +258,20 @@ function lesson_print_header($cm, $course, $lesson, $currenttab = '') {
 
 /// Print header, heading, tabs and messages
     print_header("$course->shortname: $strname", $course->fullname, $breadcrumb,
-                  '', $meta, true, $button, navmenu($course, $cm));
-                  
+                  '', '', true, $button, navmenu($course, $cm));
+
     if (has_capability('mod/lesson:manage', $context)) {
         print_heading_with_help(format_string($lesson->name, true), "overview", "lesson");
+
+        if (!empty($currenttab)) {
+            include($CFG->dirroot.'/mod/lesson/tabs.php');
+        }
     } else {
-        print_heading($lesson->name);
-    }
-    
-    if (!empty($currenttab) and has_capability('mod/lesson:manage', $context)) {
-        include($CFG->dirroot.'/mod/lesson/tabs.php');
+        print_heading(format_string($lesson->name, true));
     }
-    
+
     lesson_print_messages();
-    
+
     return true;
 }
 
@@ -1758,7 +1722,7 @@ function lesson_displayleftif($lesson) {
  * @param object $lesson Full lesson record object
  * @return void
  **/
-function print_mediafile_block($cmid, $lesson) {
+function lesson_print_mediafile_block($cmid, $lesson) {
     if (!empty($lesson->mediafile)) {
         $url      = '/mod/lesson/mediafile.php?id='.$cmid;
         $options  = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. $lesson->mediawidth .',height='. $lesson->mediaheight;
@@ -1780,7 +1744,7 @@ function print_mediafile_block($cmid, $lesson) {
  * @param object $timer Full timer record object
  * @return void
  **/
-function print_clock_block($cmid, $lesson, $timer) {
+function lesson_print_clock_block($cmid, $lesson, $timer) {
     global $CFG;
 
     $context = get_context_instance(CONTEXT_MODULE, $cmid);
@@ -1812,7 +1776,7 @@ function print_clock_block($cmid, $lesson, $timer) {
  * @param object $lesson Full lesson record object
  * @return void
  **/
-function print_menu_block($cmid, $lesson) {
+function lesson_print_menu_block($cmid, $lesson) {
     global $CFG;
 
     if ($lesson->displayleft) {
@@ -1843,4 +1807,45 @@ function print_menu_block($cmid, $lesson) {
     }
 }
 
+/**
+ * This is not ideal, but checks to see if a
+ * column has "block" content.
+ *
+ * In the future, it would be nice if the lesson
+ * media file, timer and navigation were blocks
+ * then this would be unnecessary.
+ *
+ * @uses $CFG
+ * @uses $PAGE
+ * @param object $lesson Full lesson record object
+ * @param array $pageblocks An array of block instances organized by left and right columns
+ * @param string $column Pass either BLOCK_POS_RIGHT or BLOCK_POS_LEFT constants
+ * @return boolean
+ **/
+function lesson_blocks_have_content($lesson, $pageblocks, $column) {
+    global $CFG, $PAGE;
+
+    // First check lesson conditions
+    if ($column == BLOCK_POS_RIGHT) {
+        $managecap = false;
+        if ($cm = get_coursemodule_from_instance('lesson', $lesson->id, $lesson->course)) {
+            $managecap = has_capability('mod/lesson:manage', get_context_instance(CONTEXT_MODULE, $cm->id));
+        }
+        if (($lesson->timed and !$managecap) or !empty($lesson->mediafile)) {
+            return true;
+        }
+    } else if ($column == BLOCK_POS_LEFT) {
+        if ($lesson->displayleft) {
+            return true;
+        }
+    }
+    if (!empty($CFG->showblocksonmodpages)) {
+        if ((blocks_have_content($pageblocks, $column) || $PAGE->user_is_editing())) {
+            return true;
+        }
+    }
+
+    return false;
+}
+
 ?>
index a3d74cf96deacdc77afdd70a8afa3b8112171c61..afa6e5c146b214707e9c8577dcd02f10d6cb1957 100644 (file)
@@ -245,7 +245,7 @@ class mod_lesson_mod_form extends moodleform_mod {
 
                 // get the module name and then store it in a new array
                 if ($module = get_coursemodule_from_instance($mod->modname, $mod->instance, $COURSE->id)) {
-                    if ($this->_cm->id != $mod->id){
+                    if (!empty($this->_cm->id) and $this->_cm->id != $mod->id){
                         $modinstances[$mod->id] = $mod->modname.' - '.$module->name;
                     }
                 }
diff --git a/mod/lesson/pagelib.php b/mod/lesson/pagelib.php
new file mode 100644 (file)
index 0000000..b8b2c5f
--- /dev/null
@@ -0,0 +1,206 @@
+<?php // $Id$
+/**
+ * Page class for lesson
+ *
+ * @author Mark Nielsen
+ * @version $Id$
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @package lesson
+ **/
+
+require_once($CFG->libdir.'/pagelib.php');
+require_once($CFG->dirroot.'/course/lib.php'); // needed for some blocks
+
+/**
+ * Define the page types
+ *
+ **/
+define('PAGE_LESSON_VIEW', 'mod-lesson-view');
+
+/**
+ * Map the classes to the page types
+ *
+ **/
+page_map_class(PAGE_LESSON_VIEW, 'page_lesson');
+
+/**
+ * Add the page types defined in this file
+ *
+ **/
+$DEFINEDPAGES = array(PAGE_LESSON_VIEW);
+
+/**
+ * Class that models the behavior of a lesson
+ *
+ * @author Mark Nielsen (lesson extention only)
+ * @package lesson
+ **/
+class page_lesson extends page_generic_activity {
+
+    /**
+     * Module name
+     *
+     * @var string
+     **/
+    var $activityname = 'lesson';
+    /**
+     * Current lesson page ID
+     *
+     * @var string
+     **/
+    var $lessonpageid = NULL;
+
+    /**
+     * Print a standard lesson heading.
+     *
+     * This will also print up to three
+     * buttons in the breadcrumb, lesson heading
+     * lesson tabs, lesson notifications and perhaps
+     * a popup with a media file.
+     *
+     * @return void
+     **/
+    function print_header($title = '', $morebreadcrumbs = array()) {
+        global $CFG;
+
+        $this->init_full();
+
+    /// Variable setup/check
+        $context      = get_context_instance(CONTEXT_MODULE, $this->modulerecord->id);
+        $activityname = format_string($this->activityrecord->name);
+
+        if ($this->lessonpageid === NULL) {
+            error('Programmer error: must set the lesson page ID');
+        }
+        if (empty($title)) {
+            $title = "{$this->courserecord->shortname}: $activityname";
+        }
+
+    /// Build the breadcrumb
+        $breadcrumbs = array();
+        if ($this->courserecord->id != SITEID) {
+           $breadcrumbs[$this->courserecord->shortname] = "$CFG->wwwroot/course/view.php?id={$this->courserecord->id}";
+        }
+        $breadcrumbs[get_string('modulenameplural', 'lesson')] = "$CFG->wwwroot/mod/lesson/index.php?id={$this->courserecord->id}";
+
+        if (empty($morebreadcrumbs)) {
+            $breadcrumbs[$activityname] = '';
+        } else {
+            $breadcrumbs[$activityname] = "$CFG->wwwroot/mod/lesson/view.php?id={$this->modulerecord->id}&amp;pageid=$this->lessonpageid";
+            $breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs);
+        }
+        // Convert to breadcrumb string
+        $urls = array();
+        foreach($breadcrumbs as $text => $href) {
+            if (empty($href)) {
+                $urls[] = $text;
+            } else {
+                $urls[] = '<a href="'.$href.'">'.$text.'</a>';
+            }
+        }
+        $breadcrumb = implode(' -> ', $urls);
+
+    /// Build the buttons
+        if (has_capability('mod/lesson:edit', $context)) {
+            $buttons = '<span class="edit_buttons">'.update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'lesson'));
+
+            if (!empty($this->lessonpageid) and $this->lessonpageid != LESSON_EOL) {
+                $buttons .= '<form '.$CFG->frametarget.' method="get" action="'.$CFG->wwwroot.'/mod/lesson/lesson.php">'.
+                            '<input type="hidden" name="id" value="'.$this->modulerecord->id.'" />'.
+                            '<input type="hidden" name="action" value="editpage" />'.
+                            '<input type="hidden" name="redirect" value="navigation" />'.
+                            '<input type="hidden" name="pageid" value="'.$this->lessonpageid.'" />'.
+                            '<input type="submit" value="'.get_string('editpagecontent', 'lesson').'" />'.
+                            '</form>';
+
+                if (!empty($CFG->showblocksonmodpages) and $this->user_allowed_editing()) {
+                    if ($this->user_is_editing()) {
+                        $onoff = 'off';
+                    } else {
+                        $onoff = 'on';
+                    }
+                    $buttons .= '<form '.$CFG->frametarget.' method="get" action="'.$CFG->wwwroot.'/mod/lesson/view.php">'.
+                                '<input type="hidden" name="id" value="'.$this->modulerecord->id.'" />'.
+                                '<input type="hidden" name="pageid" value="'.$this->lessonpageid.'" />'.
+                                '<input type="hidden" name="edit" value="'.$onoff.'" />'.
+                                '<input type="submit" value="'.get_string("blocksedit$onoff").'" />
+                                </form>';
+                }
+            }
+            $buttons .= '</span>';
+        } else {
+            $buttons = '&nbsp;';
+        }
+
+    /// Build the meta
+    /// Currently broken because the $meta is printed before the JavaScript is printed
+        // if (!optional_param('pageid', 0, PARAM_INT) and !empty($this->activityrecord->mediafile)) {
+        //     // open our pop-up
+        //     $url = '/mod/lesson/mediafile.php?id='.$this->modulerecord->id;
+        //     $name = 'lessonmediafile';
+        //     $options = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. $this->activityrecord->mediawidth .',height='. $this->activityrecord->mediaheight;
+        //     $meta = "\n<script type=\"text/javascript\">";
+        //     $meta .= "\n<!--\n";
+        //     $meta .= "     openpopup('$url', '$name', '$options', 0);";
+        //     $meta .= "\n// -->\n";
+        //     $meta .= '</script>';
+        // } else {
+            $meta = '';
+        // }
+
+        print_header($title, $this->courserecord->fullname, $breadcrumb, '', $meta, true, $buttons, navmenu($this->courserecord, $this->modulerecord));
+
+        if (has_capability('mod/lesson:manage', $context)) {
+            print_heading_with_help($activityname, 'overview', 'lesson');
+
+            // Rename our objects for the sake of the tab code
+            list($cm, $course, $lesson, $currenttab) = array(&$this->modulerecord, &$this->courserecord, &$this->activityrecord, 'view');
+            include($CFG->dirroot.'/mod/lesson/tabs.php');
+        } else {
+            print_heading($activityname);
+        }
+
+        lesson_print_messages();
+    }
+
+    function get_type() {
+        return PAGE_LESSON_VIEW;
+    }
+
+    function blocks_get_positions() {
+        return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT);
+    }
+
+    function blocks_default_position() {
+        return BLOCK_POS_RIGHT;
+    }
+
+    function blocks_move_position(&$instance, $move) {
+        if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) {
+            return BLOCK_POS_RIGHT;
+        } else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) {
+            return BLOCK_POS_LEFT;
+        }
+        return $instance->position;
+    }
+
+    /**
+     * Needed to add the ID of the current lesson page
+     *
+     * @return array
+     **/
+    function url_get_parameters() {
+        $this->init_full();
+        return array('id' => $this->modulerecord->id, 'pageid' => $this->lessonpageid);;
+    }
+
+    /**
+     * Set the current lesson page ID
+     *
+     * @return void
+     **/
+    function set_lessonpageid($pageid) {
+        $this->lessonpageid = $pageid;
+    }
+}
+?>
\ No newline at end of file
index 95bd04c440caf0cc3bef851a6d4851183889faaf..9d19bb3cb78d2896af645f3a9d71c22d753a4523 100644 (file)
@@ -6,8 +6,13 @@
     text-align: left;
 }
 
-.mod-lesson .sideblock {
-    width: 170px;
+.mod-lesson #layout-table {
+    width: 100%;
+}
+
+.mod-lesson .edit_buttons form,
+.mod-lesson .edit_buttons input {
+    display: inline;
 }
 
 .mod-lesson .clock .content {
index be8a0588c4634c36737766dd32764288dc6b5146..51cdcd1f23a42bfe8425019176badfdfc1818cb7 100644 (file)
@@ -8,11 +8,14 @@
  **/
 
     require_once('../../config.php');
-    require_once('locallib.php');
-    require_once('lib.php');
+    require_once($CFG->dirroot.'/mod/lesson/locallib.php');
+    require_once($CFG->dirroot.'/mod/lesson/lib.php');
+    require_once($CFG->dirroot.'/mod/lesson/pagelib.php');
+    require_once($CFG->libdir.'/blocklib.php');
 
     $id      = required_param('id', PARAM_INT);             // Course Module ID
     $pageid  = optional_param('pageid', NULL, PARAM_INT);   // Lesson Page ID
+    $edit    = optional_param('edit', -1, PARAM_BOOL);
     
     list($cm, $course, $lesson) = lesson_get_basics($id);
 
                 }
             }
         }
-         
-        lesson_print_header($cm, $course, $lesson, 'view');
+
+        $PAGE = page_create_instance($lesson->id);
+        $PAGE->set_lessonpageid($page->id);
+        $pageblocks = blocks_setup($PAGE);
+
+        $leftcolumnwidth  = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
+        $rightcolumnwidth = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), 210);
+
+        if (($edit != -1) and $PAGE->user_allowed_editing()) {
+            $USER->editing = $edit;
+        }
+
+    /// Print the page header, heading and tabs
+        $PAGE->print_header();
         require($CFG->dirroot.'/mod/lesson/viewstart.html');
 
         // now starting to print the page's contents   
index f0b95e93c36cad43d1a61ff6296e29404c6925a9..f2760960a289d9d1dccbecfc7d1432be555a1776 100644 (file)
@@ -9,10 +9,20 @@
 ?>
 <!-- Start view end -->
         </td>
-        <td>
-            <?php print_clock_block($cm->id, $lesson, $timer); ?>
-            <?php print_mediafile_block($cm->id, $lesson); // If there is one ?>
+        <?php if (lesson_blocks_have_content($lesson, $pageblocks, BLOCK_POS_RIGHT)) { ?>
+        <td id="right-column" style="width: <?php echo $rightcolumnwidth; ?>px;">
+            <?php
+                lesson_print_clock_block($cm->id, $lesson, $timer);
+                lesson_print_mediafile_block($cm->id, $lesson);
+
+                if (!empty($CFG->showblocksonmodpages)) {
+                    if ((blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $PAGE->user_is_editing())) {
+                        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
+                    }
+                }
+            ?>
         </td>
+        <?php } ?>
     </tr>
 </table>
 <!-- End view end -->
\ No newline at end of file
index ab2bdfd613b80a00cf14928dd499d7658aa38ca1..15f17dbe944509e6389f61be5f9626c6a9382a70 100644 (file)
@@ -8,14 +8,24 @@
  **/
 ?>
 <!-- Start view start -->
-<table width="100%" border="0" cellpadding="0" cellspacing="0">
-    <tr valign="top">
+<table id="layout-table" cellpadding="0" cellspacing="0">
+    <tr>
         <!-- First Column -->
-        <td valign="top">
-            <?php print_menu_block($cm->id, $lesson); ?>
+        <?php if (lesson_blocks_have_content($lesson, $pageblocks, BLOCK_POS_LEFT)) { ?>
+        <td id="left-column" style="width: <?php echo $leftcolumnwidth; ?>px;">
+            <?php
+                lesson_print_menu_block($cm->id, $lesson);
+
+                if (!empty($CFG->showblocksonmodpages)) {
+                    if ((blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing())) {
+                        blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
+                    }
+                }
+            ?>
         </td>
+        <?php } ?>
         <!-- Start main column -->
-        <td style="width:100%;" align="center">
+        <td id="middle-column" align="center">
             
             <?php if ($lesson->displayleft) { ?>