Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-26754 Display blocks in 'manage blocks' alphabetically sorted

  • Loading branch information...
commit ad66263bc1c3dddd255ca722320aafe5050eeaaf 1 parent 80eb52c
@marinaglancy marinaglancy authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 admin/blocks.php
View
12 admin/blocks.php
@@ -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');
@@ -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;
@@ -237,7 +239,7 @@
'<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>',
@@ -245,7 +247,13 @@
$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();
Please sign in to comment.
Something went wrong with that request. Please try again.