MDL-69225 h5pactivity: Review when and which banners display
commit6fb09beb86739b903da2b07838bfb17d7aa33ef4
authorSara Arjona <sara@moodle.com>
Thu, 11 Jan 2024 15:23:43 +0000 (11 16:23 +0100)
committerSara Arjona <sara@moodle.com>
Thu, 25 Jan 2024 16:46:36 +0000 (25 17:46 +0100)
tree32c6d42f95c9ae5fc44dd5755577120e2564b425
parentf30110b5ebf9090ee484986e020d43a7819fc436
MDL-69225 h5pactivity: Review when and which banners display

The UX team proposal is to display two different notifications, to avoid confusion:

1. When the user is in preview mode:
Message: 'You are in preview mode.'
Notification Type: Information (blue), with the information permanently visible and not dismissible,
ensuring continuous awareness.

2. When activity tracking is disabled:
Message: 'Attempt tracking is not enabled for this activity. You can enable it in Settings.'
Notification Type: Warning (yellow) with a close icon for dismissal if tracking is intentionally disabled.

These notifications should only be visible to teachers and content creators, not students.
If a teacher also has a student role, this information should not appear when logged in as a student.

That's why the pre-existing is_tracking_enabled() function has been updated to only check if tracking
is on for an activity, without considering user capabilities (that's why the $user parameter has been
removed from this function too). Besides, a new function called can_submit() has been created to find
out if users are allowed to submit an activity.
mod/h5pactivity/classes/external/get_h5pactivity_access_information.php
mod/h5pactivity/classes/local/manager.php
mod/h5pactivity/classes/xapi/handler.php
mod/h5pactivity/lang/en/h5pactivity.php
mod/h5pactivity/tests/behat/attempt_options.feature
mod/h5pactivity/tests/behat/duplicate_delete_h5pactivity.feature
mod/h5pactivity/tests/behat/sending_attempt.feature
mod/h5pactivity/tests/local/manager_test.php
mod/h5pactivity/view.php