Moodle

Delete sections

Details

  • Type: New Feature New Feature
  • Status: Peer review in progress Peer review in progress
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.8, 1.8.1, 1.8.2, 1.9, 2.0.2
  • Fix Version/s: DEV backlog
  • Component/s: Course
  • Labels:
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

This has been discussed before, notably in bug 2245. There is no way to delete a section (e.g. week or topic) from a Moodle course. There seems to be general agreement that this is A Good Thing, but I can't really see why. I understand the argument that you don't want the teacher deleting a populated section by accident, but you can't even delete an empty section.

The usual workaround is to move the offending section to the bottom of the course page, and reduce the number of sections the course displays. However, bug 4719 indicates the drawbacks in this approach. If a teacher wants to add a new section by increasing this number, the "deleted" block reappears. This is irksome.

If a teacher/editor has powers to delete a resource or activity, shouldn't they have the power to delete an entire section? You are asked for confirmation in cautionary terms every time you attempt to delete a resource, so why not have the same for a section, e.g. "Are you absolutely sure you want to completely delete the section 'foo'?"

  1. delete.section.part1.diff
    06/Oct/09 1:29 AM
    9 kB
    Daniel Neis
  2. delete.section.part2.diff
    06/Oct/09 1:29 AM
    3 kB
    Daniel Neis
  3. MDL-10405.diff
    22/Feb/10 8:50 PM
    4 kB
    Daniel Neis
  4. MDL-10405.full.diff
    19/Mar/10 1:13 AM
    9 kB
    Daniel Neis

Issue Links

Activity

Hide
eric stephan added a comment -

OOooof, if there ever was a time that I wanted to stuff a ballot box, this is it.

This has just generated a real, and ridiculous, problem for me.

In a course, a fellow administrator wrongheadedly added a bunch of new topics to the course, like 10 of them, thinking that new material would be added.

He was wrong. But these topics are interspersed throughout the course. To delete these 10 topics, I am going to (1) move each of them to the bottom one topic at a time, one step at a time – because there is no "move to this location box" feature for moving topics? ... and then do the silly limit-the-number-of-topics feature?

I'm hoping there is some other way – but this could be hours of ridiculous clicking, to delete 10 topics?

thx
eric

Show
eric stephan added a comment - OOooof, if there ever was a time that I wanted to stuff a ballot box, this is it. This has just generated a real, and ridiculous, problem for me. In a course, a fellow administrator wrongheadedly added a bunch of new topics to the course, like 10 of them, thinking that new material would be added. He was wrong. But these topics are interspersed throughout the course. To delete these 10 topics, I am going to (1) move each of them to the bottom one topic at a time, one step at a time – because there is no "move to this location box" feature for moving topics? ... and then do the silly limit-the-number-of-topics feature? I'm hoping there is some other way – but this could be hours of ridiculous clicking, to delete 10 topics? thx eric
Hide
Steve Bond added a comment -

