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:
stronk7
2004-12-13 01:23:22 +00:00
parent 7e334604be
commit d1f9ad57d5
+11
View File
@@ -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;
}
?>