]> git.mjollnir.org Git - moodle.git/commitdiff
Removed the "hardcoded" method to find the block name, the correct is to ask
authordefacer <defacer>
Thu, 13 May 2004 12:24:11 +0000 (12:24 +0000)
committerdefacer <defacer>
Thu, 13 May 2004 12:24:11 +0000 (12:24 +0000)
the block itself. It was causing errors for blocks with no lang file. Also,
removed some useless commented code.

admin/blocks.php

index 9ac17b8cd5772eac1d6bb4ccd2b50c92cc2f83cd..916ccafe2666f3419ec93614c13471b629655899 100644 (file)
             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'])) {
@@ -63,9 +56,6 @@
             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)) {
@@ -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),