diff --git a/contentbank/classes/contentbank.php b/contentbank/classes/contentbank.php index dc277f72c35..05ca94d0b56 100644 --- a/contentbank/classes/contentbank.php +++ b/contentbank/classes/contentbank.php @@ -247,7 +247,7 @@ class contentbank { if ($categories === false || $courses === false) { list($categories, $courses) = get_user_capability_contexts($capability, true, $userid, true, - 'shortname, ctxlevel, ctxinstance, ctxid', 'name, ctxlevel, ctxinstance, ctxid', 'shortname', 'name'); + 'fullname, ctxlevel, ctxinstance, ctxid', 'name, ctxlevel, ctxinstance, ctxid', 'fullname', 'name'); $categoriescache->set($userid, $categories); $coursescache->set($userid, $courses); } diff --git a/contentbank/classes/output/bankcontent.php b/contentbank/classes/output/bankcontent.php index 632550434c9..898c0120d24 100644 --- a/contentbank/classes/output/bankcontent.php +++ b/contentbank/classes/output/bankcontent.php @@ -16,6 +16,7 @@ namespace core_contentbank\output; +use context_course; use context_coursecat; use core_contentbank\content; use core_contentbank\contentbank; @@ -142,7 +143,9 @@ class bankcontent implements renderable, templatable { foreach ($this->allowedcourses as $allowedcourse) { // Don't add the frontpage course to the list. if ($allowedcourse->id != $SITE->id) { - $options[$allowedcourse->ctxid] = $allowedcourse->shortname; + $options[$allowedcourse->ctxid] = format_string($allowedcourse->fullname, true, [ + 'context' => context_course::instance($allowedcourse->ctxinstance), + ]); } } if (!empty($options)) { diff --git a/contentbank/tests/behat/navigate_content.feature b/contentbank/tests/behat/navigate_content.feature index 2f2657bed3f..d841a78cf4d 100644 --- a/contentbank/tests/behat/navigate_content.feature +++ b/contentbank/tests/behat/navigate_content.feature @@ -37,9 +37,9 @@ Feature: Navigate to different contexts in the content bank And the "Choose course or category" select box should contain "System" And the "Choose course or category" select box should contain "Cat 1" And the "Choose course or category" select box should contain "Cat 2" - And the "Choose course or category" select box should contain "C0" - And the "Choose course or category" select box should contain "C1" - And the "Choose course or category" select box should contain "C2" + And the "Choose course or category" select box should contain "Course 0" + And the "Choose course or category" select box should contain "Course 1" + And the "Choose course or category" select box should contain "Course 2" And I should see "santjordi.h5p" And I should not see "santjordi_rose.h5p" And I should not see "Dragon.h5p" @@ -47,7 +47,7 @@ Feature: Navigate to different contexts in the content bank Then I should not see "santjordi.h5p" And I should see "santjordi_rose.h5p" And I should not see "Dragon.h5p" - And I set the field "Choose course or category" to "C0" + And I set the field "Choose course or category" to "Course 0" And I should not see "santjordi.h5p" And I should not see "santjordi_rose.h5p" And I should see "Dragon.h5p" @@ -68,17 +68,17 @@ Feature: Navigate to different contexts in the content bank And I add the "Navigation" block if not present And I expand "Site pages" node When I click on "Content bank" "link" - And the "Choose course or category" select box should contain "C0" - And the "Choose course or category" select box should contain "C1" + And the "Choose course or category" select box should contain "Course 0" + And the "Choose course or category" select box should contain "Course 1" And the "Choose course or category" select box should not contain "System" And the "Choose course or category" select box should not contain "Cat 1" And the "Choose course or category" select box should not contain "Cat 2" - And the "Choose course or category" select box should not contain "C2" + And the "Choose course or category" select box should not contain "Course 2" And I should see "Dragon.h5p" And I should not see "princess.h5p" And I should not see "santjordi.h5p" And I should not see "santjordi_rose.h5p" - And I set the field "Choose course or category" to "C1" + And I set the field "Choose course or category" to "Course 1" Then I should not see "Dragon.h5p" And I should see "princess.h5p" And I should not see "santjordi.h5p" @@ -89,12 +89,12 @@ Feature: Navigate to different contexts in the content bank And I am on the "C0" "Course" page logged in as "teacher" And I expand "Site pages" node When I click on "Content bank" "link" - And the "Choose course or category" select box should contain "C0" - And the "Choose course or category" select box should contain "C1" + And the "Choose course or category" select box should contain "Course 0" + And the "Choose course or category" select box should contain "Course 1" And the "Choose course or category" select box should contain "Cat 1" And the "Choose course or category" select box should not contain "System" And the "Choose course or category" select box should not contain "Cat 2" - And the "Choose course or category" select box should not contain "C2" + And the "Choose course or category" select box should not contain "Course 2" And I should see "Dragon.h5p" And I set the field "Choose course or category" to "Cat 1" And I should not see "Dragon.h5p"