The mod_data is forcing teachers to understand how to write templates
even if they want to use basic forms. With this patch the default
templates will be auto updated unless the user manually define the
templates.
From now on, the data_generate_default_template method will always return
a string with the template content or an empty string when there is no
content available (for instance, when the database has no fields).
This method won't return a boolean anymore.
This commit adds support to description field for presets:
- For plugin presets, description will be stored in the module_help
string in lang files.
- For saved presets, a new element, <description>, has been added
to the preset.xml file, to include this information.
A new field has been added to the "Save as preset" modal, to let users
define description (which is empty by default, to support pre-existing
presets that won't have it).
Apart from that, the "Save as preset" workflow has been slightly improved,
following the Product UX/UX suggestions to hide the checkbox to overwrite
the preset by default and show it only if the user tries to save a preset
with an existing name.
This activity currently supports two different preset types:
- Datapreset plugins, that can be installed copying them to the
mod/data/preset folder.
- Presets saved manually by users.
This commit adds an attribute to the presets to mark them, in order
to identify them later (because, for instance, the plugins can't be
removed).
Apart from that, the methods in lib.php, involved with this issue, have
been deprecated. New methods have been implemented in the manager class,
covering them with PHPUnit tests.
Introduces some changes to the exising _extend_settings_navigation()
methods that utilize the global $PAGE object. In order to accomodate
the changes done for the secondary navigation for single activity
courses, the methods that extend the settings navigation can no longer
rely on the $PAGE object, instead the more reliabe way to obtain this
infomation is through the get_page() method from settings_navigation
class.
The following commit disables the acivity header information in
pages where this information is not required, adds missing headings,
updates the breadcrumbs, repositions the groups selector in the
database view page.
Some pages have settings that really aren't required anymore.
These have been removed and a function has been aded so that other
developers can turn off the navigation overflow if they want.
This class would belong more appropriately within the 'user' API
(core_user) instead of within the 'core' API, since it is
directly related to user data.
Since the class has only just been added to Moodle, now is a good
time to move it.
In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
When grades are deleted, it needs to know the context so any files
in the gradebook can be deleted. This means module delete_instance
functions must delete the grade_item before they delete the module record.
Grades that have been hidden will appear in the outline/complete
report - even if the user is a student.
The modules that have been fixed are:
* mod_assign
* mod_data
* mod_forum
* mod_glossary
* mod_lesson
* mod_scorm
* mod_workshop
The capabilities changed ('contextlevel' => CONTEXT_COURSE changed to
'contextlevel' => CONTEXT_MODULE) are:
* moodle/site:accessallgroups
* moodle/site:viewfullnames
* moodle/site:trustcontent
* moodle/site:viewuseridentity
This list came from reviewing the _get_extra_capabilities functions in
all core activities. They were all somewhat inconsistent, but I think it
makes sense that these capabilities are consistently overridable in all
activities. E.g. moodle/site:accessallgroups affects conditional
availability even if there is no other user of groups, and
moodle/site:viewuseridentity and moodle/site:viewfullnames affect the
logs report, if nothing else.
As a result of this, several _get_extra_capabilities functions are no
longer needed, and all the rest have been simplified.
This commit reviews all continue uses in core happening within a
loop / switch / case hierarchy. This does not cover:
- Changes to libraries. Will be handled in another issue / commit.
- Uses out from loops, will be reviewed by other commit.
The policy followed has been:
- When possible, take rid of the continue.
- When clearly the intention was to jump to next element in loop
change to continue 2
- When it was not clear, keep old behavior switching to break, no
matter how weird the behavior may be.