Moodle
  1. Moodle
  2. MDL-11349

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

    Details

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

      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 .
          Show
          Shamim Rezaie added a comment - http://moodle.org/mod/forum/discuss.php?d=53142#p356707
          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.
          Hide
          Domingo added a comment -

          I have made this php script to be able to clean a bunch possibly all courses in one go. So far I have only use it in a development server. I've like more people taken a look at it, and sending me feedback.

          I hope it can become useful for everybody who need it.

          dfernandezgo@upsa.es

          Show
          Domingo added a comment - I have made this php script to be able to clean a bunch possibly all courses in one go. So far I have only use it in a development server. I've like more people taken a look at it, and sending me feedback. I hope it can become useful for everybody who need it. dfernandezgo@upsa.es
          Hide
          Domingo added a comment -

          Delete_User_Contents.php. This script tries to reproduce the Reset function of moodle, but allowing the user to select a bunch of courses establishing a condition. I've be glad if another developers take a look at it and give me their opinions.

          dfernandezgo@upsa.es

          Show
          Domingo added a comment - Delete_User_Contents.php. This script tries to reproduce the Reset function of moodle, but allowing the user to select a bunch of courses establishing a condition. I've be glad if another developers take a look at it and give me their opinions. dfernandezgo@upsa.es

            People

            • Votes:
              23 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated: