Skip to content

Commit

Permalink
themes & blocks - MDL-19077 & MDL-19010 blocks are now printed by the…
Browse files Browse the repository at this point in the history
… theme

The code to print blocks in now in theme layout.php files. (Or in
moodle_core_renderer::handle_legacy_theme)

Code for printing blocks everywhere else has been stripped out.
(Total diffstat 1225 insertions, 2019 deletions)

The way the HTML for a block instance is generated has been cleaned
up a lot. Now, the block_instance generates a block_contents
object which gives a structured representation of the block,
and then $OUTPUT->block builds all the HTML from that.

How theme config.php files specify the layout template and block
regions by page general type has been changed to be even more flexible.

Further refinement for how the theme and block code gets initialised.

Ability for scrits to add 'pretend blocks' to the page. That is,
things that look like blocks, but are not normal block_instances.
(Like the add a new block UI.)

Things that are still broken:
 * some pages in lesson, quiz and resource. I'm working on it.
 * lots of developer debug notices pointing out things that
   need to be updated.
  • Loading branch information
tjhunt committed Jul 9, 2009
1 parent abdcded commit d4a03c0
Show file tree
Hide file tree
Showing 58 changed files with 1,188 additions and 1,982 deletions.
12 changes: 7 additions & 5 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
$CFG->xmlstrictheaders = false;

if (!core_tables_exist()) {
// hide errors from headers in case debug enabled in config.php
$PAGE->set_generaltype('maintenance');

// fake some settings
$CFG->docroot = 'http://docs.moodle.org';
Expand All @@ -127,7 +127,7 @@
echo '<br />';
notice_yesno(get_string('doyouagree'), "index.php?agreelicense=1&lang=$CFG->lang",
"http://docs.moodle.org/en/License");
print_footer('upgrade');
print_footer();
die;
}
if (empty($confirmrelease)) {
Expand All @@ -147,7 +147,7 @@
print_continue("index.php?agreelicense=1&amp;confirmrelease=1&amp;lang=$CFG->lang");
}

print_footer('upgrade');
print_footer();
die;
}

Expand Down Expand Up @@ -178,6 +178,8 @@
}

if ($version > $CFG->version) { // upgrade
$PAGE->set_generaltype('maintenance');

$a->oldversion = "$CFG->release ($CFG->version)";
$a->newversion = "$release ($version)";
$strdatabasechecking = get_string('databasechecking', '', $a);
Expand All @@ -187,7 +189,7 @@
print_header($strdatabasechecking, $stradministration, $navigation, '', '', false, '&nbsp;', '&nbsp;');

notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
print_footer('upgrade');
print_footer();
exit;

} else if (empty($confirmrelease)){
Expand All @@ -212,7 +214,7 @@
print_continue('index.php?confirmupgrade=1&amp;confirmrelease=1');
}

print_footer('upgrade');
print_footer();
die;

} elseif (empty($confirmplugins)) {
Expand Down
39 changes: 0 additions & 39 deletions admin/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@
echo '</form>';

} else {
// Note: MDL-19010 there will be further changes to printing header and blocks.
// The code will be much nicer than this eventually.
$pageblocks = blocks_setup($PAGE);

$preferred_width_left = blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]);
$preferred_width_right = blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]);

if ($PAGE->user_allowed_editing()) {
$options = $PAGE->url->params();
if ($PAGE->user_is_editing()) {
Expand All @@ -111,22 +104,6 @@

print_header("$SITE->shortname: " . implode(": ",$visiblepathtosection), $SITE->fullname, $navigation, $focus, '', true, $buttons, '');

echo '<table id="layout-table"><tr>';
$lt = (empty($THEME->layouttable)) ? array('left', 'middle', 'right') : $THEME->layouttable;
foreach ($lt as $column) {
switch ($column) {
case 'left':
echo '<td style="width: '.$preferred_width_left.'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();
echo '<a name="startofcontent"></a>';

if ($errormsg !== '') {
notify ($errormsg);

Expand All @@ -149,22 +126,6 @@

echo '</div>';
echo '</form>';

print_container_end();
echo '</td>';
break;
case 'right':
if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT)) {
echo '<td style="width: '.$preferred_width_right.'px;" id="right-column">';
print_container_start();
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print_container_end();
echo '</td>';
}
break;
}
}
echo '</tr></table>';
}

print_footer();
Expand Down
1 change: 0 additions & 1 deletion admin/settings/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

$ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks')));
$ADMIN->add('blocksettings', new admin_page_manageblocks());
$ADMIN->add('blocksettings', new admin_externalpage('stickyblocks', get_string('stickyblocks', 'admin'), "$CFG->wwwroot/$CFG->admin/stickyblocks.php"));
if ($blocks = $DB->get_records('block')) {
$blockbyname = array();

Expand Down
90 changes: 0 additions & 90 deletions admin/stickyblocks.php

This file was deleted.

Loading

0 comments on commit d4a03c0

Please sign in to comment.