Now activity names are sorted by name length to avoid Bug 2282
(http://moodle.org/bugs/bug.php?op=show&bugid=2282)
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
$course = get_record("course","id",$courseid);
|
||||
$modinfo = unserialize($course->modinfo);
|
||||
|
||||
//Sort modinfo by name lenght
|
||||
usort($modinfo,'comparemodulenamesbylenght');
|
||||
|
||||
if (!empty($modinfo)) {
|
||||
$cm = '';
|
||||
foreach ($modinfo as $activity) {
|
||||
@@ -113,4 +116,12 @@
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
//This function is used to order module names from longer to shorter
|
||||
function comparemodulenamesbylenght($a, $b) {
|
||||
if (strlen($a->name) == strlen($b->name)) {
|
||||
return 0;
|
||||
}
|
||||
return (strlen($a->name) < strlen($b->name)) ? 1 : -1;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user