mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-34765 Course: Re-sorting courses uses natural order
This commit is contained in:
parent
569f1ad63b
commit
4b30377dd1
@ -27,6 +27,7 @@
|
||||
|
||||
require_once("../config.php");
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->libdir.'/textlib.class.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Category id
|
||||
$page = optional_param('page', 0, PARAM_INT); // which page to show
|
||||
@ -75,7 +76,8 @@ $sesskeyprovided = !empty($sesskey) && confirm_sesskey($sesskey);
|
||||
// Process any category actions.
|
||||
if ($canmanage && $resort && $sesskeyprovided) {
|
||||
// Resort the category if requested
|
||||
if ($courses = get_courses($category->id, "fullname ASC", 'c.id,c.fullname,c.sortorder')) {
|
||||
if ($courses = get_courses($category->id, 'c.id,c.fullname,c.sortorder')) {
|
||||
collatorlib::asort_objects_by_property($courses, 'fullname', collatorlib::SORT_NATURAL);
|
||||
$i = 1;
|
||||
foreach ($courses as $course) {
|
||||
$DB->set_field('course', 'sortorder', $category->sortorder+$i, array('id'=>$course->id));
|
||||
|
Loading…
x
Reference in New Issue
Block a user