Skip to content

Commit

Permalink
MDL-26754 Display blocks in 'manage blocks' alphabetically sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Aug 4, 2011
1 parent 3fdc622 commit 50c71e0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions admin/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir.'/textlib.class.php');

admin_externalpage_setup('manageblocks');

Expand Down Expand Up @@ -154,6 +155,7 @@
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'compatibleblockstable blockstable generaltable');
$table->setup();
$tablerows = array();

foreach ($blocks as $blockid=>$block) {
$blockname = $block->name;
Expand Down Expand Up @@ -237,15 +239,21 @@
'<img src="'.$OUTPUT->pix_url('t/unlock_gray') . '" class="icon" alt="'.$strprotect.'" /></a>';
}

$table->add_data(array(
$row = array(
'<span'.$class.'>'.$strblockname.'</span>',
$blocklist,
'<span'.$class.'>'.$version.'</span>',
$visible,
$undeletable,
$delete,
$settings
));
);
$tablerows[] = array(strip_tags($strblockname), $row); // first element will be used for sorting
}

textlib_get_instance()->asort($tablerows);
foreach ($tablerows as $row) {
$table->add_data($row[1]);
}

$table->print_html();
Expand Down

0 comments on commit 50c71e0

Please sign in to comment.