Skip to content

Commit

Permalink
Removed the "hardcoded" method to find the block name, the correct is…
Browse files Browse the repository at this point in the history
… to ask

the block itself. It was causing errors for blocks with no lang file. Also,
removed some useless commented code.
  • Loading branch information
defacer committed May 13, 2004
1 parent 6c9584d commit a8ae6b3
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions admin/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,13 @@
error("Block doesn't exist!");
}
set_field('blocks', 'visible', '0', 'id', $block->id); // Hide block

// [pj] There is no need to do this, since print_course_blocks()
// will not display blocks which are disabled. In fact, the
// comment "This block is hidden. Don't show it." there
// suggests that this db update SHOULDN'T be needed.
///I'M NOT SURE IF THIS IS THE CORRECT APPROACH
//blocks_update_every_block_by_id($block->id, "hide"); // Hide blocks in all courses by id
}

if (!empty($_GET['show'])) {
if (!$block = get_record('blocks', 'id', $_GET['show'])) {
error("Block doesn't exist!");
}
set_field('blocks', 'visible', '1', 'id', $block->id); // Show block
// [pj] See note above
///I'M NOT SURE IF THIS IS THE CORRECT APPROACH
//blocks_update_every_block_by_id($block->id,"show"); // Show blocks in all courses by id
}

if (!empty($delete)) {
Expand All @@ -74,7 +64,8 @@
error("Block doesn't exist!");
}

$strblockname = get_string('blockname', 'block_'.$block->name);
$blockobject = block_instance($block->name, $site);
$strblockname = $blockobject->get_title();

if (!$_GET['confirm']) {
notice_yesno(get_string('blockdeleteconfirm', '', $strblockname),
Expand Down

0 comments on commit a8ae6b3

Please sign in to comment.