/** * Display the resource with the course blocks. */ function display_course_blocks_start() { global $CFG; global $USER; global $THEME; require_once($CFG->libdir.'/blocklib.php'); require_once('pagelib.php'); require_once($CFG->dirroot.'/course/lib.php'); //required by some blocks $PAGE = page_create_object(PAGE_ASSIGNMENT_VIEW, $this->assignment->id); $this->PAGE = $PAGE; $pageblocks = blocks_setup($PAGE); $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210); /// Print the page header $edit = optional_param('edit', -1, PARAM_BOOL); if (($edit != -1) and $PAGE->user_allowed_editing()) { $USER->editing = $edit; } //if (empty($this->strresources)) {$this->strresources = get_string('resources');} // $morenavlinks = array($this->strresources => 'index.php?id='.$this->course->id, // $this->resource->name => ''); //if (empty($this->strresource)) {$this->strresource = get_string('resource');} // $PAGE->print_header($this->course->shortname.': %fullname%', $morenavlinks, "", "", // update_module_button($this->cm->id, $this->course->id, $this->strresource)); echo '
| '; print_container_start(); blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); print_container_end(); echo ' | '; } break; case 'middle': 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_end();
echo '';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print_container_end();
echo ' | ';
}
break;
}
}
}
/**
* Finish displaying the resource with the course blocks
*/
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);
$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 '';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print_container_end();
echo ' | ';
}
break;
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 '