Prior to the fix, if you did not have a capability like mod/page:view,
then you woulds still see the link to the Page activity in the course
section, but when you clicked on it, you would run into a
require_capability error.
It is a principle that we never show users a link to a page they are not
allowed to access, therefore, when users do not have mod/...:view, they
should not see the link on the course page.
This patch implements this in the cm_info class, in a similar way to how
access restrictions by groups works.
It does not assume that the mod/...:view capability exists. If the
capability does not exist, then users are not prevented from seeing the
link.
- Core upgrade MUST NOT call rebuild_course_cache() at all - update DB directly instead
- Plugins MUST call rebuild_course_cache(.., TRUE) for clearing the course cache and can not update DB directly
- Plugins MUST NOT call rebuild_course_cache() unless for clearing the cache
- Created function upgrade_ensure_not_running() to be included in other functions that can not be used during upgrade
- Course format may define additional fields (format options) to store for course and each section
- Edit course form allows to edit format-specific options and refreshes their list on format change
- Course format may provide it's own form for editing a section
- Default form for editing section allows to edit all format-specific fields
- Class section_info refactored, it defines magic methods such as __get() to access basic section
information and format-specific options (retrieved only on the first request)
- format_base::update_course_format_options() allows to watch pre-update state of the course,
format_legacy automatically copies the options with the same names between formats
- added function get_module_types_names() returning the list of localised strings used for module names;
- added function cm_info::get_used_module_names();
- added magic properties cm_info:: and cm_info:: returning human readable module name;
- replaced usage of function get_all_mods() with get_fast_modinfo() and get_module_types_names();
- function print_section_add_menus() may now retrieve the modules names list itself;
- deprecated function get_all_mods()
- added class format_base as the base for all course formats
- added class format_site for the pseudo-format 'site' used for displaying activities on the front page
- added class format_legacy that overrides format_base functions with calling old-style 'callback_xxx' functions
- replaced all usage of 'callback_xxx' functions with format_base methods
- made arguments of get_section_name(), get_course_url() more flexible
- deprecated function get_generic_section_name(), it's contents is moved to format_base
- global_navigation::format_display_course_content() is removed, plugins can supress the sections navigations using extend_course_navigation()
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 'Show description' feature is about optionally including module description on the course page. This change include the necessary infrastructure - new database field, new FEATURE constant, changes to forms to display it, new language strings for it, backup and restore, and old course conversion. (I found the places to change by searching for an existing field in course_modules).
Documentation for the field is included in install.xml and in modinfolib.
This commit:
a) moves modinfo code into new library modinfolib.php
b) uses classes instead of stdClass objects, allowing a huge amount of documentation (and IDE completion)
c) adds hooks so that plugins other than forum can display messages like forum's 'unread', and plugins other than label can display html (apart from/as well as their view.php link) on the course view page
d) removes current hacks for forum and label (mainly in print_section but also across the code), replacing with new 'content' and similar variables [this is the reason for the changes in blocks, etc]
e) reduces size of modinfo in database (only when rebuilt) by excluding empty fields
The change is intended to be backward compatible and does not affect the format of modinfo in database.