Skip to content

Commit

Permalink
MDL-74836 theme: Display activity header on secure layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
nexterday authored and marxjohnson committed Nov 11, 2024
1 parent 2b337b4 commit cb13bba
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@mod_quiz @quizaccess @quizaccess_seb
Feature: View the activity header when Safe Exam Browser is required
In order to correctly identify the quiz when Safe Exam Browser is required
As a student
I need to be able to see the quiz information in the activity header

Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Sam1 | Student1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
| questioncategory | qtype | name | questiontext |
| Test questions | truefalse | TF1 | TF question |
And the following "activity" exists:
| activity | quiz |
| course | C1 |
| idnumber | 00001 |
| name | Test quiz name |
| intro | Test quiz description |
| seb_requiresafeexambrowser | 1 |
| grade | 10 |
And quiz "Test quiz name" contains the following questions:
| question | page |
| TF1 | 1 |

Scenario: Quiz description is displayed when Safe Exam Browser is required
When I am on the "Test quiz name" "quiz activity" page logged in as student1
Then I should see "Launch Safe Exam Browser"
And I should see "Test quiz description"
6 changes: 6 additions & 0 deletions theme/boost/layout/secure.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,11 @@
'hasblocks' => $hasblocks
];

if (empty($PAGE->layout_options['noactivityheader'])) {
$header = $PAGE->activityheader;
$renderer = $PAGE->get_renderer('core');
$templatecontext['headercontent'] = $header->export_for_template($renderer);
}

echo $OUTPUT->render_from_template('theme_boost/secure', $templatecontext);

3 changes: 3 additions & 0 deletions theme/boost/templates/secure.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
<section id="region-main" {{#hasblocks}}class="has-blocks"{{/hasblocks}} aria-label="{{#str}}content{{/str}}">

{{{ output.course_content_header }}}
{{#headercontent}}
{{> core/activity_header }}
{{/headercontent}}
{{{ output.main_content }}}
{{{ output.course_content_footer }}}

Expand Down
6 changes: 6 additions & 0 deletions theme/classic/layout/secure.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@
'bodyattributes' => $bodyattributes
];

if (empty($PAGE->layout_options['noactivityheader'])) {
$header = $PAGE->activityheader;
$renderer = $PAGE->get_renderer('core');
$templatecontext['headercontent'] = $header->export_for_template($renderer);
}

echo $OUTPUT->render_from_template('theme_classic/secure', $templatecontext);

3 changes: 3 additions & 0 deletions theme/classic/templates/secure.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
<div class="card">
<div class="card-body">
{{{ output.course_content_header }}}
{{#headercontent}}
{{> core/activity_header }}
{{/headercontent}}
{{{ output.main_content }}}
{{{ output.course_content_footer }}}
</div>
Expand Down

0 comments on commit cb13bba

Please sign in to comment.