Change the semantics of blocks_print_adminblock() to make life easier to
developers who use pages. Conversely simplified the code a bit in courses.
This commit is contained in:
@@ -57,8 +57,8 @@
|
||||
if(blocks_have_content($pageblocks[BLOCK_POS_RIGHT]) || $editing) {
|
||||
echo '<td style="vertical-align: top; width: '.$preferred_width_right.'px;" id="right-column">';
|
||||
blocks_print_group($PAGE, $pageblocks[BLOCK_POS_RIGHT]);
|
||||
if ($editing && !empty($missingblocks)) {
|
||||
blocks_print_adminblock($PAGE, $missingblocks);
|
||||
if ($editing) {
|
||||
blocks_print_adminblock($PAGE, $pageblocks);
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
@@ -273,8 +273,8 @@
|
||||
if(blocks_have_content($pageblocks[BLOCK_POS_RIGHT]) || $editing) {
|
||||
echo '<td style="vertical-align: top; width: '.$preferred_width_right.'px;" id="right-column">';
|
||||
blocks_print_group($PAGE, $pageblocks[BLOCK_POS_RIGHT]);
|
||||
if ($editing && !empty($missingblocks)) {
|
||||
blocks_print_adminblock($PAGE, $missingblocks);
|
||||
if ($editing) {
|
||||
blocks_print_adminblock($PAGE, $pageblocks);
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
@@ -259,8 +259,8 @@
|
||||
if(blocks_have_content($pageblocks[BLOCK_POS_RIGHT]) || $editing) {
|
||||
echo '<td style="vertical-align: top; width: '.$preferred_width_right.'px;" id="right-column">';
|
||||
blocks_print_group($PAGE, $pageblocks[BLOCK_POS_RIGHT]);
|
||||
if ($editing && !empty($missingblocks)) {
|
||||
blocks_print_adminblock($PAGE, $missingblocks);
|
||||
if ($editing) {
|
||||
blocks_print_adminblock($PAGE, $pageblocks);
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
@@ -76,8 +76,6 @@
|
||||
// but I'm not sure if it's worth the complexity increase...
|
||||
$pageblocks = blocks_get_by_page($PAGE);
|
||||
}
|
||||
|
||||
$missingblocks = blocks_get_missing($PAGE, $pageblocks);
|
||||
}
|
||||
|
||||
optional_variable($preferred_width_left, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]));
|
||||
@@ -216,8 +214,8 @@
|
||||
echo '<br />';
|
||||
}
|
||||
blocks_print_group($PAGE, $pageblocks[BLOCK_POS_RIGHT]);
|
||||
if ($editing && !empty($missingblocks)) {
|
||||
blocks_print_adminblock($PAGE, $missingblocks);
|
||||
if ($editing) {
|
||||
blocks_print_adminblock($PAGE, $pageblocks);
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
+5
-3
@@ -542,12 +542,14 @@ function blocks_get_by_page($page) {
|
||||
}
|
||||
|
||||
//This function prints the block to admin blocks as necessary
|
||||
function blocks_print_adminblock($page, $missingblocks) {
|
||||
function blocks_print_adminblock(&$page, &$pageblocks) {
|
||||
global $USER;
|
||||
|
||||
$strblocks = get_string('blocks');
|
||||
$stradd = get_string('add');
|
||||
$missingblocks = blocks_get_missing($page, $pageblocks);
|
||||
|
||||
if (!empty($missingblocks)) {
|
||||
$strblocks = get_string('blocks');
|
||||
$stradd = get_string('add');
|
||||
foreach ($missingblocks as $blockid) {
|
||||
$block = blocks_get_record($blockid);
|
||||
$blockobject = block_instance($block->name);
|
||||
|
||||
Reference in New Issue
Block a user