* Introduce function format_weeks_get_section_dates which is used
as the consistent place to calculate the current section start and
end date
* Rework callback_weeks_get_section_name to not use the above function
rather than do crazy needless looping through all sections to work
out the current week title.
* Change the just introduced is_current renderer function to share
the format_weeks_get_section_dates function to ensure both the title
and 'current week' are using the same dates to do their job
Conflicts:
lib/db/upgrade.php
lib/phpunit/lib.php
version.php
Fixed:
lib/db/upgrade.php - duplicate course->sectioncache add code
lib/db/install.xml - cleanup needed because xmldb editor was not used
lib/phpunit/classes/util.php - cleanup $GROUPLIB_CACHE on test reset
Credit: original version done by Kirill Astashov of NetSpot (netspot.com.au),
finished and tweaked by sam.
This change adds conditional availability support for sections analagous to
that already available for activities. (Backend, UI, backup/restore.)
In order that this feature does not reduce performance, section cacheing has
also been added using a new course 'sectioncache' field analagous to modinfo.
The new feature integrates with activity availability so that activities
inside sections which are not available are automatically not available
themselves (meaning it works to restrict access).
The renderer isn't a public API yet, its just reducing code duplication
and tidying things up. So not making the methods public for other plugins
to abuse. We hope to solve this properly in 2.4
Topics and weeks have been converted to use a shared renderer to output
their content.
Note, I started with good intentions but this renderer has mixed
paradgims due to fast and cheap winning out on the trinity.
AMOS BEGIN
MOV [currenttopic,access],[currentsection,format_topics]
MOV [currentweek,access],[currentsection,format_weeks]
AMOS END
This is a course format independent url param and replaces weekly/topic specific params.
By using a standardised param we are able to use this url consistenly across the codebase
and reduce the risk of param collision
Using topics format as default is not a great idea, as we can end up
half-working dragdrop for some formats. With the current soiution, drag-drop
will not work for format, unless required js functions have been created in
format.js
It allows to define M.course.format.swap_sections and
M.course.format.get_section_selector in the course format javascript file, so
that course dragdrop is aware about perculiar layout and changes that need to
be done when sections are swapped.