* When completion tracking is not enabled for the course, it does not
make sense for the course's showcompletionconditions setting to
be set according to the default value indicated by the
"moodlecourse | showcompletionconditions" admin setting. Setting
showcompletionconditions as enabled when completion tracking is disabled
makes even less sense. So in such a case, we should not be setting a
default value for showcompletionconditions and allow it to be null.
* When the course is edited and completion tracking is enabled, this
also would set the "Show completion conditions" field to default to the
value set in the "moodlecourse | showcompletionconditions" admin
setting.
This commits adds a fallback for plugins which does not have
custom_completion implementation.
For those cases, it will search for {modulename}_get_completion_state
callback in the plugin and call get_overall_completion() method in
cm_completion_details class to get the overall completion state for
a course module and user.
* *_get_completion_state() callback functions have been deprecated and
should no longer be used. Plugins that define custom completion rules
must implement the mod_[modname]\completion\custom_completion class that
extends the \core_completion\activity_custom_completion base class.
* activity_completion_condition_displayed_as()
- Shows the status of an automatic completion condition for a given
activity
* activity_should_have_the_completion_condition()
- Checks that the activity displays the given completion condition
* manual_completion_button_displayed_as()
- Shows the status of the manual completion button for a given
activity
* the_manual_completion_button_for_activity_should_be_disabled()
- Checks that the manual completion button for the given activity is
disabled.
* there_should_be_no_completion_for_activity()
- Checks that the activity does not show completion information
* toggle_the_manual_completion_state()
- Toggles the manual completion button's state for a given activity
* overridden_manual_completion_button_displayed_as()
- Checks the manual completion state of an activity.
* overridden_activity_completion_condition_displayed_as()
- Checks if the activity with specified name is maked as complete.
Since cm_info::customdata can be of any type, we need to cast it to an
array first before checking for custom completion rules. Otherwise,
an exception can be thrown (e.g. customdata has been set as an stdClass)
Tests cover
- get_overall_completion_state()
- is_available()
- validate_rule()
Tests don't cover
- methods that rely on static methods such as:
- is_defined()
- static methods in the class because they can't be mocked
- abstract methods that can be tested better by the plugins
that extend activity_custom_completion such as:
- get_state()
- get_defined_custom_rules()
- get_custom_rule_descriptions()
All the setup/teardown/pre/post/conditions template methods
now are required to return void. This was warned with phpunit 7
and now is enforced.
At the same time, fix a few wrong function names,
provider data and param types, return statements...
Adds filtering on the completion criteria form to ensure we are only
selecting actual course instances of this type. Prior to this change
we would also get NULL values from unrelated criteria types.
The "Ok" (with lower-case "k") string was added in MDL-68409 to keep
backwards compatibility with YUI alerts that had it hard-coded. But we
should not need to explain to translators why we have two OK strings
like this and why they use different wording.
Additionally, there would be inconsistency in Behat tests and everywhere
depending on which "OK" or "Ok" string is used for buttons.
So instead, this patch changes the hard-coded 'Ok' string in the YUI and
we should stick to "OK" from now on everywhere.
Applying filters on an activity module description when using it as a
new calendar event's description is bad m'kay? We need to store the raw
text and apply the filters only when we actually display the text. That
way, filters (such as multi-language content) may actually fully work
and we do not initialise the theme and output machinery.
Additionally, we need to explicitly set the format of the description
text to HTML (because we have converted it to it already). Otherwise it
defaults to the current user's preferred editor format.
This is still a pragmatic hot-fix solution. The proper solution would be
to pass the raw text, format and embedded files.
span is not a valid content wrapper tag.
Moreover, according to W3C validation service report, it is not valid to
have div elements as children of a span element.
We can safely replace span with div here because the element's css class
is .action and display of .action is set to flex in both boost and
classic themes.
Passing parameters to implode() in reverse order is deprecated, use
implode($glue, $parts) instead of implode($parts, $glue).
This commit corresponds to phpunit and manual detections, core files.
This commit shifts the content of legacy completion_cron_criteria()
and completion_cron_completions() functions to completion_regular_task.
Also, those functions are deleted as part of this commit.