From 3c3f6abd4301920bfe5ceba4f7e0d1b46957c98a Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 21 Mar 2022 14:21:57 +0000 Subject: [PATCH] MDL-74284 cohort: set page title on upload tab. Override active URL when viewing system/all cohorts for consistent breadcrumb navigation. --- cohort/index.php | 12 +++++++----- cohort/upload.php | 1 + user/tests/behat/siteadmin_user_breadcrumbs.feature | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cohort/index.php b/cohort/index.php index c726d295982..6b7746a69dc 100644 --- a/cohort/index.php +++ b/cohort/index.php @@ -71,11 +71,13 @@ if ($category) { $showall = false; } else { admin_externalpage_setup('cohorts', '', null, '', array('pagelayout'=>'report')); - $PAGE->set_primary_active_tab('siteadminnode'); - if ($showall == 1) { - $PAGE->navbar->add(get_string('allcohorts', 'cohort'), $PAGE->url); - } else if (!$showall) { - $PAGE->navbar->add(get_string('systemcohorts', 'cohort'), $PAGE->url); + navigation_node::override_active_url(new moodle_url('/cohort/index.php')); + if ($showall) { + $strallcohorts = get_string('allcohorts', 'cohort'); + $PAGE->set_title($strallcohorts); + $PAGE->navbar->add($strallcohorts, $PAGE->url); + } else { + $PAGE->set_title(get_string('systemcohorts', 'cohort')); } } diff --git a/cohort/upload.php b/cohort/upload.php index a9a857e0712..7e3c536b60c 100644 --- a/cohort/upload.php +++ b/cohort/upload.php @@ -69,6 +69,7 @@ if ($uploadform->is_cancelled()) { } $strheading = get_string('uploadcohorts', 'cohort'); +$PAGE->set_title($strheading); $PAGE->navbar->add($strheading); echo $OUTPUT->header(); diff --git a/user/tests/behat/siteadmin_user_breadcrumbs.feature b/user/tests/behat/siteadmin_user_breadcrumbs.feature index 9e8012b0069..78b7fcaba6d 100644 --- a/user/tests/behat/siteadmin_user_breadcrumbs.feature +++ b/user/tests/behat/siteadmin_user_breadcrumbs.feature @@ -13,10 +13,11 @@ Feature: Verify the breadcrumbs in users account and cohort site administration And "Add a new user" "text" should exist in the ".breadcrumb" "css_element" And "Accounts" "link" should exist in the ".breadcrumb" "css_element" And I navigate to "Users > Accounts > Cohorts" in site administration - And "System cohorts" "text" should exist in the ".breadcrumb" "css_element" + And "Cohorts" "text" should exist in the ".breadcrumb" "css_element" And "Accounts" "link" should exist in the ".breadcrumb" "css_element" When I click on "All cohorts" "link" Then "All cohorts" "text" should exist in the ".breadcrumb" "css_element" + And "Cohorts" "link" should exist in the ".breadcrumb" "css_element" And "Accounts" "link" should exist in the ".breadcrumb" "css_element" And I click on "Add new cohort" "link" And "Add new cohort" "text" should exist in the ".breadcrumb" "css_element" -- 2.11.4.GIT