MDL-44725 Availability: Add utility API to make unit testing easier (7)

Previously there was no way in PHP to create the JSON values used for
availability, except by manually hard-coding them (the main code to
do this normally is in JavaScript).

This makes unit tests hard to read, so I have implemented static
functions tree::get_root_json and tree::get_nested_json which allow
for easier-to-read unit tests.
MDL-44725 Availability: Replace groupmembersonly - glossary (8)

No change to actual module, only unit tests.
MDL-44725 Availability: Replace groupmembersonly - quiz overrides (9)

This only affects the quiz overrides form, as groupmembersonly was
not used elsewhere. The change simply restricts the list of users
shown when selecting somebody for overrides.

Some additional code is needed to (efficiently) load the $cm object
as a cm_info so that the availability API can be used on it.
MDL-44725 Availability: Replace groupmembersonly - assign (10)

Updated code to restrict list of users. Also includes changes to
ensure that a cm_info object is available (required for availability
checks).

There is a tweak to upgradelib to reflect the different fields used.
(Note that upgradelib is not used during upgrade, but only when
converting assignments from the old assignment module.)
MDL-44725 Availability: Add SQL feature for user lists (11)

The previous API included a facility to filter a list of users
to include only those who are allowed to access an activity, i.e.
only people who belong to the required groups etc.

This change adds a new API function to return SQL that obtains
this list of users, so that it can be combined with other
queries.
MDL-44725 Availability: Replace groupmembersonly - workshop (12)

The availability restrictions that apply to user lists (group, grouping)
now apply in workshop:

* In user lists.
* When randomly allocating users (also now works as expected if you use
  group mode and a grouping with the activity).