The way it works at present is effectively duplicating functionality. There is already a way to hide sections. Reducing the number of sections is like a stronger version of the same thing (i.e. you're hiding them from all users, not just students), but it adds nothing in terms of usefulness.

Another reason why it is annoying is that because (rightly) you cannot delete a file from the file store when it is being referenced by a resource. But that goes for the resources in non-visible (as opposed to hidden - you see how crazy this is!) sections as well. So if, for example, an editor inherits a course from a predecessor and tries to revamp it, they are find that they are unable to delete files that do not appear to be in use. Then they extend the number of topics to 25 and realise that they are going to spend the rest of the day clicking red crosses...

Show
Steve Bond added a comment - The way it works at present is effectively duplicating functionality. There is already a way to hide sections. Reducing the number of sections is like a stronger version of the same thing (i.e. you're hiding them from all users, not just students), but it adds nothing in terms of usefulness. Another reason why it is annoying is that because (rightly) you cannot delete a file from the file store when it is being referenced by a resource. But that goes for the resources in non-visible (as opposed to hidden - you see how crazy this is!) sections as well. So if, for example, an editor inherits a course from a predecessor and tries to revamp it, they are find that they are unable to delete files that do not appear to be in use. Then they extend the number of topics to 25 and realise that they are going to spend the rest of the day clicking red crosses...
Hide
Daniel Neis added a comment -

the related issue has a patch that works on 1.9.5

Show
Daniel Neis added a comment - the related issue has a patch that works on 1.9.5
Hide
Daniel Neis added a comment -

The patches (delete.section.part1.diff and delete.section.part2.diff, which should be applied in this order) implement the code to remove a section of a course (both in weekly and topics format, ajax and not) with all it's modules. Hope you like the solution.

Show
Daniel Neis added a comment - The patches (delete.section.part1.diff and delete.section.part2.diff, which should be applied in this order) implement the code to remove a section of a course (both in weekly and topics format, ajax and not) with all it's modules. Hope you like the solution.
Hide
Anthony Borrow added a comment -

As requested by Daniel - I am adding 1.9 as an affected version. Peace - Anthony

Show
Anthony Borrow added a comment - As requested by Daniel - I am adding 1.9 as an affected version. Peace - Anthony
Hide
Swaroop Kumar added a comment -

Functions that are written in patches will delete the modules of section from section sequence and course_modules table but they doesn't delete the instance record from the module specific table. In other words it doesn't execute the $deleteinstancefunction for the module.

Show
Swaroop Kumar added a comment - Functions that are written in patches will delete the modules of section from section sequence and course_modules table but they doesn't delete the instance record from the module specific table. In other words it doesn't execute the $deleteinstancefunction for the module.
Hide
Daniel Neis added a comment -

Hello, Swaroop Kumar

thanks for your comments. I have made some modifications in the deletesection system since i've uploaded the patches to correct what you said but forgot to re-upload them.

So now, MDL-10405.diff is a new patch that should be applied INSTEAD of the other two.

Thank you again and good luck.

Show
Daniel Neis added a comment - Hello, Swaroop Kumar thanks for your comments. I have made some modifications in the deletesection system since i've uploaded the patches to correct what you said but forgot to re-upload them. So now, MDL-10405.diff is a new patch that should be applied INSTEAD of the other two. Thank you again and good luck.
Hide
Gary Greer added a comment -

I've applied the patch, but can't see any change to the UI. How is this exposed to the user?

Show
Gary Greer added a comment - I've applied the patch, but can't see any change to the UI. How is this exposed to the user?
Hide
Swaroop Kumar added a comment -

Third patch doesn't include the delete section link in the course page. Applying the first patch and then the third one shud work i guess.

Show
Swaroop Kumar added a comment - Third patch doesn't include the delete section link in the course page. Applying the first patch and then the third one shud work i guess.
Hide
Daniel Neis added a comment -

Yes, Swaroop

you're right. I forgot that part on the last patch, and also the rest.php part.
The new file MDL-10405.full.diff has the complete implementation.

Sorry for the trouble.

Show
Daniel Neis added a comment - Yes, Swaroop you're right. I forgot that part on the last patch, and also the rest.php part. The new file MDL-10405.full.diff has the complete implementation. Sorry for the trouble.
Hide
Basil Gohar added a comment -

I would like to see this feature added to Moodle 2.0, as well. There is still no way to do this without a patch, and I am not sure this patch will work for 2.0 at the moment.

Show
Basil Gohar added a comment - I would like to see this feature added to Moodle 2.0, as well. There is still no way to do this without a patch, and I am not sure this patch will work for 2.0 at the moment.
Hide
Daniel Neis added a comment -

Hello,

i've rewritten the patch to work on Moodle 2.1.1+.
You can see the code on github and also download a patch version.

Hope you like,
Daniel

Show
Daniel Neis added a comment - Hello, i've rewritten the patch to work on Moodle 2.1.1+. You can see the code on github and also download a patch version. Hope you like, Daniel
Hide
Tim Hunt added a comment -

Nothing to do with me guv.

Show
Tim Hunt added a comment - Nothing to do with me guv.
Hide
Daniel Neis added a comment -

Hello,

i've rebased the patch to last MOODLE_22_STABLE. See the full patch at: https://github.com/danielneis/moodle/compare/MOODLE_22_STABLE...MDL-10405

Show
Daniel Neis added a comment - Hello, i've rebased the patch to last MOODLE_22_STABLE. See the full patch at: https://github.com/danielneis/moodle/compare/MOODLE_22_STABLE...MDL-10405

People

Dates

  • Created:
    Updated: