Currently the procedure for recycling a course, i.e., making it available for a new batch of students, is the following:
- Backup the existing course with all data in it. (Requires 4 clicks)
- Rename the existing course (for example by adding a date) (Requires 3 clicks)
- Restore the existing course without user data (Requires 25 clicks because the user data has to be deselected individually for all modules)
Now this does not sound so bad until you come to the end of term and have to go through this procedure 30 times. It is quite time-consuming. So I was wondering whether this could not be made more comfortable:
- Select all courses that are to be recycled,
- Specify the suffix that should be added to the names of the old courses,
- Watch the script run while you have a cup of tea.
Now you will probably say that if I want to have the cup of tea then I should simply code the above. Unfortunately the backup and restore scripts are rather complicated. Perhaps Eloy could provide us with a simple function backup_and_restore($courseid) which does what the name suggests. Then all the rest will be simple (calling this function once for every course desired and then doing the renaming of the courses).