MDL-47555 core_availability: Issue with page layout & grade restriction

* Set pagelayout before getting section info, otherwise conditional activity renderers will default to the default 'base' layout.
MDL-47499 tasks: Scheduled tasks custom schedule is reset on upgrade.

Add a unit test for reset_scheduled_tasks_for_component and make sure it doesn't clear
customised schedules for existing tasks.
MDL-47632 calendar: Fixed iCal link going blue after visiting it
MDL-47704 Grades: Fix for set_usedinaggregation

Used in aggregation was not resetting previously set values
when recalculating an aggregation. This meant that items no longer
in the aggregation, were displayed with stale weights in the user report.
MDL-47738 gradereport_history: User selector handles broke with 0 user

It was impossible to reopen the dialogue when the last search result
did not return any user.
MDL-47684 mod: better validation of rating options
MDL-47752 grading: fixed bugs with the modgrade element
MDL-46499 navigation: better enrolled course limit

We now user $CFG->navcourselimit to limit the number of
courses shown in the navigation when browsing another users
full profile. Previously it showed all courses which caused
some slowdown.
MDL-47077 report_participation: fixed pagination in groups
MDL-47757 events: Fixed doc block and missing string.

The language events were missing the @since tag and
the grade single view report was missing a language
string.
MDL-47675 phpunit: Update unit tests to pass on MSSQL

Unit tests were failing on MSSQL. gc_collect_cycles() was
removed from the phpunit utils.php file to save time in running
the tests, but MSSQL doesn't clean up open files as well as
other databases.

This patch includes the garbage collection for the unit tests
that require it.
MDL-47759 tool_monitor: Fix permissions issue
MDL-46332 : Display of 'Remove' button in Add/Remove Groups in Grouping

Fixed styling of Add/Remove Groups in Grouping to now use the same
layout as the Group Members page.
This fixes the issue with buttons being unaligned and introduces
consistency between pages.
MDL-47340 action_menu: selector, RTL, consistency fixes
MDL-32616 question engine: move unit test to better name
MDL-32616 question engine: set_max_mark_in_attempts MySQL perf

The MySQL (& Maria DB) query 'optimizer' was failing to handle this
query, so for that DB only, we give it an equivalent query that it can
get right.

With unit test.
MDL-20367 Grades: Allow real numbers as grade boundaries

Patch by Huy Hoang (I just git-ified it).
MDL-47740 question engine: let qs update variant later if appropriate

Variant has two purposes. First to determine which version of the
question the student will see. Hence it is used to set up the state
of the quetsion when the question is started. Then the internal state of
the question is saved in the first step.

Once that has been done, the variant number is purely informative, and
just used to break down the statistics.

In some cases (the one I have in mind is qtype_opaque) then there is a
complex randomisation process, which may lead to several inital variant
numbers acutally giving the same version of the question. In this case
it is nice if the question can update the stored variant number, to make
the statistics more meaningful.
MDL-47791 question editing: remove permission info from above the form

This information is not really meaningful for users, and takes up prime
real-estate, so we are removing it.
MDL-47795 SCORM: SCORM report not a report.