index 6133434..b7f8d1d 100644 --- a/repository/filesystem/lib.php +++ b/repository/filesystem/lib.php @@ -28,6 +28,17 @@ * @author Dongsheng Cai * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + + function sort_by_title($a,$b) { + $at = strtolower($a["title"]); + $bt = strtolower($b["title"]); + + if ($at == $bt) { + return 0; + } + return ($at < $bt) ? -1 : 1; + } + class repository_filesystem extends repository { public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) { global $CFG; @@ -103,6 +114,7 @@ class repository_filesystem extends repository { } } $list['list'] = array_filter($list['list'], array($this, 'filter')); + usort($list['list'],"sort_by_title"); return $list; } public function check_login() {