Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order not reversed during editing mode #4

Open
ruedigerkupper opened this issue Jan 22, 2021 · 3 comments
Open

order not reversed during editing mode #4

ruedigerkupper opened this issue Jan 22, 2021 · 3 comments

Comments

@ruedigerkupper
Copy link

The plugin does not at all do what it says: "This is a clone of the Moodle weekly course format except the weeks are listed in reverse order." It does not list weeks in reversed order, the most recent week is still at the bottom! The only visible difference to the standard week format is that it can hide future weeks form view.

Is that a bug in the module or in our installation? This is Moodle 3.9.

@ruedigerkupper
Copy link
Author

ruedigerkupper commented Jan 22, 2021

Correcting:
After reading the code it's obvious what happens: Order is reversed only if editing mode is off! In non-editing mode, the most recent week is at top, like advertised. But in editing mode, the most recent week is at the bottom.

This is very confusing and does not make editing easier at all. Is there a technical reason for this or can the "if (!$PAGE->user_is_editing())" phrases be removed from the code?

@ruedigerkupper
Copy link
Author

The code snippet in question is this from renderer.php:

   $sectionsinfo = $modinfo->get_section_info_all();
        if (!$PAGE->user_is_editing()) {
            $sectionsinfo = array_reverse($modinfo->get_section_info_all(), true);
            $sectionsinfo = [array_pop($sectionsinfo)] + $sectionsinfo; // Move section 0 back to top.
        }

array_reverse() is only called when editing mode is off. Why?

@ak4t0sh ak4t0sh changed the title Does not do what it advertises order not reversed during editing mode Jan 27, 2021
@ak4t0sh
Copy link
Owner

ak4t0sh commented Jan 27, 2021

Thanks for your report.
I do not remember why I disabled reverse order on editing mode. Maybe due to JS issues during drag and drop as sections...but not sure.
I'm not against changing this behaviour but as is it there for long time now users are used to it....and changing it will certainly add confusion...so IMHO it should be an option in admin settings.
Currently I do not have a lot of time to work on it but if you are able to do the developments do not hesitate to do a PR and I'll review it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants