Moodle

As an Admin, resetting all or some subset of courses at site level

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.8.2
  • Fix Version/s: 2.0.8
  • Component/s: Administration
  • Labels:
    None

Description

I'd like to be able to reset courses in bulk (in particular deleting the students), for some course categories, at the end of the academic year, rather than delegate this responsibility to each member of the register staff who has a lot of courses to manage.
This global feature could be added to the Site Administration / Courses menu, just after "Backups".

Issue Links

Activity

Hide
Arnaud saint-Georges added a comment -

This new issue is more precise than bug MDL-4731.

Show
Arnaud saint-Georges added a comment - This new issue is more precise than bug MDL-4731.
Hide
Chris Fryer added a comment -

This is similar to Shamim's code, except that you are given the opportunity to choose which courses to reset.

I've used it successfully here, resetting on the order of 700 courses. However, I didn't select them all at the same time. It worked OK when I selected batches of 15 courses. I'm afraid the browser might time out if you select a lot of courses.

Elsewhere in Moodle, the backup routines use backup_flush() to send whitespace to the browser to keep it interested. That might be useful here, but I'm not sure where I could put it in reset_courses.php. If anyone has any suggestions I'd be grateful.

For permissions, I used a single check for moodle/site:doanything, rather than multiple checks for moodle/course:reset, which would be comparatively expensive.

I've also obtained "assignable roles" from the first non-site course (id = 2), because I believe roles can only be defined at site level. Feel free to disabuse me of this notion, though.

Show
Chris Fryer added a comment - This is similar to Shamim's code, except that you are given the opportunity to choose which courses to reset. I've used it successfully here, resetting on the order of 700 courses. However, I didn't select them all at the same time. It worked OK when I selected batches of 15 courses. I'm afraid the browser might time out if you select a lot of courses. Elsewhere in Moodle, the backup routines use backup_flush() to send whitespace to the browser to keep it interested. That might be useful here, but I'm not sure where I could put it in reset_courses.php. If anyone has any suggestions I'd be grateful. For permissions, I used a single check for moodle/site:doanything, rather than multiple checks for moodle/course:reset, which would be comparatively expensive. I've also obtained "assignable roles" from the first non-site course (id = 2), because I believe roles can only be defined at site level. Feel free to disabuse me of this notion, though.
Hide
Lei Zhang added a comment -

On top of Chris's code, I've added an ajax function using YUI to select courses instead of multiple select box, it will autocomplete the course name for you if it exists; it also output the course reset information while it's doing the work.

You need change the stylesheet name to your own in the diff file to actually use it.

Show
Lei Zhang added a comment - On top of Chris's code, I've added an ajax function using YUI to select courses instead of multiple select box, it will autocomplete the course name for you if it exists; it also output the course reset information while it's doing the work. You need change the stylesheet name to your own in the diff file to actually use it.

People

Vote (16)
Watch (8)

Dates

  • Created:
    Updated: