Merge branch 'wip-MDL-26754-master' of github.com:marinaglancy/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 16 Aug 2011 11:07:54 +0000 (13:07 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 16 Aug 2011 11:07:54 +0000 (13:07 +0200)
admin/blocks.php

index b4fa841..55170d2 100644 (file)
     $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;
                        '<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>',
             $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();